codex - 💡(How to fix) Fix Unexpected background task spawning and severe usage drain in VS Code Codex extension [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#18358Fetched 2026-04-18 05:55:18
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×3cross-referenced ×2closed ×1commented ×1

Error Message

  • one of those background sessions ended with a sandbox policy mismatch error

Root Cause

Because of this behavior, a small number of normal user interactions can end up consuming most or all of the available usage limit.

RAW_BUFFERClick to expand / collapse

What issue are you seeing?

In the VS Code Codex extension, a normal user task appears to trigger additional background tasks or subagent sessions that I did not explicitly start.

The main problem does not appear to be that the original prompt itself is unusually expensive. Instead, the original task completes, and then separate background work starts afterward and consumes a large amount of usage.

Based on the local rollout evidence, this background activity appears to be related to internal memory handling or memory consolidation work.

What steps can reproduce the bug?

  1. Open VS Code and the Codex extension.
  2. Start a new chat or thread.
  3. Send a normal prompt.
  4. Wait for the main response to complete.
  5. Observe that usage may continue increasing afterward.
  6. Inspect local rollout or session artifacts.

In my case, after the main task completed, separate background sessions were created under ~/.codex/memories, including sessions with source.subagent="memory_consolidation".

What is the expected behavior?

A normal user task should only run the work directly associated with that task, unless the product clearly indicates that additional background work is being started.

If Codex starts background tasks automatically, the IDE should clearly show:

  • that those tasks were started
  • what they are
  • whether they are still running
  • how much usage they are consuming

Hidden or unclear background tasks should not be able to drain most of the user's usage.

Additional information

I collected local rollout evidence showing that:

  • the original user task completed normally
  • separate background sessions were started afterward
  • at least one of those background sessions ran much longer and consumed substantially more usage
  • one of those background sessions ended with a sandbox policy mismatch error

Because of this behavior, a small number of normal user interactions can end up consuming most or all of the available usage limit.

The usage drain appears to be a consequence of unexpected background task spawning, rather than the direct cost of the visible user prompt alone.

extent analysis

TL;DR

The issue can be mitigated by investigating and potentially disabling or optimizing the automatic memory consolidation tasks spawned by the Codex extension in VS Code.

Guidance

  • Investigate the ~/.codex/memories directory to understand the nature and frequency of the background sessions, especially those with source.subagent="memory_consolidation".
  • Review the Codex extension settings in VS Code to see if there are any options related to memory handling or background task management that can be adjusted or disabled.
  • Monitor the usage consumption and task activity after sending a prompt to identify patterns or triggers for the excessive background activity.
  • Consider reporting the sandbox policy mismatch error as a separate issue, as it may be related to the background task spawning or usage drain.

Example

No specific code snippet is applicable in this case, as the issue appears to be related to the extension's internal behavior rather than user code.

Notes

The root cause of the issue seems to be related to the Codex extension's memory handling and background task management. However, without more information about the extension's internal workings or access to its source code, it's difficult to provide a definitive fix.

Recommendation

Apply workaround: Investigate and potentially disable or optimize the automatic memory consolidation tasks, as this appears to be the most direct way to address the usage drain issue. This approach may help mitigate the problem until a more permanent fix is available.

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