Skip to content

gpt-6.1-terra ends turns early when a client starts the turn through app-server; the same task completes via codex exec and as a spawn_agent child #60133

Open

Description

@super148666

What issue are you seeing?

gpt-6.1-terra at medium effort ends its turn early on a long multi-step task when an app-server client starts the turn. The client here is T3 Code. The agent stops after setup or after one step. Its final message accurately says the work is unfinished and that nothing is blocking it. A "continue" message makes it finish.

The same task text, model and effort complete in one turn when the work is started through:

  • codex exec
  • a native spawn_agent child created inside an app-server thread

The table shows whether the whole task was done in the first turn (same machine, same ~/.codex config):

Launch path Full task done in first turn
app-server turn/start from the client (top-level threads and the client's own delegated child threads) 0/11
native spawn_agent child (source: subagent/thread_spawn) inside an app-server thread 3/3
codex exec (source: exec) 2/2

The samples are small, but the split is consistent.

Through the app-server path, other settings on the same task gave:

Model and effort Full task done in first turn
terra high 0/2
terra low 1/1
terra xhigh 2/2
gpt-6.1-sol medium 1/1
gpt-6-luna high 0/2

Differences I found in the rollouts:

  • Root role and AGENTS.md: the codex exec session is also /root and loads the same global ~/.codex/AGENTS.md. Neither explains the gap.
  • Collaboration Mode: the client sends the full "# Collaboration Mode: Default ..." text in collaborationMode.settings.developer_instructions. That text includes "If explicit user input is required ... ask the user directly with one concise plain-text question". In the exec and spawn_agent sessions, turn_context.collaboration_mode.settings.developer_instructions is null.
  • Client context: the client also adds its own additionalContext developer blocks.

I have not isolated which of these two triggers the early stop.

What steps can reproduce the bug?

  1. Use an app-server client, such as T3 Code, with gpt-6.1-terra and effort medium. Start a turn whose collaborationMode is default with explicit developer_instructions.
  2. Give it a long file task. Mine was: read a brief and a vocabulary file, process 9 text chunks (201 records) one at a time, append JSONL rows for each chunk, then run a check script. The prompt says: "This is a long task; there is no time limit. Do not end your turn until both output files exist and the final check passes."
  3. The turn usually ends after 0–1 chunks.
  4. Run the same prompt with codex exec -m gpt-6.1-terra -c model_reasoning_effort=medium, or as a spawn_agent child with model terra and effort medium. It completes all 9 chunks in one turn.

Adding "Continue working toward the overall goal ... Only stop when the entire goal is completed or a genuine blocker prevents further progress" to the prompt did not fix it in the app-server path. In one run it stopped after 1 of 9 chunks.

What is the expected behavior?

The turn continues until the task is complete, as it does in the exec and spawn_agent paths.

Additional information

Activity

  1. added
    bug
    app-server
    model-behavior
    on Nov 7, 2026
  2. github-actions commented on Nov 7, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. super148666 commented on Nov 7, 2026

    @super148666
    Author

    Update after isolating further. This reproduces with a bare codex app-server client and no T3, and none of the client-supplied extras explain it.

    Correction: the codex exec session also gets the built-in <collaboration_mode># Collaboration Mode: Default text. developer_instructions: null means "use the default", so that difference in my report was wrong.

    Setup: a minimal stdio JSON-RPC client replays the client's initialize, thread/start and turn/start exactly, with only cwd and output dir changed. Model gpt-6.1-terra, effort medium, sandboxPolicy: dangerFullAccess, approvalPolicy: never. Each row shows whether the whole task was done in the first turn:

    Variant Full task done in first turn
    exact replay 0/3
    without additionalContext 0/2
    without tools.update_plan.enabled 0/2
    summary: auto 0/2
    approvalsReviewer: auto_review 0/2
    all four removed together 0/2
    different clientInfo.name 0/2
    without collaborationMode 0/2
    without effort 0/2
    without sandboxPolicy + approvalPolicy 0/2
    codex exec, same prompt (same sandbox and reviewer as the auto_review row) 2/2
    codex exec + the client's context blocks as developer_instructions 3/3
    spawn_agent child (source: subagent/thread_spawn) in an app-server thread 3/3

    In each failing run the model emits final_answer itself after 1–2 tool calls, within 20–45 s. It is not interrupted. The first-turn model inputs, tools and code-mode exec calls look the same as in the passing codex exec runs.

    The visible difference that tracks the outcome is the session source: vscode (app-server top-level thread) fails, while exec and subagent pass. Is session source, or anything else derived from the app-server path, sent with the model request in a way that could change turn-ending behaviour?

    Caveat: a replay with turn/start carrying only threadId and input completed 4/4. That fell back to the workspace-write sandbox with auto-review escalations on most commands, so I don't treat it as clean evidence.

    I can share the replay script, which contains no private data.

  4. super148666 commented on Nov 7, 2026

    @super148666
    Author

    Update: this stopped reproducing for me on the evening of 2026-11-07, without any local change.

    Time (UTC+8) Exact replay of the client's turn/start (terra medium) Full task done in first turn
    up to 22:47 same script, same task 0/19
    23:43 the real T3 delegate_task path 1/1
    23:48 same replay script, same task 2/2

    Nothing local changed in between:

    • the same codex.exe 0.167.0, binary dated 2026-11-06
    • the same base-instructions hash
    • the same config for the replay
    • the same task

    This points to a server-side change or a time-varying issue, not to anything client-side. I'll report back if it returns. Feel free to close.

    Thank you to the Codex team and everyone who reported and discussed the related early-stop issues. If it was a server-side fix, thank you for shipping it.

  5. super148666 commented on Nov 10, 2026

    @super148666
    Author

    Update: this did not go away on Nov 7. I found a deterministic trigger, and my earlier "stopped reproducing" was caused by a change in my local default effort.

    Trigger

    The turn ends early when turn/start carries a reasoning effort that differs from the effort the thread started with (model_reasoning_effort from config.toml, or from the thread/start config).

    In that case the rollout has a response_item of type configuration_update right after the user message:

    {"type":"configuration_update","reasoning":{"effort":"medium"}}

    Every run with this item ended early. Every run without it completed.

    Controlled runs (Nov 10, codex-cli 0.167.0, Windows 11, bare codex app-server stdio client)

    Same task as in the issue (9 chunks, 201 records), same replayed thread/start + turn/start. The only things varied are model_reasoning_effort in the thread/start config and effort in turn/start (also set in collaborationMode.settings.reasoning_effort). My config.toml default is medium.

    Model Thread effort Turn effort configuration_update in rollout Completed in first turn Seconds
    gpt-6.1-terra medium (config default) medium no 2/2 221, 236
    gpt-6.1-terra high medium yes 0/2 39, 37
    gpt-6.1-terra high high no 2/2 253, 216
    gpt-6.1-terra medium (config default) high yes 0/2 40, 63
    gpt-6-luna high high no 2/2 508, 496
    gpt-6-luna medium (config default) high yes 0/2 76, 45

    Rows 1 and 2 run at the same effective effort (medium). The only difference is whether the turn effort matches the thread effort.

    In the failing runs the model emits final_answer itself after 3 to 6 tool calls and says the work is incomplete. It is not interrupted.

    The Nov 7 data fits the same rule

    I re-read the rollouts from my Nov 7 tests (gpt-6.1-terra, medium):

    • 21 app-server runs had the configuration_update item. All 21 ended early.
    • 7 app-server runs did not have it (the "min" replays that sent only threadId + input, the later "post" replays, and one Codex Desktop run). All 7 completed.
    • 5 codex exec runs did not have it. All 5 completed.

    So the variants I removed one at a time (collaborationMode, effort, sandboxPolicy, additionalContext) kept failing because each of them still left a turn-level effort that differed from the thread's. Native spawn_agent children and codex exec set the effort when the thread is created, so they never get the item.

    The "post" replays started completing at 23:48 on Nov 7 because my config.toml default had become medium by then, which matched the replayed turn effort. I believe that happened when I ran a gpt-6.1-terra medium test in Codex Desktop at 23:31, but I did not record the earlier value, so that part is an inference.

    Workarounds

    • Keep model_reasoning_effort in config.toml equal to the effort the client sends in turn/start.
    • For clients: also send model_reasoning_effort in the thread/start config, equal to the first turn's effort.

    Question

    Is configuration_update with reasoning.effort expected to change how the model decides to end the turn? I can attach rollouts for any row above.

  6. super148666 commented on Nov 10, 2026

    @super148666
    Author

    Correction and more data for my previous comment. I overstated it: the effort mismatch makes the early stop much more likely, but it is not deterministic, and it depends on the task. It also reproduces on macOS.

    What still holds

    When the turn effort equals the thread effort (no configuration_update item), the turn has never ended early: 11/11 on Nov 10 across two machines (gpt-6.1-terra 9/9, gpt-6-luna 2/2), plus the 12 runs from Nov 7.

    What I got wrong

    "Every run with this item ended early" was true for the runs I had at that point, but later runs on the same day completed with the item present.

    All runs below: codex-cli 0.167.0, same replayed thread/start + turn/start, same real task (201 records in 9 chunks, long free-text fields, chunks up to 26 KB, plus reference documents to read first), turn effort different from thread effort, configuration_update present in every rollout.

    Machine Model Ended early Completed
    Windows 11 gpt-6.1-terra 9 1
    Windows 11 gpt-6-luna 2 0
    macOS 27.0.1 (Apple silicon) gpt-6.1-terra 1 3

    The macOS early stop looks the same as on Windows: final_answer after 77 s with 75 of 201 records done and a message saying the work is incomplete. The two machines have nearly the same config.toml (same features, same default effort). 9/10 against 1/4 may be a platform difference or just a small sample; I cannot tell.

    Task dependence

    With a synthetic task of the same shape (9 chunks, about 200 short templated records, a check script at the end), the mismatch did not cause any early stop on Windows: 5/5 completed with the configuration_update item present (chunks of 8 KB in 2 runs and 17 KB in 3 runs). Only the heavier real task triggers it. This may be why synthetic reproductions pass.

    Feature flags (Windows, gpt-6.1-terra, mismatch, real task)

    My config has features.multi_agent = true with multi_agent_v2 and a long usage_hint_text, features.goals = true, and features.context_management.experimental_mode = true. Overriding one at a time on the app-server command line:

    Override Completed
    none 1/10
    features.multi_agent_v2.usage_hint_enabled=false 1/2
    features.multi_agent=false 1/2
    features.context_management.experimental_mode=false 0/3

    The samples are too small to say that the multi-agent settings matter. Early stops still happen with them off.

    Summary

    Trigger as I now understand it: turn effort differs from thread effort, on a long task with large inputs. It raises the chance of the model ending the turn early from zero observed cases to most runs on my Windows machine. The workaround is unchanged: make the thread effort equal to the turn effort.

  7. Anfet commented on Nov 13, 2026

    @Anfet

    Additional data from another setup. Here the early stop also happens for spawn_agent children, not only on the app-server path.

    Environment: Windows 10 (10.0.19045), codex-cli 0.167.1, multi_agent_version: v2, approval_policy: never, full access. Two launch paths:

    • spawn_agent children of a VS Code extension thread, fork_turns: "none", model and effort set per child;
    • top-level threads started by a bare stdio codex app-server client (thread/start + turn/start).

    What counts as an early stop: the turn ends with a final message saying the work is not done, the code is unchanged, and there is no blocker. No patch is applied in that turn.

    Counts, 12–14 Nov, one account, three repositories:

    Launch path Executor sessions With an early stop Models of the early stops
    spawn_agent child (VS Code thread) 41 7 terra low ×7
    app-server top-level thread 26 8 terra low ×5, luna high ×2, terra medium ×1

    One task, repeated. Card A was given to gpt-6.1-terra low 7 times:

    • 5 spawn_agent children, each 1.5–3.8 min, 11–37 requests;
    • after that, 1 app-server thread with 2 turns. Before it, a gpt-6.1-sol high session wrote a concrete implementation approach into the task file.

    None of these runs finished card A. Final messages, translated: "TODO; implementation and checks not performed; worktree created, no code, no commit". "Not done; code unchanged; concrete blocker not established". "NOT FINISHED; stubs added, not wired; no confirmed blocker".

    Card B: a terra low child returned "TODO, implementation not done, no confirmed external blocker" three times. The fourth turn produced the change.

    Other cards of similar size, with the same model and effort, completed normally. These are counts from one account, not a failure rate. I can share rollout excerpts with session ids if useful.

    Side observation (not verified, please confirm or correct). ~/.codex/hooks.json has PreToolUse hooks with matchers spawn_agent and wait_agent; the spawn_agent hook appends a log line on every call. Across dozens of spawn_agent launches on 0.162–0.167.1 that log was never created, while PreToolUse hooks for shell commands (including commands run inside the code-mode exec tool) do run. So it looks like PreToolUse does not fire for collaboration tools, or they are matched under a different (namespaced) name. Is PreToolUse expected to cover spawn_agent / wait_agent, and if so, what matcher name should be used?

  8. baktiaditya commented on Nov 27, 2026

    @baktiaditya

    Another data point, codex-cli 0.172.0 (TUI), Linux, full access, gpt-6.1-terra high.

    • Turn 1: an implementation task. The rollout has {"type":"configuration_update","reasoning":{"effort":"high"}} right after the user message (the model had been switched with /model earlier in the thread). Terra created a worktree, installed dependencies, and ended the turn after 1m11s with no code. Its final message named an open technical point that the task itself covered, and no blocker.
    • Turn 2: a follow-up prompt in the same thread, same model and effort. No configuration_update item in the rollout. It worked for 14m, wrote the code and tests, and opened the PR.

    One pair, so it proves nothing alone, but it matches the configuration_update trigger described above. Feedback uploaded with logs; thread ID 01a21afd-92be-7ca1-940d-346bb63c002f.

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

    app-serverbugmodel-behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions