Repository navigation
fix(agent-launch): refuse a disabled agent on the chat route too - #23043
brennanb2025 wants to merge 5 commits into
Conversation
6967332 to
efa42d6
Compare
Review status: ready, with one product decision openHead: Review loops. Five, with fixes pushed as they were found:
Readiness checklist. PASS at the start and at the end of the review, with no P0, P1 or P2 findings. Live desktop QA. A dev host on a separate Mac, with a fresh profile, run on
Open product decision (existing sessions). This PR only refuses new sessions. Existing chats of a turned-off agent keep working: sending, reopening, restarting, recovery, and Retry of a start that failed for some other reason. That means Also seen during QA, already on
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change adds runtime-specific agent enablement checks and a shared disabled-agent error. Agent launches and structured-session attachment or creation now refuse disabled agents in the covered paths. Recorded sessions remain eligible for attachment, and terminal reuse skips the launch check. The runtime requires an enablement reader for structured-session host installation. Tests cover refusal timing, replay, existing sessions, and enabled-agent cases. Priority: ➖ Normal Merge Risk: 🔵 Low · up to A failed settings read can leave disabled-agent enforcement ineffective. Merge with owner awareness of this bounded failure mode. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change closes a path that could start a turned-off agent through chat. Review found no demonstrated new security exposure, but a setting changed during an in-flight launch may not be enforced at the final creation step. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 14d7a958-b31d-47da-a498-fe7140306ef5
📒 Files selected for processing (26)
src/main/agent-launch/agent-launch-enablement.tssrc/main/native-chat/agent-session-wire/structured-agent-session-attach-flow.tssrc/main/native-chat/agent-session-wire/structured-agent-session-attach-orchestration.tssrc/main/native-chat/agent-session-wire/structured-agent-session-disabled-agent-refusal.tssrc/main/native-chat/agent-session-wire/structured-agent-session-disabled-agent.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host-types.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host.tssrc/main/runtime/claude-structured-session-integration.test.tssrc/main/runtime/orca-runtime-get-worktree-ps.tssrc/main/runtime/orca-runtime-resolve-worktree-removal-target.tssrc/main/runtime/orca-runtime-structured-agent-enablement-wiring.test.tssrc/main/runtime/rpc/methods/agent-launch-disabled-agent.test.tssrc/main/runtime/rpc/methods/agent-launch.tssrc/main/runtime/rpc/methods/orchestration/worker/structured-worker-launch-seed-options.test.tssrc/main/runtime/rpc/methods/structured-agent-session-create.tssrc/main/runtime/rpc/methods/structured-agent-session-precommit-refusal.test.tssrc/main/runtime/rpc/methods/structured-agent-session-precommit-refusal.tssrc/main/runtime/rpc/methods/structured-agent-session-rpc.test-fixture.tssrc/main/runtime/structured-agent-session-integration-replay.test.tssrc/main/runtime/structured-agent-session-integration.test.tssrc/main/runtime/structured-agent-session-runtime-exit.test.tssrc/main/runtime/structured-agent-session-runtime.test.tssrc/main/runtime/structured-agent-session-runtime.tssrc/main/runtime/structured-claude-scripted-runtime-test-support.tssrc/shared/agent-disabled-launch-refusal.tstests/e2e/cross-version-wire/structured-agent-session-host-fixture.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
| export function isAgentEnabledForRuntime( | ||
| runtime: Pick<OrcaRuntimeService, 'getClientSettings'>, | ||
| agent: TuiAgent | ||
| ): boolean { | ||
| let disabled: Iterable<unknown> | undefined | ||
| try { | ||
| disabled = runtime.getClientSettings().disabledTuiAgents | ||
| } catch { | ||
| return true | ||
| } | ||
| return isTuiAgentEnabled(agent, disabled) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n 'getClientSettings\s*\(' src/main/runtime src/main/agent-launch | head -90
rg -n 'prepareStructuredAgentSessionCreateForWorktree|resolveUnlaunchedIntent|performAttach|disabledAgentRefusal' src/main/runtime/rpc/methods/structured-agent-session-create.ts src/main/runtime/rpc/methods/agent-launch.ts src/main/native-chat/agent-session-wire/structured-agent-session-attach-flow.ts
sed -n '75,140p' src/main/runtime/rpc/methods/structured-agent-session-create.ts
sed -n '120,250p' src/main/runtime/rpc/methods/agent-launch.tsRepository: stablyai/orca
Length of output: 11941
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- settings getter and nearby runtime state ---'
sed -n '150,225p' src/main/runtime/orca-runtime-pty-foreground-process-reads.ts
printf '%s\n' '--- enablement and host reader bindings ---'
sed -n '1,90p' src/main/agent-launch/agent-launch-enablement.ts
sed -n '135,190p' src/main/runtime/orca-runtime-get-worktree-ps.ts
rg -n 'disabledAgentRefusal|isAgentEnabled|structured-agent-session-runtime|createStructuredAgent|attachStructuredAgent|executeAgentLaunch|agentLaunchIntent' src/main/native-chat src/main/runtime src/main/agent-launch
printf '%s\n' '--- structured session host/runtime definitions ---'
fd -i 'structured-agent-session-runtime|structured-agent-session-create|structured-agent-session-attach-flow' src/main
for f in $(fd -i 'structured-agent-session-runtime|structured-agent-session-create' src/main); do
echo "--- $f ---"
wc -l "$f"
rg -n 'isAgentEnabled|disabledAgentRefusal|create|attach|launch|throw|settings' "$f"
done
printf '%s\n' '--- structured session create and attach implementation ---'
sed -n '1,230p' src/main/runtime/rpc/methods/structured-agent-session-create.ts
sed -n '1,180p' src/main/native-chat/agent-session-wire/structured-agent-session-attach-flow.ts
printf '%s\n' '--- launch execution definitions and relevant callers ---'
rg -n 'function executeAgentLaunch|async function executeAgentLaunch|executeAgentLaunch\\(|agentLaunchSurfaceFactory|runAgentLaunch' src/main
for f in $(rg -l 'function executeAgentLaunch|async function executeAgentLaunch' src/main); do
echo "--- $f ---"
rg -n -A120 -B20 'function executeAgentLaunch|async function executeAgentLaunch' "$f"
doneRepository: stablyai/orca
Length of output: 42455
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- client settings binding and getter ---'
rg -n -C 8 'clientSettings|class .*ClientSettings|function .*ClientSettings|get\(\)' src/main/runtime --glob '*.ts' | head -240
printf '%s\n' '--- structured disabled-agent refusal ---'
sed -n '175,215p' src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
sed -n '1,100p' src/main/native-chat/agent-session-wire/structured-agent-session-disabled-agent-refusal.ts
printf '%s\n' '--- structured runtime install and required readers ---'
sed -n '75,115p' src/main/runtime/structured-agent-session-runtime.ts
sed -n '190,215p' src/main/runtime/structured-agent-session-runtime.ts
sed -n '305,328p' src/main/runtime/structured-agent-session-runtime.ts
printf '%s\n' '--- launch executor ---'
sed -n '1,220p' src/main/agent-launch/agent-launch-executor.ts
printf '%s\n' '--- launch surface factories ---'
sed -n '1,220p' src/main/agent-launch/agent-launch-surface-factories.tsRepository: stablyai/orca
Length of output: 42685
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- runtime client settings controller ---'
wc -l src/main/runtime/runtime-client-settings.ts
sed -n '1,260p' src/main/runtime/runtime-client-settings.ts
printf '%s\n' '--- launch mode resolver ---'
sed -n '220,285p' src/main/agent-launch/agent-launch-mode.ts
printf '%s\n' '--- executor remainder ---'
sed -n '200,430p' src/main/agent-launch/agent-launch-executor.ts
printf '%s\n' '--- runtime store accessors used by structured host ---'
rg -n -C 4 'requireStore\\(|getSettings\\(' src/main/runtime/orca-runtime*.ts src/main/runtime/structured-agent-session-runtime.ts | head -220Repository: stablyai/orca
Length of output: 18146
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- launch mode defaults and decision ---'
sed -n '1,230p' src/main/agent-launch/agent-launch-mode.ts
printf '%s\n' '--- structured create intent and runtime store access ---'
rg -n -C 8 'resolveStructuredAgentSessionCreateIntent|requireStore\\b|clientSettings =|new RuntimeClientSettingsController' src/main/runtime src/main | head -260
printf '%s\n' '--- host acquisition settings reads ---'
rg -n -C 6 'resolveLaunchEnvOverlay|resolveClaudeLaunchEnv|resolveShellEnvironmentPolicy|resolveClaudeAuthPolicy|resolveClaudePermissionMode|resolveCodexPermissionPolicy|getClaudeManagedAccountGateSettings|resolveAgentAccountHome' src/main/native-chat src/main/runtime --glob '*.ts' | head -300
printf '%s\n' '--- host installation and structured create RPC binding ---'
rg -n -C 10 'createStructuredAgentSessionForWorktree|prepareStructuredAgentSessionCreateForWorktree|ensureStructuredAgentSessionHost\\(' src/main/runtime/rpc src/main/runtime src/main/native-chat --glob '*.ts' | head -300Repository: stablyai/orca
Length of output: 42443
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- runtime store/controller construction ---'
rg -n -C 10 'new RuntimeClientSettingsController|protected readonly store|requireStore\\(\\)|constructor\\(' src/main/runtime/orca-runtime-runtime-id.ts src/main/runtime/orca-runtime*.ts | head -260
printf '%s\n' '--- projection helper implementations ---'
rg -n -C 12 'function getHostDisplayLabelOverrides|export .*getHostDisplayLabelOverrides|function isArtifactSharingEnabled|function isAgentSkillSharingEnabled' src/shared src/main --glob '*.ts' | head -240Repository: stablyai/orca
Length of output: 5344
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- controller construction references ---'
rg -n 'RuntimeClientSettingsController' src/main/runtime
printf '%s\n' '--- runtime id constructor and store accessor ---'
sed -n '50,145p' src/main/runtime/orca-runtime-runtime-id.ts
printf '%s\n' '--- requireStore definitions ---'
rg -n 'requireStore' src/main/runtime --glob '*.ts'Repository: stablyai/orca
Length of output: 18460
🏁 Script executed:
#!/bin/bash
set -e
sed -n '185,210p' src/main/runtime/orca-runtime-state-fields.ts
sed -n '160,185p' src/main/runtime/orca-runtime-resolve-worktree-selector.tsRepository: stablyai/orca
Length of output: 2277
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- agent launch intent and settings reads ---'
rg -n -C 10 'function agentLaunchIntent|async function agentLaunchIntent|agentLaunchIntent\\(' src/main/agent-launch src/main/runtime/rpc/methods/agent-launch.ts
printf '%s\n' '--- launch surface factory bindings ---'
rg -n -C 12 'createTerminalAgent:|createStructuredSession:|agentLaunchSurfaceFactory|AgentLaunchSurfaceFactory' src/main/runtime src/main/agent-launch --glob '*.ts'
printf '%s\n' '--- terminal creation implementations ---'
rg -n -C 15 'createTerminalAgent|createTerminal|spawn.*Agent|startupAgent' src/main/runtime src/main/agent-launch --glob '*.ts' | head -360Repository: stablyai/orca
Length of output: 338
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- launch intent symbols ---'
rg -n 'agentLaunchIntent' src/main
rg -n 'createTerminalAgent' src/main
rg -n 'createStructuredSession' src/main
printf '%s\n' '--- matched context ---'
for f in $(rg -l 'agentLaunchIntent' src/main); do
echo "--- $f ---"
rg -n -A80 -B20 'agentLaunchIntent' "$f"
done
for f in $(rg -l 'createTerminalAgent' src/main); do
echo "--- $f ---"
rg -n -A100 -B25 'createTerminalAgent' "$f"
doneRepository: stablyai/orca
Length of output: 42179
🏁 Script executed:
#!/bin/bash
set -e
rg -n 'createTerminal' src/main/runtime --glob '*.ts' | head -120
for f in $(rg -l 'createTerminal' src/main/runtime --glob '*.ts' | head -20); do
echo "--- $f ---"
rg -n -A90 -B20 'createTerminal' "$f" | head -180
doneRepository: stablyai/orca
Length of output: 42277
🏁 Script executed:
#!/bin/bash
set -e
wc -l src/main/runtime/orca-runtime-create-terminal.ts
sed -n '1,180p' src/main/runtime/orca-runtime-create-terminal.ts
sed -n '180,310p' src/main/runtime/orca-runtime-create-terminal.tsRepository: stablyai/orca
Length of output: 13885
Fail closed when client settings are unreadable.
isAgentEnabledForRuntime returns true after getClientSettings() throws. This skips the disabled-agent refusal for structured attach and agent.launch. agent.launch then falls back to terminal mode when mode settings are unavailable. If the settings read recovers before the later surface or provider read, a disabled agent can start. The absent-store case fails later, but it does not make this fallback safe for transient read failures.
Return false when settings cannot be read.
Suggested fix
} catch {
- return true
+ return false
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export function isAgentEnabledForRuntime( | |
| runtime: Pick<OrcaRuntimeService, 'getClientSettings'>, | |
| agent: TuiAgent | |
| ): boolean { | |
| let disabled: Iterable<unknown> | undefined | |
| try { | |
| disabled = runtime.getClientSettings().disabledTuiAgents | |
| } catch { | |
| return true | |
| } | |
| return isTuiAgentEnabled(agent, disabled) | |
| } | |
| export function isAgentEnabledForRuntime( | |
| runtime: Pick<OrcaRuntimeService, 'getClientSettings'>, | |
| agent: TuiAgent | |
| ): boolean { | |
| let disabled: Iterable<unknown> | undefined | |
| try { | |
| disabled = runtime.getClientSettings().disabledTuiAgents | |
| } catch { | |
| return false | |
| } | |
| return isTuiAgentEnabled(agent, disabled) | |
| } |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Shared refusal —
AgentDisabledLaunchError/refuseDisabledAgentLaunch(src/shared/agent-disabled-launch-refusal.ts) give the chat and terminal routes one message:Agent <agent> is disabled. Choose an enabled agent. agent.launch/agent.launchReplay—resolveUnlaunchedIntentrefuses a disabled agent before the surface decision, except forreuseTerminal(which delivers to an already-running agent and starts nothing). A replay-safe refusal settles the ledger rowfailedwith the real message, so a retry replays it instead of launching.- Chat host attach step —
structuredAgentSessionDisabledAgentRefusalrefuses only a session with no record, soagentSession.create,agentSession.ensure,/clear, and orchestration chat workers cannot start a turned-off agent, while existing chats and committed-create retries still resolve from their records (structured-agent-session-attach-flow.ts:96-103). - Create-step ordering —
agentSession.create's prepare step now installs the host first and askshost.disabledAgentRefusalbefore intent resolution, so a refused create cannot prepare the agent's home;AgentDisabledLaunchErrormaps to the existing definitivestructured_agent_session_unsupportedrefusal (structured-agent-session-precommit-refusal.ts:45-48). - Runtime plumbing —
isAgentEnabledis now a required runtime dep, asserted at install (structured-agent-session-runtime.ts:200-203) and wired to a live reader ofdisabledTuiAgents(orca-runtime-get-worktree-ps.ts:166); the terminal route was refactored onto the shared helper with its message unchanged. - Tests — new attach/create/launch refusal suites plus stub and fixture updates; the wiring test pins the live setting read and the install-time requirement.
I traced the intent-coverage, create-step reorder, and refusal-code handling paths. The existing terminal fallback on a definitive structured refusal is unreachable for a disabled agent (the upfront check fires first, and the terminal lane refuses independently), and other new-session entry points retain their own guards. No blocking concerns.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Only the terminal route checked whether an agent was enabled, so a launch the host routed to a chat, and agentSession.create, started a turned-off agent. agent.launch now refuses before it picks a route, and the shared chat-create step refuses before it commits; both throw the terminal route's error.
…arts Every new structured chat (create, ensure, /clear) starts its provider in attach, so attach now refuses a brand-new session for an agent the user turned off, before anything is reserved or spawned. The create path keeps its earlier check, now skipped for a session that already has a record, so the retry of a committed create is answered from that record.
… agent A reused terminal starts nothing; its agent was already running, so the launch-time enablement refusal must not stop a prompt reaching it.
…'s new chat The chat host now owns the single rule for "a new session for an agent the user turned off": the create step and the attach step both ask it, so both read the same setting reader and the same no-record-means-new rule. The runtime requires that reader and refuses to install the chat host without it, since the file that wires it is not type-checked.
7feaf73 to
5d30c1a
Compare

ELI5
When you turn an agent off in Settings, Orca should refuse to start it. Terminal launches already did. Chat launches didn't: a phone (or any client) asking the host to start a turned-off agent while "open agent tabs in chat" was on got a running chat anyway. Now chat launches refuse too. The chat routes,
agent.launchand the terminal-create route share one message: "Agent claude is disabled. Choose an enabled agent." Older refusals elsewhere keep their own wording.What Changed
Before: the host checked whether an agent was enabled only on the terminal route. A launch that the host sent to a chat (
agent.launch/agent.launchReplaywith the chat default on, oragentSession.create, which the desktop's own new-chat path uses) started the agent even when it was turned off. Live repro: open the phone's "+" menu, turn Claude off on the desktop, tap Claude in the still-open menu with the chat default on: a Claude chat and a realclaudeprocess started.After:
agent.launchchecks enablement once, before it decides chat or terminal. A turned-off agent is refused before any workspace, chat or terminal is created. Onagent.launchReplaythe refusal is recorded asfailedwith the real message, so a retry of the same operation id gets the same answer and never launches. A launch that only hands a prompt to an agent already running in a terminal (reuseTerminal) is not refused, because it starts nothing.agentSession.create,agentSession.ensurefor a session it has never seen,/clear's fresh conversation, orchestration's chat workers), refuses to start a brand-new session for a turned-off agent, before it reserves or spawns anything. The client gets the definitive "nothing was created" refusal it already understands, carrying the user's reason as its message./clearreports the same reason and leaves the current chat as it was. The host reads the setting on every attach through a callback it is given when it is built, so it needs no settings access of its own. That callback is required: the app refuses to install the chat host without it, the same way it already refuses without a Claude sign-in policy, because the file that wires it is not type-checked and a dropped callback would otherwise silently let new chats start turned-off agents.agentSession.create,agent.launch's chat route, orchestration's chat workers) also refuses a new chat for a turned-off agent before it resolves the workspace, because that resolution prepares the agent's home (for Codex it marks the workspace trusted in the user's Codex settings). It asks the chat host the same question the attach step asks, through one host method (disabledAgentRefusal): the same setting reader and the same "no record means new" rule, so a retry of a committed create still reaches its record. To ask, the create step now installs the chat host before resolving the workspace instead of just after. So a create whose workspace can't be resolved, or can't host a chat, now installs it too; installing opens the host's local chat record store and starts no agent, and any chat create that gets further installs it anyway.agent.launchand the terminal-create route throw or report one shared error,AgentDisabledLaunchError, so the message cannot drift between them. The terminal route's text is unchanged.The chat route checks in layers on purpose. The upfront check in
agent.launchrefuses before anything is created. Without it, the later chat refusal would still stop the agent (the terminal fallback it triggers is refused by the terminal route's own check), but: a launch into a new workspace would create that workspace first, because in chat mode the workspace is created without a startup agent and the workspace-create check never runs; the launch would take the "host refused the chat, start a terminal instead" fallback only to fail there; and onagent.launchReplaya failure that late is recorded as outcome unknown, so the caller and every retry get "unknown" instead offailedwith the real message. The attach check is the one every new chat passes, includingagentSession.ensureand/clear, which never go through the create step. The create-step check only keeps a refused create from preparing the agent's home first.Why
A turned-off agent is a user decision, so no launch path should get around it, and the refusal should say why. Checking once per entry point would miss the chat starts that don't come through
agent.launchor the create step (agentSession.ensure,/clear); checking only where the chat starts its agent would leaveagent.launchcreating a workspace and attempting a terminal fallback before failing with an unknown outcome. So the check lives at the start ofagent.launchand at the attach step where every new chat starts its agent, which already carries the host's other "can this start here" check. Refusing only brand-new sessions there keeps existing chats and retries of committed creates answered from their records, as before.A new wire refusal code ("agent disabled") was considered and rejected: older clients check the refusal code against a fixed list, and the existing definitive code already means "the host refused and created nothing", which is exactly what happened. The message carries the reason.
Other existing refusals of a turned-off agent stay where they are, because they serve other methods: terminal creates with a startup agent (
session.tabs.createTerminal, also the backstop if the setting changes between the check and the spawn),terminal.createAgentSession,worktree.createwith a startup agent, the phone's older create path, session resume, and orchestration's launcher check.Linked Issue
No linked issue.
Visual Proof
Desktop at the current head (
7feaf73dbc), dev host on a separate Mac with a fresh profile, compared withmain(484598b18e). Claude turned off while the new-tab menu was open, chat default on:main: a Claude chat starts anywaymain:/clearin an open Claude chat after turning Claude off starts a fresh session/clearis refused with the reason; the open chat is unchangedAt this head the phone route (
agent.launchReplay) with Claude off was refused with the real message, recorded asfailed, and a replay of the same id after turning Claude back on returned that refusal and created nothing; in every refusal no tab, chat session orclaudesession process was created. The earlier evidence below is from69673322ef.Dev host built from this branch (
69673322ef) on a separate Mac, with its own fresh profile, launched in the background; every scripted host call was pinned to that profile and checked its runtime id.claudeprocess startsPhone (Android emulator on the same Mac as the dev host, driven only through
orca emulator; phone build #2295481e471b094). Claude turned off on the host while the "+" menu was open, then tapped:In all three refusals the host's tab, terminal and chat-session lists were unchanged and no
claudeprocess started. In the control, closing the chat through the host ended its process.agent.launchReplay, the call the phone's "+" menu makes), with Claude turned off: chat default on in an empty session, chat default on beside an open shell tab, and chat default off were all refused with "Agent claude is disabled. Choose an enabled agent." In each case the host's tab and terminal lists were unchanged before and after, and no agent process started. With Claude enabled, the same call opened a chat (control).agentSession.create): the desktop's new-tab menu drops a turned-off agent within about 1.5 s, so a click can't reach it (menu after turning Claude off). To exercise the path, I called the menu's own launch function in the renderer; the chat showed the refusal above, with no tab, terminal or agent session created.agentSession.createover the host connection returnedstructured_agent_session_unsupportedwith the same message.claude -p … stream-json) for under a second, from the chat's model picker. No agent session starts. The desktop also shows a generic "could not open a structured Claude chat" toast beside the specific inline reason. Also onmainfor any refused chat start: while the refused chat's tab stays open, the new-tab menu keeps that agent's row disabled (it treats the failed start as still in progress) until the tab is closed; and a refused/clearleaves/clearin the composer, as any command the host doesn't accept does.Testing
agent-launch-disabled-agent.test.ts(real RPC handler and durable operation ledger; chat create mocked): with Claude turned off,agent.launchReplay→ refused with the real message, ledger rowfailedwith that message, no chat/terminal/workspace created; a retry of the same id after Claude is turned back on is answered from the record and creates nothing;agent.launch→ same refusal;reuseTerminal) is still delivered, with nothing created;structured-agent-session-disabled-agent.test.ts(real host and record store): with Codex turned off,/clearon an open chat → completes with the real message as its error, no replacement chat, the open chat stays;structured-agent-session-precommit-refusal.test.ts:agentSession.create(the desktop's new-chat path) for an agent the chat host's reader reports as turned off → definitive refusal whose message is the user's reason, nothing resolved or attached, no warning logged; the retry of a create whose session the host already holds is attached, not refused. The stub host answers through the same rule the real host uses.orca-runtime-structured-agent-enablement-wiring.test.ts: the app's chat host is built with a reader of the live on/off setting, and installing the host without a reader is refused. The file that wires it is not type-checked, so without these, dropping that one line would silently remove the attach check (the only oneagentSession.ensureand/clearpass); removing the line fails the first test, and removing the install check fails the second.Existing chat-host test setups now pass an "every agent enabled" reader, since the runtime requires one.
Red on
main: all five refusal tests fail againstmain's source; the control passes. Onmainthe terminal-default case is already refused later, by the terminal route's own check; it fails here only because the test's terminal create is a stub, and it pins that the refusal now comes first.Ablations: removing only the
agent.launchcheck fails its four tests; removing only the create-step check fails theagentSession.createtest; dropping the refusal's message handling fails that test too; removing only the attach check fails the new-attach and/cleartests; making the create-step check ignore the existing record (this PR's first version) fails the committed-create retry test; removing the install check for the reader fails its test.Native-chat, agent-launch, runtime, RPC and shared suites: 1297 files passed (two load timeouts in unrelated suites passed on a rerun).
tc:node, oxlint, format and the changed-code gate clean.After moving the rule onto the chat host: native-chat wire, structured runtime, structured RPC, agent-launch, orchestration and agent-launch-helper suites, 256 files. The only deterministic failures were test stubs of the chat host missing the new method (fixed); three unrelated suites that timed out under load passed when rerun alone. The cross-version wire harness could not extract the release checkout locally (tar timeout), so its run is left to CI; its host stub gained the new method.
Platforms: macOS (tests); macOS live on a separate Mac (desktop and the host route the phone uses). Android phone live (emulator on the same Mac as the dev host). iOS not run on that Mac.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
agent.launchcaller gets an error it already handles as "not started", now with the real message on the chat route too. AnagentSession.createcaller gets the definitive refusal code it already treats as "nothing was created"; only the message text is more specific./clear(which starts a fresh session) and resuming an old conversation into a new chat are refused.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)