Skip to content

Interrupted turns aren’t recorded in history, causing follow-up turns to repeat aborted work #9042

@swordfish444

Description

@swordfish444

Summary

When a turn is interrupted (Stop / Ctrl+C), Codex emits a TurnAborted event but does not record any model-visible marker into the conversation history. On the next user turn, the model can’t tell the previous work was aborted and may resume/repeat earlier actions (including re-opening PRs).

Steps to reproduce

Start a user turn that triggers a tool call with side effects (e.g. git push, gh pr create, or any write).
Interrupt the turn while the tool is still running.
On the next user turn, ask Codex to do something else.
Observe that Codex may repeat the aborted work from the previous turn.

Expected

After interrupting, follow-up turns should not automatically continue/repeat work from the aborted turn unless the user explicitly asks.

Actual

Follow-up turns sometimes pick up the aborted plan and repeat earlier steps; this can cause duplicated side effects (e.g. a second PR for the same change).

Notes / suspected fix

Record a hidden, model-visible marker in history when a turn is interrupted (e.g. <turn_aborted>…</turn_aborted>), and treat it like <environment_context> (session prefix) so it doesn’t change user-turn boundaries/prompt caching. The marker should instruct the model to avoid continuing/repeating aborted work unless explicitly requested and to verify state before retrying.

Related but distinct: #8310 (resume-after-rate-limit drift/repeat).

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentIssues related to the core agent loopbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions