Repository navigation
feat(native-chat): register Codex default-mode helpers as subagents - #22619
Conversation
There was a problem hiding this comment.
Important
One gap worth addressing before merge: a helper the caller closes updates the strip and the host record, but the durable subagent roster row keeps reporting working.
Reviewed changes
- Default-mode helper membership —
readCodexSubagentAnnouncementnow treats a finishedspawnAgentcall as a second way to announce a child, and both the roster and the background-task tracker register through it into one sharedCodexSubagentExecutions. - Collab tool rows — a new
codex-collab-agent-item-translationrenders eachcollabAgentToolCallas a namedtool-callrow (spawn_agent,wait_agent, …) instead of a rawcodex · item:collabAgentToolCallstatus row, and forwards the roster's label so an interrupted turn keeps its helper names. - Close lifecycle — a finished
closeAgentbecomes aturn-ended/stoppedframe;CodexChildWorkEvidencenow keys on the frame's child thread rather than the event's. - Output pairing — the projection attaches its journal row's
callIdto the tool-result block, andpairNativeChatToolResultsresolves a named result to its call before falling back to positional pairing. - Run vocabulary —
spawn_agentcounts as running an agent and takes the bot glyph.
ℹ️ Nitpicks
- The roster row appends a collision ordinal when two helpers share a label (
claimLabel), but the new tool row and the strip both name a helper by the rawexecutions.label. Two default-mode helpers whose prompt heads coincide will therefore readX/X 2on the roster butX/Xon theirspawn_agent/wait_agentrows, so the "two rows read as the same child" invariant incodex-collab-agent-item-translation.tsdoes not hold for colliding labels. Theagentsarray still disambiguates them. - The
diffbranch ofitemBlocksstill emits an unnamedtool-result, so an edit patch can still paint under an earlier output-less call (for example aspawn_agent).AgentJournalDiffItemcarries nocallId, so closing this is a schema addition rather than a projection tweak — worth a follow-up, not this PR.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — delta since the prior pullfrog review (80b2032040 → d09c8b2286)
- The roster row now follows the executions —
CodexSubagentExecutionsfires a newonExecutionChangedlistener fromobserveTurnandsettleSession, andCodexSubagentRostersubscribes in its constructor and rewrites the group row from the changed execution. A fatalerror, athread/closedand acloseAgenttherefore settle the durable subagent row, not only the strip and the host record.handleTurnstill returns the write's admission via an idempotent re-derive, anddispose()unsubscribes. - Three tests added — the roster row settles with the strip and the record on a fatal error (
failed), onthread/closed(unverifiable), and oncloseAgent(stopped), each asserting the lastsubagent-grouprevision.
This closes the closeAgent gap flagged in the prior review. The listener propagation reads correct: it fires only when an execution is actually assigned, duplicate writes collapse on lastSerialized, and it cannot touch the primary thread because that thread is never registered as a child.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — delta since the prior pullfrog review (d09c8b2286 → 6214d76206)
- Restored call rows name their helper — replayed-item handling moved into
restoreCodexHistoryItem, which registers each announced helper inCodexSubagentExecutions(registerstarts no execution, so no strip entry, record or roster row claims it runs). A restoredwait_agent/close_agent/send_inputrow now names its helper instead of the raw thread id. - Roster exposes its executions —
CodexSubagentRoster.executionsis now public andhelperLabelis gone; the collab row's name callback readssubagents.executions.labeldirectly. - Render contract named —
handleItem's claim flag is renamedrenderedByRoster, documenting that asubAgentActivityrenders as the roster row alone while a spawn call keeps its own row. - Comment clarification — the collab tool-name map notes it maps the wire's camelCase to the model-facing snake_case, not a spelling fix.
- Tests —
a restored thread(2) through the real translator; the naming test reddens without the registration (verified by ablation).
The registration runs after primaryThreadId is set (codex-structured-session-acquire.ts:197), so it cannot register the primary thread as a child; register's idempotence and the MAX_CHILDREN cap bound a restored thread's historical helpers. Both existing tests and the new file pass at this head.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
f098d8d to
c99160f
Compare
6214d76 to
98978fa
Compare
c99160f to
8e22ed0
Compare
98978fa to
bd540b2
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — delta since the prior pullfrog review (bd540b299f → c915a9cf3e)
- A failed spawn now registers its helper —
codexCollabSpawnedThread(codex-collab-agent-tool-call.ts:65) drops thestatus === 'completed'gate, so aspawnAgentcall that endedfailedbut named a receiver registers that helper in the one sharedCodexSubagentExecutions. Codex reportsfailedfor a helper that errored at birth while still naming the thread it created, and that thread can run a turn. - Three tests — a failed spawn with a receiver registers the helper (strip, records and roster row); a failed spawn with no receiver registers nothing; a failed
closeAgentleaves the helper running (the close gate is preserved). Each reads the real adapter path.
The removal is safe against the shapes it must not touch. An in-progress spawnAgent names no receiver, and the first test still asserts that the inProgress/empty-receiver call registers nothing. Registration is idempotent and starts no execution, so a failed spawn whose thread never runs a turn yields no strip entry, record or roster row — the child stays registered only for its name, bounded by MAX_CHILDREN. The closeAgent gate is unchanged and now guarded by its own test.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
8e22ed0 to
08ca92b
Compare
c915a9c to
d0d1de8
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — delta since the prior pullfrog review (c915a9c → d0d1de8)
- Token totals moved to their own module — the roster's per-thread token map became
CodexThreadTokenTotalsincodex-thread-token-totals.ts, which owns the newest-report-replaces rule and the recency-ordered LRU cap (MAX_CODEX_TOKEN_USAGE_THREADS). The roster now callsrecord/get/clearand still selects its children's totals at write time, so behavior is unchanged. - Test —
codex-thread-token-totals.test.tscovers newest-report-replaces and that a thread which keeps reporting outlives quieter ones under eviction.
Verified at d0d1de85: pnpm tc:node, pnpm exec oxlint on the changed files, and pnpm run check:max-lines-ratchet all exit 0; codex-thread-token-totals.test.ts and codex-subagent-roster.test.ts pass (37). The branch was also rebased onto c4-codex-producer 08ca92b2; reading the full diff against that base confirms the producer-linkage plumbing is content-preserving for this PR.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
08ca92b to
358d1a9
Compare
d0d1de8 to
c77bad1
Compare
…wn module The readers of a session's newest own prompt and own assistant prose move from the status projection into structured-agent-session-latest-messages.ts, and are re-exported so their consumers keep one import site. With the status clock the projection now carries, scoping its status to the session's own asks put it past the size limit. The module is byte-identical to the one #22619 extracts for the same reason, so the two branches carry one change.
358d1a9 to
1db34d1
Compare
c77bad1 to
de9ea37
Compare
1db34d1 to
36242df
Compare
de9ea37 to
748ef6e
Compare
…wn module The readers of a session's newest own prompt and own assistant prose move from the status projection into structured-agent-session-latest-messages.ts, and are re-exported so their consumers keep one import site. With the status clock the projection now carries, scoping its status to the session's own asks put it past the size limit. The module is byte-identical to the one #22619 extracts for the same reason, so the two branches carry one change.
36242df to
bc928a2
Compare
748ef6e to
39223ce
Compare
…wn module The readers of a session's newest own prompt and own assistant prose move from the status projection into structured-agent-session-latest-messages.ts, and are re-exported so their consumers keep one import site. With the status clock the projection now carries, scoping its status to the session's own asks put it past the size limit. The module is byte-identical to the one #22619 extracts for the same reason, so the two branches carry one change.
… created its thread Codex reports a spawn as failed when the helper it created errored at birth, yet the call still names the thread it created, and that thread can run. The spawn was registered only when the call completed, so such a helper existed nowhere and its shell read as the session's own bare command: the original default-mode bug. A spawn now registers whenever it names a receiver; one in progress, or one that created nothing, names none. A failed closeAgent still ends nothing, because the helper was not closed.
…s own home Every thread's running total, member or not, with the rule that the newest frame replaces the last and the recency-ordered cap, moves out of the roster into codex-thread-token-totals.ts. The roster still selects its children's totals at write time. With the producer linkage the roster now builds, it was past the size limit.
…wn module The readers of a session's newest own prompt and own assistant prose move from the status projection into structured-agent-session-latest-messages.ts, and are re-exported so their consumers keep one import site. With the status clock the projection now carries, a tool result naming its call put it past the size limit.
…s process reports its exit A helper's in-turn shell is a live command record owned by the helper and is also its open Bash operation; its exit removes the record. A caller's closeAgent kills the helper's processes, and each still reports its exit on the helper's thread, so the close leaves the command to that exit rather than ending it itself.
…call it names The folded desktop run now pairs a result with the call it names, but mobile's tool run, the desktop edit cards and the task lists still paired by position through `pairToolBlocks`. In a Codex default-mode session the new `spawn_agent` row finishes with no output, so on mobile the helper's reply drew under `spawn_agent` and `wait_agent` showed none, and a desktop edit card could take the next command's output as its own. `pairToolBlocks` now follows the same rule as `pairNativeChatToolResults`: a result that names its call answers that call, and one that names none answers the oldest unanswered call as before.
…n its caller's closeAgent A finished `closeAgent` call ended the helper's running turn as `stopped`. But the call's status is not the close's outcome: Codex sets it from the helper's own agent status, so a close that errors on a running helper still reports `completed`. Orca then marked a helper that was still running as cancelled in the strip, the host record and the roster row, and because the first ending a turn gets stands, its real ending could never correct it. A close that works does not need the edge either. Codex's shutdown of the helper aborts its running turn, and the app-server reports that as the helper's own `turn/completed` with status `interrupted`, which Orca already maps to `stopped`. So a helper's turn now ends only on its own frames (its `turn/completed`, a fatal `error`, `thread/closed`) or the session ending, and the close is only its call row. This also drops the child-work evidence re-keying that existed only for the close: every remaining frame names the thread that sent it.
… different call A result that named a call id with no unanswered match fell back to the oldest unanswered call. On mobile, a run shows at most six calls, so a command past that window whose output named its own call gave that output to an earlier call that finished with none, such as `spawn_agent`. A result that names its call now answers only that call and otherwise stays unpaired. A result that names no call still answers the oldest unanswered one. Both pairing readers share the one rule through `answeredToolCallIndex`.
…bagents it covers
…, not only its spawn A helper whose spawn Orca never saw (history replay after compaction dropped the spawn, or a resume or message to a helper from earlier) stayed unregistered, so its shell read as the session's own command: the bug this PR fixes, in another shape. Every collab call now announces each helper it names, skipping a receiver the finished call reports notFound. The spawn's prompt still labels a helper when it was seen; otherwise the helper has no label and reads as any unnamed subagent does. A send_input, like the spawn, names the parent turn the helper's next run belongs to. The session's own thread is excluded once, in the reader, instead of at each of its three callers.
…he call reports A client that predates result call ids (an older mobile app, or an older desktop reading a newer host) projects the journal itself and pairs each tool result with the oldest unanswered call. This PR publishes collab calls as tool rows, and a finished spawn_agent, send_input, close_agent or resume_agent on a running helper had no output, so such a client drew each later output in the run under the call before its own (the parent's shell output under spawn_agent, the helper's reply under the shell). Every finished call now has an output taken from the item: a wait's reply from each helper that finished (an errored helper's error), and for every other call the helper's reported status in Codex's own words (Pending init, Running, Completed, ...). A close or resume no longer shows the helper's last reply as if the call returned it. A wait whose end names no helper (it timed out, or v2) reads Finished waiting; any other call with no state reads its own status. A call also keeps naming the helpers its started item named: Codex ends a timed-out wait with no receivers, so its row lost the helper's name when it finished.
…irToolBlocks Desktop runs and every other reader (mobile, edit cards, task lists, the ask row) each had their own pairing loop sharing one index rule. The desktop's pairNativeChatToolResults now reads the pairs pairToolBlocks makes, so a run is paired by one loop and a new reader cannot add a third. No behaviour change.
… did, in Codex's own words A close_agent row read `Running` and a spawn_agent row `Pending init`: each showed the helper's status snapshot from before the call took effect, so a close that stopped its helper read as though it had not worked. Each finished call's output now follows Codex's own client: spawn reads `Spawned` (or `Agent spawn failed` when no helper was created), send_input `Sent input`, close `Closed`, and resume the helper's status summary. A wait keeps each finished helper's reply, with other statuses in Codex's summary wording (`Error - <message>`). The row label already names the helper, so the output does not repeat it.
…elper's snapshot as output Since spawn, send_input and close rows say what the call did, the reader's header was wrong to claim every call row shows the reported snapshot as its output: only a wait or resume does.
Codex's spawn_agent call ends as soon as the helper starts, so counting it as running an agent drew "Ran 1 agent" directly above "Kicked off 1 subagent · working" while the helper was still working, and "Ran 1 agent · 1 failed" when Stop cancelled a spawn before any helper existed. Claude's Task call lasts as long as its subagent, so it keeps the agent category; the Codex spawn row is now a plain tool call and the roster row alone stands for the helper.
…ion that follows a fatal error Codex follows every turn-ending `error` with the turn's failed `turn/completed`, on a helper's thread as on the primary, and only that completion ends the turn. The roster test now sends both and checks the row, strip and record stay working through the error and settle on the completion.
72deef0 to
2654d95
Compare
There was a problem hiding this comment.
Important
The rewritten roster-ending test fails at head: it expects a helper to stay working through a turn-ending error, but readCodexChildTurnEnding still settles that turn as failed — base behavior from #23808 — and codex-child-work-evidence.test.ts:181 asserts exactly that.
Reviewed changes — delta since the prior pullfrog review (6c0581d → 2654d95)
- A Codex
spawn_agentrow is no longer agent activity —spawn_agentwas removed fromCATEGORY_BY_ROW_WORD, so the call no longer takes thesubAgentActivityrun sentence or the bot glyph; Claude'staskkeeps both. Tests updated. - The roster-ending test and roster comment were rewritten — the test now expects the row to stay
workingthrough a fatalerrorand settle only on the failedturn/completed, and the comment drops "a fatal error" from the list of child-turn endings. This is the change that fails.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…wn module The readers of a session's newest own prompt and own assistant prose move from the status projection into structured-agent-session-latest-messages.ts, and are re-exported so their consumers keep one import site. With the status clock the projection now carries, scoping its status to the session's own asks put it past the size limit. The module is byte-identical to the one #22619 extracts for the same reason, so the two branches carry one change.
…-default-helpers # Conflicts: # src/main/codex/codex-background-task-tracker.ts
There was a problem hiding this comment.
ℹ️ No new issues in this delta — the merge of
mainresolves the prior blocking finding. One earlier minor thread (closeAgentfailed wording) remains open, which is why this is not an approval.
Reviewed changes — delta since the prior pullfrog review (2654d957 → a16f2f4, two merge commits of origin/main; no PR-owned feature change).
- The Codex child-turn
errorending was dropped bymain—codex-background-task-frames.tsnow exposes onlysubagents/turn/thread-closedframes (readCodexChildThreadClosedreplacedreadCodexChildTurnEnding,readCodexErrorWillRetryis gone), soCodexSubagentRosterfollows executions throughthis.executions.closeThread. A helper's row now staysworkingthrough a fatalerrorand settles on the failedturn/completedthat follows. - PR-owned files adapted to
mainrefactors —codex-child-work-evidence.tsusesprojectNativeChatTranscript, the journal writers consumeattributionFor(waslinkageFor), andstructured-agent-session-latest-messages.tsfolded back intostructured-agent-session-projection.
This resolves the prior blocking review: codex-default-mode-subagents.test.ts passes 21/21 (it previously failed at 2654d957ef). I also ran the delta-adjacent suites at head — codex-child-work-evidence (26), codex-background-task-tracker (26), codex-subagent-roster (35), codex-collab-call-rows-on-positional-clients (3), native-chat-tool-pairing (7), native-chat-tool-pair-limit (6), 103 tests, all passing — and pnpm tc:node exits 0. The thread on the failing test was replied to and resolved.
The still-open minor thread (codex-collab-agent-item-translation.ts:82: a closeAgent with status: 'failed' renders state:failed but output Closed) is unchanged by the merge and was not re-raised.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…wns, waits on or messages it A running chat holds a subagent's section open while the parent's newest row delegates to that subagent. For Codex that rule only knew the raw collab status row; this PR writes each collab call as a tool row (spawn_agent, wait_agent, send_input, close_agent, ...) naming its helpers in `input.agents`, so a default-mode helper's section stayed shut for its whole run while Claude's opened. The delegation reader now reads a Codex collab tool row as a delegation to the first helper it names, the same rule the raw row keeps for journals written before this change; a call naming no helper stays ordinary output. The row names and the `agents` key live in one shared module the host writes from and the reader reads, instead of a second list. The new test drives the real adapter's rows through the transcript projection to the delegation; the collab frame harness moves to a fixture shared with the positional-clients test.
There was a problem hiding this comment.
ℹ️ No new issues in this delta. One earlier minor thread stays open, so this is not an approval.
Reviewed changes — delta since the prior pullfrog review (a16f2f4 → 4706d3d).
- A Codex collab tool row now reads as a subagent delegation —
nativeChatSubagentDelegationgained a branch that treats a row whose newest call is a Codex collab tool (spawn_agent,wait_agent,send_input,close_agent, …) as delegating to the first helper itsinput.agentsnames. Before this, the live frontier only recognised the rawitem:collabAgentToolCallstatus row, so a default-mode helper's section stayed shut for its whole run while Claude's opened. - Row names and the
agentskey get one shared owner —src/shared/codex-collab-agent-tools.tsnow holds the camelCase→snake_case map, the row-name predicate andcodexCollabRowAgentIds; the host writesagentsthrough the same constant the reader reads, so the two cannot drift. The persisted key is stillagents, so there is no wire change. - Tests and fixture —
codex-collab-call-delegation.test.tsdrives the real adapter's published rows through the transcript projection to the delegation (finished spawn, running wait, close, an unstarted spawn, and a superseding parent call); the collab frame builders move tocodex-collab-call-frames-fixture.ts, shared with the positional-clients test.
Verified at 4706d3d: codex-collab-call-delegation (5), native-chat-subagent-delegation (3) and codex-collab-call-rows-on-positional-clients (3) pass; pnpm tc:node and pnpm tc:web exit 0; oxlint on the eight changed files reports 0 findings. The wider src/main/codex run reddens only the app-server teardown/posix-supervisor integration tests, which spawn and reap real processes and are unrelated to this change (neither file is in the PR).
The one still-open minor thread (codex-collab-agent-item-translation.ts:83: a closeAgent with status: 'failed' renders state: failed but output Closed) is untouched by this commit and was not re-raised.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…its helper A collab call row bounded its whole input as one value, so a spawn or send_input whose prompt passed the 16 KB journal limit was stored as a clipped wrapper: the row lost the helper's name and thread ids, and with them the label and the delegation that opens the helper's section. The prompt is now clipped on its own with the journal's inline-text bound, marker included; the helper's name, ids, model and effort are bounded as before and always survive.
There was a problem hiding this comment.
ℹ️ No new issues in this delta. One earlier minor thread stays open, so this is not an approval.
Reviewed changes — delta since the prior pullfrog review (e904eec238 → 70b75cc4f3).
- A long prompt no longer strips a collab call row of its helper —
collabRowInputnow clips the prompt on its own with the journal's inline-text bound, instead of bounding description, prompt, model and effort as one JSON value. AspawnAgent/sendInputprompt past the 16 KB journal limit used to turn the wholeinputinto a truncated wrapper, which swalloweddescription(the helper's name) andagents(its receiver ids) and with them the label and the delegation that opens the helper's section. The non-prompt fields are still bounded as before and now always survive. - Test —
codex-collab-call-delegation.test.tsadds a spawn whose prompt is 20,000 characters and asserts the published row keepsdescription/agentsand still reads as a delegation to the helper.
Verified at 70b75cc4f3: codex-collab-call-delegation (6), codex-default-mode-subagents (21) and codex-collab-call-rows-on-positional-clients (3) pass; pnpm tc:node exits 0.
The still-open minor thread (codex-collab-agent-item-translation.ts:83: a closeAgent with status: 'failed' renders state: failed but output Closed) is untouched by this commit and was not re-raised.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Review status at
|

