Skip to content

[Bug]: Auto-settle can leave delegated Codex children unarchived since 0.1.13 #44603

Done

Description

@edmangalicea

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Run T3 Code 0.1.13 with default settle settings and the Codex provider on the default ~/.codex home shared with the ChatGPT desktop app.
  2. From a parent thread, invoke delegate_task with the codex provider. Wait for the child to finish and deliver its result to the parent, keeping the parent thread open.
  3. Wait more than 2 minutes, then inspect Codex Recents in the ChatGPT desktop app or run select archived from threads where id = '<native id>' against ~/.codex/state_5.sqlite.

Expected behavior

Matching the behavior from #34829, a successfully completed delegated Codex child—whose parent has received its result and which has no pending background work—should be archived via thread/archive after sitting idle for the idle-unload timeout, removing it from ChatGPT Recents.

Actual behavior

When auto-settle runs before the idle timer, T3 unsubscribes the child without archiving it, leaving the thread visible in ChatGPT Recents. Across the first 29 delegated children I inspected after updating to 0.1.13, T3 logged no archive request. In one observed follow-up, T3 unarchived the child and then unsubscribed it without sending an archive request.

Observed data:

  • Before 0.1.13 (previous build, which still used the 30-minute idle timer): 18 of the 20 delegated Codex children on my machine have a thread/archive call in T3's provider log.
  • After 0.1.13 (at the time of writing): none of the 29 children started after the update have a thread/archive call, even though all 29 finished with their result delivered to the parent.
    • 28 were auto-settled 0.1 to 83.5 seconds after completion—always ahead of the 2-minute idle timer.
    • One child had its original settle time overwritten by a later follow-up, though its first thread/unsubscribe came 27.7 seconds after completion.

Root cause:

  1. When a delegated child finishes, ProviderSessionManager queues an idle unload (DEFAULT_IDLE_TIMEOUT_MS, 2 minutes), which checks delegatedChildArchive and unloads with archive: true.
  2. Since fix(server): finished subagent threads settle without waiting for their parent #43558, a finished child settles independently once the parent has its result rather than waiting for the parent to settle. Auto-settle now beats the idle timer, and thread.settle emits provider-session.detach.
  3. ProviderSessionManager.detach removes the pending idle unload and calls unloadThread({ providerThread }) without archive. Because the session-release archive path reads the same pending-unload map, it misses the thread as well.
  4. As a result, CodexAdapterV2.unloadThread sends thread/unsubscribe instead of thread/archive, and session release does not retry the archive because the pending idle unload has already been removed.

On main as of 73d69332 (Nov 28 UTC), detach still unloads without archive; #44020 touched detach without adding archiving.

Possible fix:

When a settle detaches a finished delegated child, run the same delegatedChildArchive check for that child's own native thread and archive it when the check returns "ready", falling back to a plain unload if archiving fails. Keep this scoped to the settled child, since generic detach also handles workspace handoffs and other owners' provider threads.

Related: #43558, #43545, #34829, #29778, #38148

Impact

Minor bug or occasional failure

Version or commit

T3 Code (Beta) 0.1.13 (source commit bc0f04da)

Environment

macOS 27.2.1, codex-cli 0.172.0, ChatGPT desktop app with Codex, provider codex (gpt-6.2-sol and gpt-6.2-astra)

Logs or stack traces

One delegated Codex child (UTC):
00:58:24.118 subagent completed
00:58:24.144 result delivered to the parent thread
00:59:23.438 child thread auto-settled
00:59:23.453 T3 sends thread/unsubscribe for the child (no thread/archive)

Workaround

Manually send thread/archive for finished delegated children via a short-lived stdio codex app-server. Resuming an archived child from T3 still works because T3 unarchives it on resume.

Council review

This report was investigated and drafted with AI agents in T3 Code. Claude Opus 5.5 (high) investigated and drafted it. GPT-6.2 Sol (high) and Gemini 4 Neon (high) reviewed the diagnosis. Claude Fable 5.2 (medium) and GPT-6.2 Astra (high) then reviewed the findings and this draft against T3's source, logs and databases. Gemini 4 Neon (high) then rewrote the prose of this report.

Rounds: 4

Reviewer Round 1 Round 2 Round 3 Round 4
Claude Fable 5.2 (medium) findings 7/10, draft 6/10 findings 9/10, draft 9/10 findings 9/10, draft 9/10 findings 9/10, draft 9/10
GPT-6.2 Astra (high) findings 9/10, draft 7/10 findings 9/10, draft 8/10 findings 9/10, draft 8/10 findings 9/10, draft 9/10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions