Repository navigation
Description
Parent / related
- Parent: Codex first-class provider parity (Astra / Sol / Terra / Luna / 5.5 / Spark) #1162 Codex first-class
- Closed: Codex mid-turn steer: exec --json is queue-only even on Astra #1164 exec --json cannot steer;
supportsSteerstays false on that adapter - Product: Steer a running turn instead of only queueing a follow-up #156 Queue vs Steer. Queue stays the default. Composer Steer stays hidden until a real mid-turn channel exists.
- Do not fake steer by killing the exec child and
exec resume.
Decision (this pass)
Do not implement here. The switch is not small. codex exec --json and codex app-server are different protocols. Flipping supportsSteer on the current adapter would lie to the composer.
Keep electron/codex.js runCodex as one-shot JSONL (stdio: ["ignore", ...], handle is { kill } only). Keep workflow / ask / commitmsg on exec --json.
Why exec cannot steer (restated)
Solenta's interactive Codex path is startCodexRun → provider.buildArgs → codex exec --json / exec resume <id> --json → runCodex.
| Candidate | What it actually is |
|---|---|
exec --json stdin |
One-shot. Prompt is argv (or stdin drained once as the initial prompt / <stdin> block). Solenta ignores stdin. |
-i |
--image, not interactive. |
codex queue / app-server thread/queue/add |
Follow-up after idle = Solenta Queue, not Steer. thread/queue/add is experimental-schema-only on 0.153.4. |
Astra send_user_message_async |
Persist-mode desktop: model → user. Opposite direction. |
app-server turn/steer |
Real mid-turn user channel. Different adapter. |
Protocol (Codex CLI 0.153.4)
Generated from codex app-server generate-json-schema / generate-ts (--experimental only needed for queue).
codex app-server itself is still marked [experimental] in CLI help. turn/steer is in the stable ClientRequest schema (not an experimentalFeature). Product risk: the RPC can still move.
Solenta already speaks a slice of this for /usage: electron/providerUsage.js does app-server --listen stdio:// → initialize → initialized → account/rateLimits/read.
Interactive turn loop:
- Spawn private
codex app-server --listen stdio://(do not use the user-globalapp-server daemon; that shares writer lock with Codex Desktop). initialize+initialized.experimentalApiis not required forturn/steer.thread/start(fresh) orthread/resume{ threadId, excludeTurns: true }(existing SolentasessionId).turn/start{ threadId, input: [{ type: "text", text }] }→TurnStartResponse.turn.id.- Stream JSON-RPC notifications, not exec JSONL:
thread/started,turn/started,item/started,item/agentMessage/delta,item/completed,thread/tokenUsage/updated,turn/completed. - Mid-turn Steer:
turn/steer{ threadId, expectedTurnId, input }. Fails ifexpectedTurnIdis not the active turn. Review/compact turns areNonSteerableTurnKind. - Stop:
turn/interrupt{ threadId, turnId }thenthread/unsubscribe.killTreeremains the fail-closed abort. - Idle follow-up: Solenta Queue → new
startRun→thread/resume+turn/start. Do not wire composer Queue tothread/queue/add.
TurnSteerParams.expectedTurnId is required. Composer must not show Steer until that id is known (handshake race vs Claude, which can write stdin immediately).
Live probes (2026-09-09, CLI 0.153.4, no model turn)
Handshake matches /usage. thread/list { sourceKinds: ["exec","appServer","cli"] } returns Solenta exec sessions (status: notLoaded, canAcceptDirectInput: null).
thread/start { ephemeral: true, sandbox: "read-only", approvalPolicy: "never" } → status: idle, canAcceptDirectInput: true. Default source was vscode (clientInfo name was ignored). Set threadSource so new threads are not attributed to VS Code.
thread/resume of exec id 01a085eb-14f7-71f3-a715-f96593249ad6 with excludeTurns: true → same id, source: "exec", idle, canAcceptDirectInput: true, model gpt-6-astra, sandbox workspaceWrite, approvalPolicy: never. thread/unsubscribe → unsubscribed.
Not live-proven: turn/steer against a real in-progress model turn (would spend tokens). Gate with a fake JSON-RPC server.
What would break vs current exec --json
| Area | Today (startCodexRun + runCodex) |
App-server |
|---|---|---|
| Process / turn end | Child exit = turn over | Process stays up; turn/completed ends the turn. onExit must not mark failed after a clean completed. |
| Event parse | JSONL item.started / command_execution / agent_message (electron/codex.js) |
RPC notifications + camelCase ThreadItem (commandExecution, agentMessage). Existing extractors will miss. |
| Session resume | exec resume <sessionId> --json; -m ignored (sessionPinsModel) |
thread/resume loads the same id (probed). turn/start.model claims it overrides subsequent turns — re-verify before changing sessionPinsModel. |
Sandbox -c / --sandbox |
First exec --sandbox; resume rejects --sandbox (#795). codexWorkspaceWriteArgs splices writable_roots + gh proxy. |
thread/start.sandbox is SandboxMode; turn/start.sandboxPolicy is a different object. Resume probe had writableRoots: [] even though Solenta injects roots on exec. Re-apply on start/resume config. |
| MCP | getCodexMcpArgs -c mcp_servers.* after exec / exec resume (#846). Bearer tokens in env, never argv. |
Same values via spawn -c or thread/start.config / thread/resume.config. Wrong placement drops thread_send. SSE still unsupported. |
| Guardrail overlay | Isolated CODEX_HOME + features.hooks=true + --dangerously-bypass-hook-trust |
Spawn app-server with the same env/flags. ssh/WSL still needs remote overlay (#835). |
| Usage / context ring | token_count / turn.completed JSONL; snapshot vs delta (#317) |
thread/tokenUsage/updated. Re-map last vs total or the ring double-counts. |
| Writer-lock | Exec holds the writer for one process; classifyWriterLock + parkCodexFromNotice |
Loaded thread holds the writer until unsubscribe. Prefer per-turn private server: handshake → resume → turn → completed → unsubscribe → kill (steer still works while the turn is live). Do not use the shared daemon. |
| Approvals | No interactive ask; modes map to sandbox + approval_policy=never |
ServerRequest: execCommandApproval, item/commandExecution/requestApproval, item/fileChange/requestApproval. Keep approvalPolicy: "never" until a later issue. Unanswered requests stall the turn. |
| Images | exec -i |
UserInput image / localImage. |
| ssh/WSL | wrapCommand one-shot argv; stdin ignored |
Needs a live stdin RPC. Wrap must keep stdio pipes. |
| Workflow / ask / commitmsg | Same buildArgs exec |
Leave on exec. They are one-shot and do not need steer. |
supportsSteer |
unset / false; listProviders uses === true; composer Queue-only while busy |
Set true only after fake-server tests prove steerRun sends turn/steer on the same process/turnId and appends steer: true. |
Recommended shape
New module (e.g. electron/codex-appserver.js): JSON-RPC framing, handshake, send(method, params), notification dispatch. Do not overload runCodex.
startCodexRun becomes the app-server turn host. entry.handle.send = turn/steer with stored expectedTurnId (return false until that id exists). steerRun stays provider-gated (supportsSteer === true + handle.send).
First lifetime: per-turn private app-server (closest to today's kill/exit). Not a Claude-style idle LRU (writer held between turns). Not the Desktop daemon.
Keep Queue as Solenta's idle follow-up.
Acceptance
- Fake app-server:
initialize→thread/resumeorthread/start→turn/start→ notifications drive assistant/tool/thinking/usage the way exec JSONL does today. - Fake in-progress turn:
steerRunwritesturn/steerwith thatexpectedTurnId, does not spawn a second process, appends asteer: trueuser row on the samerunId. steerRunbeforeturn/startedrejects (or send returns false); nosteer: truerow.- Review/compact: steer rejected.
- Exec session id round-trip: stored
thread.sessionIdresumes; no new Codex thread unlesssessionIdis missing / ejected / model-pin drop. - MCP
-c/ config still auto-approves first-party servers on resume (Explicit Grok worker forks are impossible when approval policy isnever#846). - Workspace-write roots + planboard gh proxy still present on start and resume.
- Writer-lock copy still matches
thread-store conflict/already has an active writer; unsubscribe/kill releases for the next turn. listProvidersadvertisessupportsSteer: truefor Codex only after the adapter can sendturn/steer. Workflow/ask/commitmsg stillexec --json.- Composer: Steer visible while a Codex run is live; Queue remains the idle default (Steer a running turn instead of only queueing a follow-up #156).
PR plan
- JSON-RPC client + fake server tests (no live model).
startCodexRunon app-server; map notifications; process-exit vsturn/completed; stop = interrupt + unsubscribe + kill.supportsSteerstill false.- Map MCP, sandbox/workspace-write, hooks/
CODEX_HOME, effort, web_search onto start/resume config. Resume existing exec ids. handle.send→turn/steer; hang-scenario test; thensupportsSteer: true.- ssh/WSL stdio wrap + writer-lock/fromNotice regression.
Out of scope
- Shared
app-server daemon/ remote-control thread/queue/addfor Solenta Queue- Interactive ServerRequest approvals (Claude-like ask)
- Persist-mode /
send_user_message_async - Killing exec to fake steer
- Grok/Kimi/Cursor/OpenCode steer
Activity
currentbits commentedon Sep 10, 2026
Interactive Codex now uses a private per-turn
codex app-server(electron/codex-appserver.js).startCodexRunhandshakes, thread/start or thread/resume, turn/start; notifications map to the existing JSONL extractors;handle.sendisturn/steerwithexpectedTurnId(false until that id exists).supportsSteeris true for Codex only. Workflow/ask/commitmsg stay onexec --json. Queue remains Solenta idle follow-up. Fake-server tests cover steer, pre-turn reject, review/compact, exec-id resume, MCP/workspace-write/hooks argv, writer-lock, ssh wrap without-n. Liveturn/steeragainst a real in-progress model turn was not spent.