Skip to content

Active Goal is lost after automatic context compaction and Codex resumes previously completed tasks #49022

Open

Description

@yeatdev

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

26.917.71314

What subscription do you have?

ChatGPT Business

What platform is your computer?

Linux 7.0.0-34-generic x86_64

What issue are you seeing?

When working in a long Codex conversation, the active Goal can sometimes be lost after automatic context compaction.
For example, I may work in the same conversation for about an hour and solve problems X and Y. I then encounter a more complex problem Z, so I start a new Goal specifically for Z and explain what needs to be done.
Codex initially behaves correctly: it starts the Goal, scans the relevant files, and begins working on problem Z. However, after the message indicating that the context was automatically compacted appears, Codex can lose track of the active Goal and return to an older problem from earlier in the conversation, such as problem Y, even though that problem has already been completed.
As a result, Codex may start working on previously completed tasks instead of continuing with the currently active Goal.
I have encountered this behavior multiple times recently.

What steps can reproduce the bug?

1 - Work in the same Codex conversation for an extended period of time.
2 - Complete several tasks/problems in that conversation (for example, problems X and Y).
3 - Start a new Goal for a different and more complex problem (problem Z).
4 - Let Codex work on the Goal until automatic context compaction occurs.
5 - After the context is compacted, Codex may lose track of problem Z and resume working on one of the previously completed problems.

What is the expected behavior?

The currently active Goal should remain the primary objective even after automatic context compaction.
Context compaction should preserve the active Goal and its current progress. Previously completed tasks from earlier in the conversation should not become active again unless they are explicitly relevant to the current Goal.

Additional information

This seems specifically related to automatic context compaction rather than the initial Goal creation. The Goal starts correctly and Codex initially understands the task, but the loss of focus happens after the context is compacted.

