Prompts: prevent GPT-5.1/5.2 from ending turns after tool preambles #7923
+16
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
With
gpt-5.2(especially at higher reasoning effort), Codex CLI can emit a short progress/preamble message (e.g. “Next, I’ll …”) and then yield back to the user without emitting any tool calls. Because the CLI only continues an agent turn when tool calls are emitted, this stalls multi-step work and forces manual “continue” nudges.This PR updates the GPT-5.2 (and GPT-5.1 for parity) system prompts to explicitly forbid “dangling” preambles and require issuing tool calls in the same assistant turn.
Problem
Observed behavior:
Expected:
Root cause (why this happens)
Codex CLI’s agent loop continues a turn only when the model emits tool calls. Pure text updates are treated as “end of turn”.
The current GPT-5.x prompt strongly encourages short “next I’ll …” style progress updates, but doesn’t clearly state that such preambles must not be a standalone turn.
gpt-5.2sometimes treats the preamble as a separate phase and stops before emitting tool calls.This appears consistent with a broader class of similar “agent stops while it still has a plan” issues, and matches recent reports specifically for
v0.71.0+ GPT‑5.2.Changes
codex-rs/core/gpt_5_2_prompt.md: clarify “heads-down” guidance and add an explicit rule to avoid standalone preambles and to emit tool calls immediately in the same response.codex-rs/core/gpt_5_1_prompt.md: mirror the same clarification to keep behavior consistent across GPT-5.1 and GPT-5.2.Related issues
Fixes #7900
Related: #5264, #6277
Test plan
N/A (prompt-only change)
Notes