You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0319f00
Browse filesBrowse the repository at this point in the historyBrowse files
feat(web): steer a running turn instead of queuing behind it (#35)
Typing while the agent works should reach the agent, the way it does in the
Claude Code CLI. It already could: upstream's `onSend` has no
`phase === "running"` guard, the decider has no running-turn invariant, and
every adapter but Codex folds a mid-turn `sendTurn` into the live turn rather
than opening a competing one — ClaudeAdapter.ts:3729 offers the message
straight into the one long-lived `query()` whose prompt is a stream, which is
the same stdin the CLI uses. Upstream even has a test for it
(ClaudeAdapter.test.ts:976) and client-side handling to acknowledge a steering
message (ChatView.logic.ts:537).
The fork's outbox took that away. `resolveComposerSendLabel` returned "Queue"
whenever the thread was busy, so `onSend`'s queue branch ran before upstream's
immediate-send path and a message typed mid-turn waited out the entire turn —
and, because `canSettle` also refuses while an approval is pending, sometimes
much longer.
Queue now means "cannot go out now" rather than "the thread is busy":
- Not connected — still queues; nothing can be dispatched.
- Outbox already has messages — still queues, so a new message cannot jump
ahead of ones written before it.
- Running turn on a steer-capable driver — sends, and the provider folds it
into the work in progress.
Steering support is an allowlist, not a denylist, because there is no
capability flag anywhere in the contracts: `ProviderAdapterCapabilities` has no
`supportsSteering`, so it is asserted per driver against each adapter's
`sendTurn`. Claude, Cursor, Grok and OpenCode steer, three of them with tests.
Codex does not — CodexSessionRuntime.ts:1305 issues `turn/start`
unconditionally and never calls the protocol's `turn/steer` RPC — so it keeps
queuing, as does any driver added later. Failing closed matters here because a
refused steer is invisible: `providerService.sendTurn` is `Effect.forkScoped`
(ProviderCommandReactor.ts:1110), so the command has already succeeded and the
only trace is a `provider.turn.start.failed` activity. Failing closed costs a
queued message; failing open loses one.
The running-turn footer now pairs Stop with whichever primary action applies —
Queue when the message will be held, the ordinary Send when it will be steered.
That is not only discoverability: Enter does not submit on a mobile viewport,
so the button is the only mid-turn send affordance on a phone.
Seam impact: `ChatView.tsx` +158/-1 → +168/-1 (risk 9540 → 10140) and
`ComposerPrimaryActions.tsx` +71/-13 → +130/-64 (336 → 776, the bulk being
upstream's send button hoisted to a variable so the running branch can reuse
it); rows and header totals updated. The steer predicate itself lives in a new
fork-owned file rather than inline, per the ledger's own guidance. Also records
the allowlist as a logic mirror: nothing fails if upstream changes an adapter to
stop steering, so those four `sendTurn` implementations need re-checking at
every sync.
Verified: 80 tests green, typecheck and lint clean. The steer-vs-queue decision
and the allowlist are unit-tested; the driver slugs are checked against
ClaudeDriver.ts:60 and ClaudeAdapter.ts:96. Not verified end-to-end against a
live Claude turn — the sandbox environment has no Claude provider instance and
its Codex OAuth is stale.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
0 commit comments