codex - 💡(How to fix) Fix VS Code extension: repeated edits of a previous message duplicate hidden context and exhaust context window [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20347Fetched 2026-05-01 05:43:50
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1
RAW_BUFFERClick to expand / collapse

What version of the IDE extension are you using?

26.422.71525

What subscription do you have?

ChatGPT Team

Which IDE are you using?

VS Code

What platform is your computer?

Darwin 25.4.0 arm64 arm

What issue are you seeing?

In the Codex VS Code extension, editing a previous user message does not appear to truly replace that message in the conversation state.

The UI makes it look like the previous message was edited/replaced, but the backend/model context seems to retain the original message and append the edited version as a new message. After repeatedly editing the same previous message, the context usage grows very quickly and eventually Codex fails with:

Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.

This looks like hidden conversation history is being duplicated or retained after each edit, even though the visible UI only shows the latest edited message.

This is especially problematic when the edited message contains long repository instructions, such as AGENTS.md content or workflow instructions. Users may believe they are replacing/correcting a previous message, but the model appears to receive multiple historical versions in hidden context.

What steps can reproduce the bug?

  1. Open the Codex VS Code extension.

  2. Send a sample user message.

  3. Edit that same previous user message.

  4. Ask Codex what messages it can see, or observe its behavior/context usage.

  5. Repeat editing the same previous message several times.

  6. Eventually Codex reports:

    Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.

Observed behavior:

  • The UI shows the previous message as if it was replaced by the edited version.
  • However, Codex behaves as if the original message and the edited message both still exist in the model context.
  • Repeated edits appear to accumulate hidden copies of prior message content.
  • Context usage grows rapidly until the thread becomes unusable.

What is the expected behavior?

Editing a previous user message should either:

  1. Replace the original message in the conversation state, so only the edited version is used in future model context; or
  2. Explicitly rewind/fork the conversation from that point, so only the edited message and subsequent messages remain in context.

Repeatedly editing the same visible message should not duplicate hidden context or cause rapid context-window exhaustion.

The visible UI state and the actual model conversation state should remain consistent.

Additional information

No response

extent analysis

TL;DR

Editing a previous user message in the Codex VS Code extension may not truly replace the original message, leading to hidden conversation history duplication and rapid context window exhaustion.

Guidance

  • Verify the issue by repeating the steps to reproduce the bug and observing Codex's behavior and context usage.
  • Check if the issue persists when editing messages with shorter content, to isolate if the problem is specific to long messages like repository instructions.
  • Consider clearing earlier history or starting a new thread as a temporary workaround to mitigate the context window exhaustion error.
  • Investigate if there are any settings or configurations in the Codex VS Code extension that could influence how edited messages are handled in the conversation state.

Example

No code snippet is provided as the issue seems related to the extension's behavior rather than a specific code implementation.

Notes

The root cause of the issue appears to be related to how the Codex extension handles edited messages in the conversation state, but without further details on the extension's internal workings, it's challenging to provide a definitive fix.

Recommendation

Apply the workaround of clearing earlier history or starting a new thread when the context window exhaustion error occurs, as there is no clear indication of a version update that fixes this specific issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix VS Code extension: repeated edits of a previous message duplicate hidden context and exhaust context window [1 comments, 2 participants]