What this changes for you
Who hits this: anyone using a Codex native chat where the main agent hands work to a helper agent. Codex picks its multi-agent mode per model, and in live runs GPT-5.5 used its default mode, which is the mode this PR fixes. Codex's newer v2 mode already worked.
Before: in that mode, Orca never registered the helper as an agent. Its rows showed in a section headed only Subagent, with no name and no state, and nothing else said a second agent was at work: no subagent row, no agent in the dock, no host record. What did show was wrong: the helper's shell command appeared as the main agent's own work, and the main agent's calls to the helper showed as raw internal rows.
codex · item:collabAgentToolCall.spawn_agent,wait_agent,send_input,close_agent), each labelled with the helper and saying what the call did: Spawned, Sent input, Closed, or the helper's reply.spawn_agent, a shell's output underwait_agent). This also affected Claude folded runs.Screenshots of each state are under Visual Proof below.
Scope.
wait) now render as readable tool rows too. v2 helper registration is unchanged.State. Up to date with main (including #23783, a helper's turn ends only on its own
turn/completed, and #23752, a subagent's rows live in their own section). Checks at the final head70b75cc4f3bare under Testing.How it works
One membership model, fed from the calls that name a helper
Codex 0.155+ has two multi-agent modes. v2 announces a helper with
subAgentActivityitems. Default mode sends none: a helper appears only as the thread ids a parent'scollabAgentToolCallitem names inreceiverThreadIds.spawnAgentstarts withreceiverThreadIds: []and names the helper's thread when it ends;wait,sendInput,resumeAgentandcloseAgentname their receivers from the start.Before this PR, the journal roster and the background-task tracker registered children only from
subAgentActivity. Both write into oneCodexSubagentExecutions, the single owner of Codex child identity, so in default mode nothing registered anywhere.readCodexSubagentAnnouncements(codex-subagent-activity.ts) returns every helper an item names: asubAgentActivityitem's child, or every receiver of a collab call, at the call's start or end, except receivers the call reports asnotFound. This is the same rule Codex's own client uses to learn its helpers.failedwhen the helper it created errored at birth, yet still names the thread, and that thread can run.agentsStatesis the caller's snapshot and is never read as state.spawn_agentandsend_inputput a helper's run under the parent turn that sent it work, like v2'sinteracted.Lifecycle: a helper's turn ends on its own frames
A helper's turn ends on its own
turn/completed(a fatal error's failed completion follows it within milliseconds),thread/closed, or the session ending.closeAgentis not an ending by itself: its item's status is the helper's reported status, not whether the close worked, so a close that errors on a running helper still reportscompleted. When a close works, Codex aborts the helper's turn and sends the helper's ownturn/completedwith statusinterrupted(mapped to stopped), then kills its processes. Each killed process still reports its exit asitem/completedon the helper's thread, which removes its command record through the command tracker, the one owner of command lifecycle. Both were seen live (below).The roster row now settles with the strip and the record
#22553 settled a child's strip row and host record together when its turn ended without
turn/completed(thread/closed), but the transcript's subagent row was rewritten only on a child'sturn/startedandturn/completed, so it kept reading working after those endings.CodexSubagentExecutionsnow reports when a child's current execution changes (onExecutionChanged), and the roster rewrites the group row from that, whichever frame caused it. A refused write clears the group'slastSerialized, so the next write retries it. The default-mode roster row now also rewrites on each helper's token-usage update, coalesced per group, the same as v2 on main.The transcript rows
collabAgentToolCallbecomes atool-callrow (codex-collab-agent-item-translation.ts) named by the tool the model called, with the helper's name indescription(the key the row label reads), and the prompt, model, effort and receiver ids for the expanded view.Error - <message>. A running call has no output, like every running tool. Every finished call needs one: an older client pairs outputs with calls by position (see Notes).spawn_agentrow is a plain tool call in the run sentence. Codex's spawn call ends as soon as the helper starts, so counting it as running an agent read "Ran 1 agent" above "Kicked off 1 subagent · working"; the roster row alone stands for the helper. (Claude's Task call, which lasts as long as its subagent, keeps the agent wording.)send_inputprompt past the 16 KB journal limit is clipped on its own, with the journal's truncation marker, so the row always keeps the helper's name and thread ids.The helper's section opens while the main agent works with it
A running chat holds a subagent's section open while the main agent's newest row is a call on that subagent, as it does for a Claude spawn. The reader that decides this (
native-chat-subagent-delegation.ts) only knew the old raw collab row, so a default-mode helper's section stayed shut for its whole run. It now also reads the collab tool rows: a spawn, wait, message or close names the helper it delegates to (the first, if it names several); one naming none is ordinary output. The tool names and the helper-id key come from one module,src/shared/codex-collab-agent-tools.ts, which the host writes the rows from. Raw rows in journals written before this PR still work.A pairing fix this exposed
Every reader of a folded tool run paired results to calls by position, so one call that finished with no output shifted every later output onto the call before it. This was visible live. A structured row carries its call and its output together, so the projected result now names its call (
NativeChatToolResultBlock.callId, optional) and every reader pairs through one loop,pairToolBlocks: the desktop run, mobile's tool run, the edit cards, the task lists and the ask row. A result that names a call answers only that call (or none, if that call is not waiting); a result that names none is still paired by position.callIdis produced wherever the journal is projected (renderer, mobile, host worker transcripts and released-worker archives). The same misattribution existed for Claude folded runs, which already carry call ids, and for any Codex call that finished with no output.Why this approach
notFound).agentsStatesas the helper's state. It is the caller's last-known snapshot, refreshed only when the caller makes a call. The helper's own frames already give its state.closeAgent. An earlier revision did this. It could mark a still-running helper cancelled forever (the item's status is the helper's, not the close's), and Codex already reports the helper's own interrupted turn.Visual Proof
Real Codex
codex-cli 0.159.0, GPT-5.5 in default multi-agent mode, a background dev build (ORCA_BACKGROUND_LAUNCH=1) of4706d3df677with current main merged, CDP screenshots of the hidden window. The last commit,70b75cc4f3b, only clips very long prompts and is covered by unit tests.BEFORE (current main), while the helper sleeps: two raw
codex item:collabAgentToolCallrows, the helper's rows under a section headed only Subagent (no name, no state), no roster row, and the dock reads 1 shell command — working with no helper label, naming the helper's command as the session's own.AFTER, while the helper runs
sleep 40; echo CHILD_DONEand the main agent waits on it: Kicked off 1 subagent · working, the helper's section named by its task and opened by itself with its running command inside,wait_agentnaming the helper, and the dock reads 1 agent — working.AFTER, dock expanded: one agent row, labelled with the helper's prompt.
AFTER, settled turn with rows expanded:
spawn_agentreadsSpawnedand carries the helper's id, the roster row reads Ran 1 subagent · completed · 46s · 47.6k tokens, and the helper's shell (exit 0) sits in the helper's section.AFTER, a helper closed while a command it started (
sleep 150) was still running:wait_agentreads the helper's replySTARTED,close_agentreadsClosed, the killed shell readsexit -1, and nothing stays working. The roster row reads completed here because the helper's own turn had finished before the close; a close during its turn reads stopped.AFTER, quit and relaunch: the restored rows name the helper by its task, not a thread id, and the roster row reads completed with no dock entry.
Testing
70b75cc4f3b:tc:nodepasses;pnpm run check:code-quality:changedreports 0 findings across 34 files (React Doctor and casting included); fulloxlintand the anti-slop audit pass.tc:webpassed at4706d3df677; the commits after it change onlysrc/mainfiles and merge main.env -u ORCA_STRUCTURED_SESSION -u ORCA_AGENT_SESSION_ID: after merging current main, allsrc/main/codex,src/main/native-chat, renderer native-chat,src/shared/native-chat-*andsrc/shared/structured-agent-session-*tests: 7,522 passed, 2 failed, both timeouts under machine load in tests this PR does not touch, which pass when run alone. At4706d3df677,src/main/codexand renderer native-chat: 4,678 passed, 0 failed. At the final head,src/main/codexplus the delegation, subagent-section and tool-icon tests: 2,462 passed, 1 failed, the same untouched load-timeout test, which passes alone.codex-default-mode-subagents.test.ts(21), through the realCodexStructuredSessionAdapter, with spawn and wait items taken verbatim from a live default-mode journal. Registration in the strip, the records and the roster row; either arrival order; one child for a session announcing both ways; a failed spawn that created its thread, and one that created none; a closed helper ended only by its own interrupted turn, and a failed close leaving it running; a closed helper's command kept until its process reports the exit; the roster row staying working through a helper's fatal error and settling on the failedturn/completedthat follows it, and settling when its thread closes; a helper whose spawn was never seen, registered from any call naming it (several receivers,notFoundskipped, parent-turn rule); restore naming a replayed row, claiming no running helper, and knowing a helper whose spawn compacted away.codex-collab-call-rows-on-positional-clients.test.ts(3): replays what the host publishes through the old positional pairing rule (call ids stripped) with both the desktop and mobile readers, over the conversation and the helper's own section, and checks each output lands under its own call through spawn, shell, wait and close, including a timed-out wait.codex-collab-call-delegation.test.ts(6): the real adapter's rows, through the transcript projection, to the reader that opens a helper's section: a finished spawn, a running wait and a close delegate to the helper; a spawn still starting and the main agent's next call do not; a spawn with a prompt past the journal limit still names its helper.native-chat-tool-pairing,native-chat-tool-pair-limit); the projected result carrying its call id; no Codex helper call counted as running an agent; per-thread token totals.notFoundskip, thesend_inputparent-turn rule, or multi-helper handling in the records or the roster reddens 1 each; not passing the started item reddens 2 of the positional-client tests; showing the helper's message for every tool reddens 2; restoring the earlier status-snapshot wording reddens all 3; removing the collab-row branch from the section reader reddens 3 of the delegation tests; bounding the prompt together with the helper's name and ids reddens the long-prompt test.Live QA
Real Codex
codex-cli 0.157.0on macOS, GPT-5.5 in default multi-agent mode, background dev builds (ORCA_BACKGROUND_LAUNCH=1) driven over CDP with an isolated profile and agent-status hooks off.Each scenario ran in a fresh chat on a folder workspace, with host child-work records captured per mutation and Codex's raw frames recorded. Rounds ran at
63ddd92787,5c4eb54932a,0222b9929e3and8fe518e5d86oncodex-cli 0.157.0, and the latest at4706d3df677with current main merged, oncodex-cli 0.159.0; the screenshots above are from the latest.Bash: …, its command record owned by the helper and removed 1–12 ms after the process exited, helper settled succeeded. Dock never said "shell command". No raw collab rows. Codex sent nosubAgentActivity, so this was default mode.failed, exit -1) 16–32 ms after the close started; the record was removed 1–4 ms later;psconfirmed the process was gone.turn/completed interrupted(~47 ms after the close started), then the killed command's exit, then the close item. Helper settled cancelled; command record removed after the exit.wait_agentthat times outFinished waiting.wait_agentran, and was closed once the turn settled.spawn_agentis runningWhat I did not verify, and known limits
close_agentorsend_inputthat Codex reports as failed still readsClosed/Sent input, as in Codex's own client; the row itself is drawn in its failed state.Spawned,Closed,Finished waiting, …) are English text in the journal, like the journal's existing host-written notices ("Cancellation requested.", "Conversation compacted."). They exist so older clients pair outputs correctly and show only when a row is expanded.subagentin the roster row, as an unlabelled agent in the dock, and by its thread id on its call rows (each surface's existing fallback). Codex's nickname for it is only reachable through an extrathread/readrequest per helper, which Orca does not make.thread/resume) names no helper: Codex stores only the completed item.Notes
tool-callrows with outputs, and a default-mode roster row appears. Both are body kinds older clients already render. Because every finished collab row carries an output, an older client that pairs by position still draws each output under its own call.NativeChatToolResultBlock.callIdcrosses the worker-read RPC and is persisted in released-worker archives; it is optional, and readers without it fall back to positional pairing.spawnAgent,sendInput,resumeAgent,wait,closeAgent,sendMessage,followupTask,interruptAgent,listAgents.descriptionis its prompt head, not a task name.thread/read.Merge order
#22532, #22520, #22521, #22536, #22553 and #22565 are merged. Codex default-mode helpers appear in the sidebar only once #22614 is in too: #22614 reads the host records, and this PR is what writes them for default mode.