Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Codex repeatedly creates child tasks while trying to stop a delegate #48075

ClosedNyiuu(GitHub profile, opens in a new tab) opened this issue 1 comment

Before submitting

  • I searched existing issues and did not find a report of this particular call sequence.
  • I included the adapter configuration and a redacted runtime observation.

Area

apps/server

Steps to reproduce

  1. Use T3 Code 0.1.10 with Codex CLI 0.170.0 in Code Mode. Inspect the configuration passed to Codex on thread/start. The adapter replay test that checks session MCP configuration also captures this request without running an LLM.
  2. Inspect the enabled_tools list on mcp_servers.t3-code-direct. It includes delegate_task together with t3_thread_wait. The same names are disabled on the general server. Look up task_cancel and t3_thread_read: both are on the general server.
  3. For the observed LLM case, ask Codex to use an existing T3 thread as context for writing a skill, without requesting delegation. Inspect the parent's tool calls and the resulting child tasks. The tool registration is deterministic; the observed model choices are not.

Expected behavior

The parent can read the supplied thread itself. If it needs to cancel an existing delegate, it uses the returned task ID with task_cancel.

Actual behavior

In one ordinary skill-writing turn the parent issued 16 separate t3-code-direct.delegate_task calls. The first asked a child to read the thread. The other 15 supplied instructions such as “Stop” as the new task's text. Each created another child. The server executed the tool it received. There was no cancellation call in that sequence.

Impact

Major degradation when the loop occurs. One requested task produced 16 child tasks, consuming model calls and cluttering the thread history.

Version or commit

Observed live on 0.1.10. The registration is also present in the v0.1.13 and main source inspected. The live behavioral case was tested on 0.1.10 only.

Environment

macOS arm64, Codex CLI 0.170.0, GPT-6.2 Astra, xhigh reasoning, custom Responses API relay.

Logs or stack traces

Before (one turn, redacted):
  1 x t3-code-direct.delegate_task(task=<read an existing thread>)
 15 x t3-code-direct.delegate_task(task=<stop instruction>)
  0 x task_cancel

After changing only the adapter's tool grouping, rebuilding 0.1.10 and restarting:
  direct delegate_task removed from the resumed Codex session
  general tools included delegate_task, task_cancel and t3_thread_read
  t3_thread_read on the original source thread returned a message
  0 child tasks created during this read

Workaround

Locally I restored the v0.1.9 grouping for delegate_task and kept t3_thread_wait direct. This removes the initial create-only entry point. It does not prove the relay, reasoning level or tool exposure alone caused the model choices. The post-restart check was one read in a resumed session, not a controlled repeat of the entire prompt.

There is an important trade-off with #30006 and its fix #30019: an explicit wait-mode delegate in Code Mode can yield and require another model request. A fix should account for both behaviors. #47987 concerns native settings and reviewer reuse; this case used the T3 MCP creator repeatedly even for stop instructions.

  1. tanstack-source added labelsbug

  2. I tried to reproduce this on the current build and could not.

    Commit 6b12843cbe (origin/main). Deterministic part confirmed: in apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts, CODEX_DIRECT_ONLY_T3_TOOLS = ["t3_thread_wait", "delegate_task"]. These are enabled on mcp_servers.t3-code-direct with omit_tools_from [code_mode, deferred] and disabled on t3-code. task_cancel and t3_thread_read stay on the Code Mode server. The adapter test 'adds the session MCP server and gives stdio servers the thread id' asserts this exact config. Live runs: a T3 server from the worktree on a fresh base dir (T3CODE_DEV_SEED=0), a scratch git project, Codex CLI 0.173.0 through the hub, driven with t3 thread start --wait. (0) Source thread: 5 bullet points on commit messages, gpt-6.1-sol. (1) Parent on gpt-6.2-astra with reasoningEffort=xhigh: 'Use the existing T3 thread as context and write a skill at .agents/skills/commit-messages/SKILL.md from it.' Rollout: the parent searched ALL_TOOLS and called t3_code__t3_thread_read through a Code Mode exec, then wrote and validated the skill. Zero delegate_task calls, zero children. (2) Same model and effort: 'Start one background delegate (async) that runs sleep 600 ... then stop that delegate.' Rollout: one direct function_call delegate_task (async), then a Code Mode exec calling t3_code__task_cancel with the returned taskId. The result was cancel_requested, with no extra delegate_task calls. So the 16x delegate_task('Stop') loop did not appear in 2 runs. The model choice is nondeterministic, and the reporter used a custom Responses relay and Codex 0.170.0. I could not match that environment.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

  3. juliusmarminge closed this

Sign in to join this conversation.