Skip to content

Context compaction causes task drift: assistant reverts to stale prior request and executes unrelated command #11315

Closed as duplicate

Description

@JLarM2Utah

What version of the Codex App are you using (From “About Codex” dialog)?

CODEX plugin in VS Code - GPT5.3 Codex

What subscription do you have?

Plus

What issue are you seeing?

Product: Codex coding agent (GPT-5 based) in IDE workflow
Environment: Windows, PowerShell, local repo workspace
Date observed: [fill your local timestamp + timezone]
Frequency: Intermittent but reproducible after “Context automatically compacted”

Summary:
After “Context automatically compacted” appears, the assistant may acknowledge my current prompt correctly, then later revert to a prior request from recent history and execute unrelated actions.

What happened:

  1. I sent this prompt:
    “our standard table needs to have access to a data layer that has columns that are hidden but can be used by the presentation layer to drive behavior.....”

  2. Assistant initially responded correctly:
    “You want hidden data available to table behavior without rendering those columns...”

  3. Soon after another “Context automatically compacted” appeared.

  4. Assistant then switched to a stale prior task and executed unrelated command flow:

    • “I’ll push main again now so the latest fix is definitely on origin...”
    • Ran: git push origin main
    • Reported: “Everything up-to-date”
    • Continued with unrelated Vercel redeploy/env-var guidance

Expected behavior:

  • After compaction, assistant should remain scoped to the latest user prompt.
  • No unrelated command execution from stale context.
  • If confidence is low after compaction, assistant should ask for confirmation before taking actions.

Actual behavior:

  • Task drift to previous request.
  • Unrelated terminal action executed.

Impact:

  • Trust/safety issue for coding workflows.
  • Risk of unintended repository actions.
  • Requires user to manually detect drift and stop execution.

Evidence snippets:

  • “Context automatically compacted”
  • Correct intent acknowledgment for hidden data requirement
  • Later unrelated action: “I’ll push main again...”
  • Command executed: git push origin main

Please investigate context-merging logic around compaction and guardrails for tool/action selection after compaction.

What steps can reproduce the bug?

Codex chat thread with a lot of history

What is the expected behavior?

Stay on the current prompt

Additional information

No response

Activity

  1. added
    app
    on Feb 10, 2026
  2. human-bee commented on Feb 10, 2026

    @human-bee

    this also seems to be happening to me. codex 5.2 has a slight regression on auo-compaction, cuasing it to work on things it had finished previously.

  3. MisterRound commented on Feb 10, 2026

    @MisterRound

    Compaction is the biggest weak-point as of current. The current implementation is suboptimal in many regards. It wastes a huge amount of tokens re-auditing, and then when you get "caught up" to the actual task, you've already burned through half the context window just to proceed with the current task. It doom loops through this. Compaction is critical, it's not enough to just say "use short tasks in individual agents" when you're working on something deep context. I think the entire summary compaction process needs a page one overhaul as it's literally regressive yet critical.

  4. nullbio commented on Feb 28, 2026

    @nullbio

    Came here to see if this was being spoken about.

    I send my agent on some long-running task and tell it to do a sequence of steps (let's call them steps 1, 2 and 3). It completes most of those steps (1 and 2) and begins the longer-step (3).

    It gets half way through 3 and compacts.

    The agent then re-does step 1 after compacting when step 1 was already completed before, and it doesn't continue where it left-off with the half finished step 3.

  5. ThinkOffApp commented on Mar 13, 2026

    @ThinkOffApp

    We see this across 100K+ token sessions daily with multiple agents. Our mitigation: agents poll an external room (GroupMind) and re-read their instructions on each cycle rather than trusting conversation history. When compaction drops context, the agent's next poll picks up the current task from the shared room state. User Intent Kit adds another layer: a live "intent" signal that authoritatively says what the user wants right now, surviving any number of compactions. The problem is fundamental: critical state cannot live only inside the context window.

  6. mahdikayvan commented on May 8, 2026

    @mahdikayvan

    @JLarM2Utah Hey — I saw your compaction drift issue, and it looked very close to the exact pain I’m trying to solve.

    I’m building AgaveCore, and I’d like to let a few early people use it for free while I shape it into something stronger.

    It helps when a coding agent starts to drift, forget important progress, or gives you an output you do not fully trust.

    In practice, it works through two habits:

    • tell the agent to remember-progress or remember-this when something important should not be lost
    • use consult-brain when the current task needs more grounded feedback on what to do next

    Over time, as useful journals, decisions, and failures pile up, the product should help the agent make sharper decisions and take better actions with less drift.

    If this sounds relevant, reply here and I’ll send the exact steps. You can also use the email or Telegram on my profile.

    Cheers,
    Mads.

  7. added
    bug
    context
    and removed
    app
    on May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcontext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions