VS Code on Linux: remote compaction fails when context window is full with GPT-6 Astra, leaving thread unrecoverable
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- PR merge metrics
- PR metrics pending
Description
What version of the IDE extension are you using?
newest
What subscription do you have?
Pro
Which IDE are you using?
VS Code
What platform is your computer?
Kubuntu 26.04.1 LTS (Resolute Raccoon) x86_64
What issue are you seeing?
What issue are you seeing?
When using Codex in the VS Code extension on Linux with GPT-6 Astra, long-running threads can reach a state where automatic context compaction fails because the context window is already full.
The UI first shows:
Context automatically compacted
followed by:
Reconnecting 2/2
and then fails with:
Error running remote compact task: Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.
At this point the thread is effectively unusable.
This seems like a catch-22 in the compaction logic:
- The context window becomes full.
- Codex attempts automatic compaction.
- The remote compaction task itself requires context space.
- Compaction fails because the context window is already full.
- The existing thread can no longer recover.
This is particularly problematic for long-running coding sessions, where maintaining the accumulated context is important.
Environment
- OS: Linux
- Editor: VS Code
- Client: Codex VS Code extension
- Model: GPT-6 Astra
- Context management: automatic compaction
- Usage: long-running coding session / large project
Steps to reproduce
-
Open a project in VS Code on Linux.
-
Start a Codex session using GPT-6 Astra.
-
Continue using the same thread for a sufficiently long coding session.
-
Allow the context window to grow until automatic compaction is triggered.
-
Eventually Codex attempts to compact the conversation.
-
The remote compact task fails with:
Codex ran out of room in the model's context window. -
Retrying/reconnecting does not recover the thread.
Expected behavior
Codex should reserve enough context for compaction before the model reaches its hard context limit.
Ideally, automatic compaction should happen proactively before the remaining context becomes too small to perform the compaction itself.
If compaction nevertheless fails because of a context overflow, Codex should have a fallback mechanism that can recover the thread without requiring the user to start a completely new conversation.
For example:
- trigger compaction earlier;
- reserve a context budget specifically for compaction;
- truncate non-essential history before sending the compaction request;
- compact the history in chunks;
- or automatically create a recovery summary and continue the existing session.
A context-management feature should ideally prevent the thread from becoming unrecoverable because the context-management operation itself ran out of context.
Actual behavior
Automatic compaction is triggered, but the remote compact task runs out of context itself.
The session then enters an unrecoverable state and Codex tells the user to start a new thread or clear earlier history.
Additional information
The UI showed:
Context automatically compacted
Reconnecting 2/2
followed by:
Error running remote compact task: Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.
Screenshot attached.
The important part here is that this does not appear to simply be the model reaching its context limit. The recovery mechanism intended to handle that condition is itself failing because the context limit has already been reached.
What steps can reproduce the bug?
I am using the Codex VS Code extension on Linux with GPT-6 Astra.
The issue occurs in long-running Codex threads after the context has grown large enough for automatic compaction to trigger.
Steps:
- Open a project in VS Code on Linux.
- Start a Codex thread using GPT-6 Astra.
- Continue working in the same thread for a long coding session.
- Let the conversation/context grow until automatic context compaction is triggered.
- Codex displays "Context automatically compacted".
- The extension then shows "Reconnecting 2/2".
- The remote compaction task fails with:
Error running remote compact task: Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.
After this happens, retrying does not recover the thread and I can no longer continue the existing session.
There is no small code snippet that reliably reproduces this because the problem appears to depend on accumulated conversation/context size rather than the code being processed.
What is the expected behavior?
Automatic context compaction should occur before the remaining context becomes too small for the compaction operation itself.
Reaching the context limit should not make an existing Codex thread unrecoverable.
If normal compaction cannot run because the context is already too large, Codex should fall back to another recovery method, for example by compacting older history in chunks, temporarily dropping non-essential context, or reserving enough context space for the compaction operation.
After compaction, the existing thread should remain usable and continue normally without requiring the user to start a new thread.
Additional information
Environment:
- OS: Linux
- Editor: VS Code
- Client: Codex VS Code extension
- Model: GPT-6 Astra
- Context management: Automatic compaction
- Workload: Long-running coding session in a large project
The exact error shown by the extension is:
Error running remote compact task: Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.
Immediately before the error, the UI shows:
Context automatically compacted
and:
Reconnecting 2/2
I have attached a screenshot showing the error.
The unusual part is that the mechanism intended to recover from a large/full context appears to run out of context itself.
This creates a catch-22:
Full context -> automatic compaction -> compaction runs out of context -> thread cannot recover.
Starting a new thread is possible, but that loses the accumulated conversational context from a long coding session, so it is not an ideal workaround.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by tracing the VS Code extension's automatic-compaction and reconnect flow, then reproduce a long-running GPT-6 Astra thread until the reported error appears. Done means a full-context thread can recover and continue without requiring a new conversation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vscode
- Domain
- ai, devtools
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100