Repository navigation
fix(codex): delegate_task children start as Codex subagents - #36525
Conversation
…urce Failing test for #36520: Codex thread/start for a delegate_task child carries no threadSource, so the child's MCP tool calls look like a user thread's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex delegate_task children were started with thread/start and no threadSource, so their MCP tool calls carried no thread_source and MCP servers could not tell them from threads the user opened. ensureThread now sends threadSource "subagent" when the app thread id is a delegate_task child. Fixes #36520 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Delegated Codex children now start with subagent classification so their MCP calls carry the appropriate source. Ordinary threads, identifier formats and runtime policies remain unchanged, keeping the change narrowly scoped. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
The delegated_task_status Codex transcript recorded the child's thread/start without threadSource; T3 now sends "subagent" for delegate_task children. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dismissing prior approval to re-evaluate f8074ae
The rework brief listed nothing to change; it asked me to stay on PR #36525. CI then failed 'Test Server 2' (and the aggregate 'Check') on 6bedaa6. The failure was real: the four OrchestratorMcpToolkit.integration.test.ts tests ('reports distinct/identical/emoji/long child results') replay the recorded delegated_task_status Codex transcript, and its child.thread/start frame had no threadSource. With the fix, T3 sends threadSource "subagent" for delegate_task children, so the replay harness rejected the frame. The job's later 'not enough space on the disk' error was runner noise, not the cause. I reproduced the four failures locally with the same test file, then added "threadSource":"subagent" to that one expected outbound frame in apps/server/src/orchestration-v2/testkit/fixtures/delegated_task_status/codex_transcript.ndjson. No other Codex fixture starts a delegated child. The fix is unchanged. On f8074ae all 8 required checks pass and Macroscope approved with no comments on any line. CodeRabbit's review of 6bedaa6 had no actionable comments. Its re-run on f8074ae was still in progress when I stopped watching, and it had reported 0 included reviews left that hour. No finding rated high or above is open.
Fixes #36520
Reproduction on main
On origin/main 56fd98b: ran
T3CODE_DEV_SEED=0 CODEX_HOME=<scratch> vp run dev, where the scratch Codex home held the hub config plus a stdio MCP servermetalogwhose toolrecord_markerlogs params._meta["x-codex-turn-metadata"] on every tools/call. Paired the web client in the preview browser and, in a new Codex thread (GPT-6-Astra, codex-cli 0.169.0), asked the agent to call record_marker("parent"), then delegate_task a Codex child that calls record_marker("child"). Both calls were logged. Each had session_id, thread_id, turn_id, model and codex_version, and neither had a thread_source key. The database showed the child's native Codex thread (01a1d8c9-b23f-…) owned by app threadthread:delegated-task:command%3Amcp%3A…, so it was a delegate_task child, not a native Codex subagent. Then added a failing adapter test (CodexAdapterV2.test.ts, 'starts delegate_task children with the subagent thread source'). It records threadSource on thread/start for a parent thread and for a thread whose id comes from delegatedTaskThread, and gets [undefined, undefined] where it expects [undefined, "subagent"].Evidence
Run the real Codex parent → record_marker('parent') → T3 delegate_task → child record_marker('child') flow on fresh databases. GPT-6-Astra, codex-cli 0.169.0, Chromium, 1280×800, light theme. Reproduced twice per commit; screenshots show the second run. Received MCP logs independently confirm the displayed results and identify both children as T3-owned delegates.
Reproduction driver · MCP logger
Captures are cropped to the conversation for privacy. Recordings begin with delegation underway; the head recording ends with a three-second hold of the final still. Runtime exports remove only the private workspaces map. All captures were visually inspected before upload.
Tests
vp test run src/mcp/OrchestratorMcpToolkit.integration.test.ts on 6bedaa6: 4 failed (reproduces CI). Same file after the fixture fix: 4 passed. vp test run of RestartContinuation, ThreadStop, RemoteDelegatedTask, ProviderRuntimeRecoveryService, peer/RemoteDelegation and mcp/McpHttpServer tests: 196 passed. Pre-commit fmt and lint passed. CI on f8074ae: all 8 required checks passed.
Not in this change
Who did the work
Run by the t3code factory in T3 Code.