Skip to content

VS Code extension: repeated edits of a previous message duplicate hidden context and exhaust context window #20347

@StevenTan

Description

@StevenTan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcontextIssues related to context management (including compaction)extensionIssues related to the VS Code extensionsessionIssues involving session (thread) management, resuming, forking, naming, archiving

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions