Runtime View

Nine scenarios cover the system at runtime. Three are error or recovery scenarios: Context Auto-Compaction, User Interruption and LLM Rate-Limit. Together the scenarios exercise every building block from [section-building-block-view].

Startup and Session Resume

On launch the front end resolves the working directory and trust, builds configuration, then either starts fresh or restores a past session.

Conversation Turn (happy path)

rt turn

_conversation_loop appends the user message, runs the middleware pipeline, performs the LLM turn, and executes any tool calls as concurrent asyncio tasks before looping again [vibe/core/agent_loop.py:855-937, vibe/core/agent_loop.py:1217-1259].

Tool Approval Interception

Before a tool runs, _execute_tool_call resolves its permission. An ASK tier invokes the approval callback into the UI; a rejection increments tool_calls_rejected and feeds a rejection result back to the LLM so the conversation continues [vibe/core/agent_loop.py:1071-1167, vibe/core/tools/permissions.py:47-68]. Approved patterns are remembered in the PermissionStore for the rest of the session.

Context Auto-Compaction (recovery scenario)

rt compact

When context_tokens crosses the model’s auto_compact_threshold, AutoCompactMiddleware returns COMPACT; the loop summarises the history into [system, summary], forks to a new session id linked to its parent, and recounts tokens [vibe/core/middleware.py:81-96, vibe/core/agent_loop.py:1681-1749].

User Interruption (error / recovery scenario)

rt interrupt

Escape raises a user-cancellation event; in-flight tool tasks receive asyncio.CancelledError, the cancellation is recorded as a tool result, and the loop breaks without corrupting the message history [vibe/core/agent_loop.py:897-906, vibe/core/agent_loop.py:1170-1178, vibe/core/agent_loop.py:1244-1259].

LLM Rate-Limit / Context-Too-Long (error scenario)

_chat catches rate-limit and context-too-long errors raised by the LLM Backend Layer and surfaces them distinctly; the Mistral backend retries transient failures with exponential backoff before the error propagates; the ACP Bridge maps a context-too-long failure to a JSON-RPC ContextTooLongError [vibe/core/agent_loop.py:1365-1374, vibe/core/llm/backend/mistral.py:212-222, vibe/acp/exceptions.py:107].

Teleport to Cloud

/teleport (gated by plan eligibility) validates the git repository, confirms the working commit is pushed, then starts a remote Vibe Code workflow; RemoteEventsSource attaches and streams the cloud workflow’s events back into the UI [vibe/core/teleport/teleport.py:46-150, vibe/core/teleport/git.py:27-100, vibe/core/nuage/remote_events_source.py:33-120].

ACP Session

vibe-acp runs VibeAcpAgentLoop, the ACP agent (see [section-building-block-view]), as an ACP agent over stdio. The agent holds one AcpSessionLoop per ACP session: new_session creates a fresh AcpSessionLoop with the default agent; load_session replays a past conversation. ACP-specific tools delegate file and terminal operations to the connected ACP client [vibe/acp/session.py:11, vibe/acp/acp_agent_loop.py:614-648, vibe/acp/acp_agent_loop.py:869-920, vibe/acp/tools/base.py:13-54].

First-Run Onboarding

When no API key is configured, the Setup block walks the user through Welcome → auth-method → browser sign-in or manual API key, then persists the key to ~/.vibe/.env (or keyring) [vibe/setup/onboarding/screens/welcome.py:46-80, vibe/setup/auth/api_key_persistence.py:38-64].