Expand description
The runtime flags a pane’s CLI is given, decided in srv.
The runtime menu shows agent:runtime block meta; the process runs on
cmd:args. The frontend keeps the two in step (buildPaneArgs), but
agent.open — MCP OpenAgent, layouts, agent.define + open — builds a
pane without the frontend. It wrote cmd:args from the catalog alone and no
agent:runtime, so the pane’s CLI ran on its own default model (Opus 5.5 /
medium on current CLIs) while the menu fell back to Sonnet / high. A pane
with a session on file spawns eagerly at open, before any message, so
nothing ever corrected it.
docs/retro/RETRO_RESUMED_AGENT_SPAWNS_WITHOUT_RUNTIME_FLAGS_2026_09_30.md,
docs/reports/REPORT_AGENT_RUNTIME_BINDINGS_2026_09_30.md (G3).
Two entry points, one decision, for the two providers whose model the menu wires (Claude, Codex):
seed_launch— a paneagent.openis creating.with_runtime_flags— a pane that already exists, at the moment it spawns. srv never readsagent:runtimeotherwise, and a persistent process never re-readscmd:args, so a pane saved before the fixes (or written by any path that forgets) would run on the CLI default for its whole life. This is the backstop that makes srv authoritative at the one moment it matters.
The defaults are duplicated from the frontend by necessity and pinned to
its by providers/runtime-defaults-consistency.test.ts.
Structs§
- Agent
Runtime Event - The
agentruntimeevent’s payload (mps_events::AgentRuntime). An absent value is omitted, not null; what the CLI reported is sent only while a process runs. - Effective
Runtime - What the running CLI says it is ACTUALLY using, from its
get_settingsanswer (applied): the alias on the command line resolved to a concrete model, and the effort in force.Nonefor a field the CLI reports as null (Haiku has no effort). - Remembered
- What the user last picked in the Runtime menu for an agent (
last_runtimeondb_agents), already validated. Each setting is optional: only what was picked is here, and the rest keeps coming from the definition. - Runtime
Choice - What
Agents updatewithmodeloreffortwrites to a pane: the same two keys the Runtime menu writes (frontend/app/view/agent/runtime-apply.ts). - Seeded
Launch - Spawn
Runtime - What an agent process was actually spawned with: the runtime flags in its
final argv. The Runtime menu shows what was REQUESTED (
agent:runtime); this is what the process was GIVEN, so the menu can say when they differ.Nonefor a flag the argv does not carry — the CLI then uses its own default.
Constants§
- SETTINGS_
REQUEST_ PREFIX - Prefix of the
request_idof ourget_settingsrequests, so the answer can be told from the answers to anything else.
Functions§
- agent_
runtime_ event - The
agentruntimeevent for one pane (persisted, so a menu that mounts late still gets the latest).runningisNonewhen no process is alive — then there is nothing for the menu to compare against.effectiveis what the CLI reported using, when it has (seeEffectiveRuntime). - apply_
remembered - Lay what the user last picked over the definition, the way the frontend’s
launch does (
resolveLaunchRuntime): the remembered setting beats the definition’s flag for it, and that flag is taken out of the pane’s copy. - apply_
to_ meta - Write the three keys that must travel together into a new pane’s meta:
cmd:args(what runs),agent:runtime(what the menu shows) andagent:provider_flags(what the frontend’s per-send rebuild reapplies — it starts from the catalog and would drop the definition’s flags on the first send otherwise, #2872). One call, so no caller can write one without the others. - effective_
from_ control_ response - The effective runtime in a
get_settingsanswer, orNonefor any other frame, an error answer (a CLI that has noget_settings) or one withoutapplied. The shape is{type: control_response, response: {subtype: success, request_id, response: {applied: {model, effort, ...}}}}. - endpoint_
model - The model a Claude Code agent pointed at a custom server (
ANTHROPIC_BASE_URLin itscmd:envthat is not Anthropic’s) asks it for:ANTHROPIC_MODEL, else the alias (sonnet,opus,haiku) the CLI maps to that tier’sANTHROPIC_DEFAULT_*_MODEL. None where the agent is not on a custom server, or names no model. - flags_
pin provider_flags_pinfor the definition’s flags as stored (AgentDefinition::provider_flags), which an agent with no pane open has only here.- is_
claude_ effort - The efforts a Claude agent takes.
- is_
claude_ model_ name - Whether
modelis one a Claude agent can be given: an alias (opus,sonnet,haiku) or a concrete id (claude-fable-5-2), with no space or control character in it. - provider_
flags_ pin - Whether the agent definition’s own provider flags (
agent:provider_flags) carry a model and an effort: that is the operator’s choice, which a runtime pick does not override (with_runtime_flags). - publish_
agent_ runtime - runtime_
choice - The pane’s runtime once
modelandeffort(each only when given) are changed.keep_effort_flagleaves a--effortin the argv alone (the definition’s own provider flags carry one). - runtime_
over_ stale_ flags - A one-shot pane’s (a container agent’s)
cmd:argswith the--modeland--effortthe pane’s runtime picker has since moved past taken out, so thatwith_runtime_flagslays the runtime’s own over them. The picker records a container agent’s choice inagent:runtimeonly (each turn readscmd:argsagain, and no process restarts), butwith_runtime_flagsnever overrides a flag already there, so a--modelstored at launch kept the turns on the old model while the pane said the new one. The definition’s own flags are the operator’s choice and stay (provider_flags_pin), and a pane with no runtime choice keeps the flags it has. - seed_
launch - Build
cmd:argsandagent:runtimefor a freshly opened pane. - settings_
request_ line - The control request asking a running Claude CLI what it is using. Observed on CLI 2.1.285 to be answered straight after spawn, with no account and no message (docs/specs/SPEC_RUNTIME_MENU_REMAINING_GAPS_2026_10_01.md §7.3).
- spawn_
runtime_ from_ args - The runtime flags in
args. The LAST occurrence of a repeated flag wins, which is how the CLI is expected to read them (unverified; it matters only whenprovider_flagsrepeats a flag the runtime already set).--dangerously-skip-permissionsreads asbypass;--permission-mode XasX. - with_
runtime_ flags argsas stored incmd:args, plus any runtime flag it lacks, taken from the pane’sagent:runtime(or the defaults when it has none).