Activity

  1. added
    app
    on Sep 28, 2026
  2. added
    bug
    context
    model-behavior
    on Sep 28, 2026
  3. github-actions commented on Sep 28, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  4. xcreyentex-byte commented on Oct 8, 2026

    @xcreyentex-byte

    Hey, I read your report about Codex losing the current goal after context compaction and returning to tasks you'd already completed.

    I have a possible workaround that might help with this. If you're interested, I'd be happy to share it. And if it doesn't fit your situation, I'd like to understand more about what's happening so we can see whether there's a way to address it.

  5. 120L021326 commented on Oct 10, 2026

    @120L021326

    Additional occurrence on Windows Codex Desktop 26.1007.2314.0, observed on 2026-10-10. This substantially affects my experience with Goal mode: two automatic research turns did real work, but both final responses answered an unrelated question that had already been resolved.

    Environment

    • Installed Windows desktop package: OpenAI.Codex 26.1007.2314.0 (read from installed package metadata, not the About dialog).
    • Session-recorded runtime cli_version: 0.162.0-alpha.17.2; originator: Codex Desktop.
    • Model: gpt-6.1-sol.
    • Windows 11 x64, OS build 10.0.26300; PowerShell.
    • A long-running conversation with automatic Goal continuation and mid-turn context compaction.

    Observed scenario

    This is a history-verified occurrence in an existing conversation, not a separately reproduced deterministic minimal test.

    1. Ask a separate operational question about exceeding a persistent-storage quota when shutting down a server.
    2. Receive a complete answer.
    3. Start a Goal to continue research idea exploration and experiments.
    4. Let an automatic Goal turn make progress and reach automatic context compaction.
    5. After compaction, the assistant rechecks the already answered storage question and ends with another answer to that question.
    6. Let the next automatic Goal turn continue. It makes further research progress, compacts, and again ends by answering the same old storage question.

    Two recorded transitions

    All timestamps below are UTC on 2026-10-10.

    Automatic Goal turn Compaction event First user-facing response after compaction Final answer
    First 03:20:52.952 03:21:09.252 — returns to the old storage question 03:22:11.580 — storage answer
    Second 03:50:22.887 03:50:42.465 — rechecks storage rules 03:51:40.426 — storage answer

    Read-only inspection of the local session records confirmed:

    • Both turns were actually triggered by Goal continuation and received the intended research objective at their start.
    • Research tool actions and progress messages occurred before each compaction. The first turn completed a diagnostic; the second performed another diagnostic and obtained a negative result.
    • Both compaction records still had resume_metadata.turn_attribution.turn_trigger: "goal".
    • Both readable replacement_history lists contained 37 items, with the older storage question as the latest ordinary user message. Neither retained a standalone readable Goal continuation message.
    • The histories also contained an encrypted compaction item. Its semantics could not be inspected.
    • The two final answers were newly generated, differed in wording, and were preceded by new document-checking tool calls about the old question. This was not simply an old response being visually replayed.

    Expected behavior and impact

    After compaction, the active Goal should remain the execution target. The final response should report the work and findings from that Goal turn, including unfinished work. An already answered question should remain historical context unless I bring it back.

    Instead, approximately 24- and 29-minute automatic turns ended with irrelevant repeated answers. This concealed useful progress from the final responses and made it difficult to trust whether Goal mode was still following the objective. I had to pause the Goal and request an audit of the recent turns.

    Diagnostic limits

    The encrypted compaction payload prevents concluding that the Goal was completely absent from restored model context. This report establishes a repeated behavioral failure immediately after compaction, not the root cause in a particular component. It may relate to #32922, but this occurrence alone does not verify the same implementation cause.

    The public report is intentionally sanitized: no raw transcript, private project paths, credentials, server endpoints, private identifiers, or research data are attached.

  6. I3eka commented on Oct 12, 2026

    @I3eka

    Additional evidence from my October 7, 2026 occurrence: after compaction, get_goal successfully returned the correct active objective, but the final response still prioritized an already answered question. This is the same incident documented in my full sanitized report, linked here because that detail may help distinguish task-priority drift from deletion of persisted goal state.

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

    The exact App/About build and interface used to set the goal were not captured. The session records runtime 0.160.1, source: vscode, and originator: codex-tui. The installed CLI and running app-server also reported 0.160.1 when checked on October 7. These values do not establish a Desktop App build or a controlled CLI-only reproduction.

    What subscription do you have?

    ChatGPT-authenticated account; plan identifier prolite, recorded in the affected turn and independently confirmed through account/read on October 7. The commercial plan label was not established.

    What platform is your computer?

    Reporting-time execution host: Ubuntu 22.04.5 LTS. uname -mprs:

    Linux 5.15.0-185-generic x86_64 x86_64
    

    The OS of any separate frontend was not captured.

    What issue are you seeing?

    A completed ordinary question A regained priority after automatic compaction during a distinct goal B. All times below are UTC on October 7, 2026:

    Time Recorded event
    09:08:05 Final answer to A completed.
    09:10:08 Native goal continuation started B; investigation and findings followed.
    09:22:58 Automatic compaction occurred during that goal turn.
    09:23:09 First response after compaction returned to A's framing.
    09:23:13 get_goal successfully returned B with status: active.
    09:27:42 After further work on B, update_goal marked B complete.
    09:28:08 Final answer still led with A, then included B's findings and artifacts.

    No new ordinary user message arrived between starting B and that final answer. Work on B did continue, so the observed failure is partial task drift and a mixed final response. Persisted goal state remained available.

    What steps can reproduce the bug?

    Observed workflow; an independent deterministic minimal reproducer has not been established:

    1. Finish question A in a long-running conversation.
    2. Set a distinct goal B through native goal continuation.
    3. Let B progress until automatic compaction.
    4. Check whether the first response and final answer revert to A despite get_goal returning B.

    The first goal request recorded 189,435 input tokens against a 258,400-token context window, approximately 73%. This is a request count, not a measured compaction threshold or UI percentage. No goal token budget was recorded.

    What is the expected behavior?

    The active goal should remain the current task after compaction. Retrieving the correct active objective should restore its priority for subsequent work and the final answer; the previously answered question should remain historical unless raised again.

    Additional information

    • Model: gpt-6-astra; reasoning effort: xhigh; provider: openai; collaboration mode: default. Model and effort were unchanged across this compaction.
    • Readable replacement history contained 33 items: 29 user messages, 3 developer messages, and 1 opaque encrypted compaction item. The old question was the last retained ordinary user message; no standalone readable goal-continuation message remained.
    • The encrypted compaction content cannot be inspected from the rollout. This does not prove the goal was absent from all restored model context, or that these occurrences share an identical code-level cause.

    Correlation identifiers:

    thread_id: 01a11081-bae3-7843-ac30-3d083b1f8e4a
    goal_turn_id: 01a115a0-97f0-7e32-843e-94c1fc4ea09e
    compaction_response_id: resp_0884ad102bae5a5e016ac60ec08d2087d2aec9f81dc1ef2221
    

    The linked full report includes the detailed trace and redacted October 7 doctor output. The Community report documents this same occurrence, not another independent reproduction. No raw private transcript is attached.

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

    Linuxappbugcontextmodel-behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions