Codex gets lost in the middle of an execution and returns to a context that had already been closed earlier
What version of Codex CLI is running?
OpenAI Codex (v0.115.0)
What subscription do you have?
Plus
Which model were you using?
gpt-5.4
What platform is your computer?
Linux 6.12.74+deb13+1-amd64 x86_64 unknown
What terminal emulator and version are you using (if applicable)?
Konsole Versão 25.04.2
What issue are you seeing?
I’m seeing a context-tracking / task-routing failure in a long Codex session.
After we completed one task thread (sanitizing AGENTS.md files), I intentionally changed to a different topic: improving a local HTML dashboard UI. Codex initially appeared to understand the topic switch, answered correctly about the new UI task, and proposed the correct next implementation step. However, after I replied with a short confirmation ("Faça" / "Do it"), Codex incorrectly resumed the previous AGENTS.md task and reported completion for that older task instead of continuing the active dashboard task.
This is not a shell/tool crash. It appears to be a conversation-state / active-task selection bug where Codex loses the currently active topic and resolves a follow-up instruction against an older task context.
What steps can reproduce the bug?
Uploaded thread: 019cd946-8573-7ca3-9b83-598456eabf44
- Work on task A for a while in a long session.
Example: rewrite/sanitize AGENTS.md files.
- Change topic to task B.
Example: ask about improving an HTML dashboard and how to identify specific interface elements precisely.
- Codex answers correctly for task B and proposes a task-B-specific next step.
In my case, it suggested:
- adding semantic
data-uimarkers - adding an optional visual debug mode
- Reply with a short confirmation such as:
- "Faça"
- "Do it"
- Codex begins by inspecting task-B files, but then jumps back to task A and reports completion for task A instead of implementing task B.
What is the expected behavior?
Once the user has clearly changed topic, and Codex has already acknowledged and responded to the new topic correctly, subsequent short confirmations like "Faça" / "Do it" should apply to the new active task, not to a previously completed one.
Codex should preserve the current active task focus across short follow-up messages, especially when it has already started inspecting files related to the new task.
Additional information
Relevant prompt sequence:
- User asked about a practical way to identify exact HTML interface elements for future UI-edit requests.
- Codex responded with the correct new-topic answer:
- browser inspector
- stable selectors such as
data-ui - Playwright for reproducible validation
- proposal to implement
data-uimarkers + optional visual debug mode
- User then replied: "Faça"
- Codex initially started correctly:
- it read the dashboard HTML
- searched for relevant UI blocks
- But later it returned a completion message about restructuring
/home/andre/projetos-andre/AGENTS.md, which belonged to the previous topic and should have been considered closed.
Impact:
- wrong files may be edited after the user has already moved to a different task
- this is especially risky in long sessions with multiple sequential topics
- the issue seems more likely when the user changes topic implicitly rather than explicitly saying "stop task A and start task B"
There was no explicit runtime exception or tool failure. The issue appears to be incorrect active-context retention and task routing within the conversation.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