codex icon indicating copy to clipboard operation
codex copied to clipboard

Codex App: benchmark-driven context-drift warning and one-click HANDOFF.md migration to a new task

Open coutinhomaigishiri-eng opened this issue 4 months ago • 8 comments

What variant of Codex are you using?

Codex App for Windows, version 26.727.6591.0.

What feature would you like to see?

Summary

Please add a benchmark-driven context-continuity warning and a one-click handoff to a fresh Codex task.

When OpenAI's long-session testing indicates that repeated compaction is approaching a meaningful risk of context drift, Codex should:

  1. warn the user that continuing in the current task may reduce continuity;
  2. let the user choose a handoff-summary depth (10%, 50%, or 100%);
  3. generate a user-reviewable HANDOFF.md;
  4. create a new Codex task;
  5. make the new task automatically read and acknowledge the handoff; and
  6. open the new task for the user so work can continue immediately.

Problem observed in real use

In a long Codex App task with hundreds of exchanges and many automatic compactions, I observed that:

  • the task became slower and consumed more usage as the context remained full;
  • the broad objective often survived, but detailed agreements, user corrections, assistant commitments, completed-versus-pending state, and the exact next action could gradually drift;
  • setting a persistent goal helped, but did not fully solve the continuity problem;
  • manually moving to a new task did not transfer the complete working context;
  • reconstructing the old task required reading it by task ID, paging through history, and expanding long turns, and assistant messages could still be missed.

A single task can compact many times—even hundreds—so compaction count alone should not be treated as failure. Users also should not be expected to guess a universal safe number.

OpenAI should stress-test representative long-running, tool-heavy tasks across models and task types to measure when repeated compaction begins to cause meaningful continuity degradation. The product can then use those measured results to decide when to show an advisory handoff prompt. The trigger may be dynamic rather than one hard-coded number.

Proposed user flow

1. Detect a tested continuity-risk boundary

Use official long-session regression tests to evaluate whether Codex still preserves:

  • the active objective and acceptance criteria;
  • recent user corrections and constraints;
  • decisions and rejected approaches;
  • completed work and its evidence;
  • assistant commitments that were stated but not executed;
  • unresolved work and the exact next action.

When continuity risk reaches a tested threshold, show a non-blocking prompt such as:

This task has been compacted repeatedly and may begin losing working context. Create a handoff to a new task?

This should be a recommendation, not a forced cutoff after an arbitrary number of compactions.

2. Let the user choose handoff depth

Offer three clear choices:

  • 10% — Compact handoff: current objective, current state, blockers, and next action.
  • 50% — Standard handoff: current phase plus major decisions, corrections, evidence, completed work, and pending work.
  • 100% — Full-history handoff summary: summarize the interaction from the beginning through the current turn, including important user requests, assistant commitments/actions, decisions, evidence, and unresolved items.

The percentages describe summary coverage/detail, not a promise to copy the raw transcript word-for-word.

3. Generate HANDOFF.md

The handoff should be user-reviewable and contain, at minimum:

  • current goal and scope;
  • durable constraints and permissions;
  • major decisions and rejected approaches;
  • completed work with evidence;
  • assistant promises not yet executed;
  • current files/artifacts and their status;
  • unresolved questions or blockers;
  • exact next safe action.

4. Create, initialize, and open the new task

After the user confirms:

  • create a fresh Codex task;
  • preserve a link back to the original task;
  • automatically supply/read HANDOFF.md in the destination task;
  • have the destination task confirm what it inherited before acting;
  • open/jump to the destination task automatically;
  • keep the original task intact and available for audit.

The user should not need to copy and paste, enter an old task ID, page through the old conversation, or manually expand every long turn.

Expected result

The user gets fresh context headroom without losing the working state of a long task. Handoff becomes a first-class product workflow instead of a manual recovery procedure.

Related issues

These cover important parts of the problem, but not the complete App workflow above:

  • #29356 — context compaction can lose operational continuity;
  • #34095 — repeated compaction can degrade the execution frontier;
  • #22220 — compaction telemetry/context health;
  • #33310 — atomic handoff during context rollover;
  • #35032 — compaction may leave too little usable headroom.

This request specifically combines a tested drift-risk prompt, user-selectable summary depth, automatic HANDOFF.md generation, and one-click creation/opening of a new initialized Codex task.

Additional information

OpenAI recently described retained reasoning and compaction as settings used in ChatGPT and Codex, and showed that they improved continuity and efficiency in a long-running ARC-AGI-3 harness. This request does not argue against compaction; it asks for a product-level safety valve when very long, repeatedly compacted tasks begin to lose continuity:

https://openai.com/index/how-two-settings-tripled-our-arc-agi-3-scores/

coutinhomaigishiri-eng avatar Aug 02 '26 10:08 coutinhomaigishiri-eng

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

  • #35935

Powered by Codex Action

github-actions[bot] avatar Aug 02 '26 10:08 github-actions[bot]

Strong +1. I have built a user-space GPT Courier workaround for this exact gap. The useful first-party primitive would be a manual checkpoint available at any time—not only at a measured threshold—that records the objective and constraints, decisions, completed and pending work, blockers, relevant artifacts, repository/worktree identity, Git HEAD and dirty state, tests, and the exact next action.

It should then create and open a successor task and ask it to acknowledge the handoff, while leaving the original task intact for audit. This is complementary to fixing compaction itself: handoff should be a safe escalation path, not a substitute for preserving state. Summaries should not be treated as proof that code or tests completed.

barcuchj avatar Sep 01 '26 09:09 barcuchj

I’d like a “Continue in a fresh chat” button on every Codex App session. I’m tired of repeatedly typing the same handoff instructions.

The button should:

  1. Prepare and transfer the context needed to continue the current work into a fresh chat.
  2. Keep the new chat in exactly the same sidebar section as the original.
  3. Preserve the exact same title, without automatically renaming it or adding a suffix.
  4. Open the new chat so I can continue immediately.
  5. Archive the original session only after the new chat has been created successfully and received the handoff.

If any step fails, the original should remain available and unarchived. Its history should stay recoverable after a successful handoff.

Please make this a manual action available anytime. The goal is to replace a session cleanly without repeatedly writing a prompt, reorganizing the sidebar, renaming the new chat, and archiving the old one myself.

doyourbest414-coder avatar Oct 13 '26 03:10 doyourbest414-coder

The Oct 13 request for a one-click “Continue in a fresh chat” is a good confirmation that the handoff should also be a manual action available at any time, not only something triggered by an automatic risk threshold. The key invariant remains: create and initialize the successor successfully before changing or archiving the original, and keep the original recoverable for audit.

barcuchj avatar Oct 19 '26 13:10 barcuchj

I'd like to add a related use case: recovery from agent perseveration/repetition loops.

In long-running Codex sessions, the agent can keep repeating the same unsuccessful implementation or plan even after explicit user corrections. /compact may retain the assumptions driving the loop, while /new drops useful task progress. The current workaround is to ask the stuck session to write a handoff manually, then paste it into a fresh session.

Please consider an optional /handoff or “Fresh start with progress” action that:

  • Extracts only the current goal, latest user direction, verified changes, unfinished tasks, essential constraints, and relevant file pointers.
  • Explicitly excludes failed attempts, repetitive reasoning, superseded assumptions, and stale plans.
  • Shows a short reviewable summary before creating the new session.
  • Starts the new session from that summary, without undoing existing project files or progress.
  • Optimizes for a concise, low-token handoff rather than copying the entire conversation.

The key distinction from ordinary compaction is a deliberate fresh reassessment of the approach while preserving verified work. This would make recovering from a stuck agent much simpler.

j2-ui-hub avatar Oct 31 '26 04:10 j2-ui-hub

I'd like to add a related use case from my experience with both ChatGPT and Codex, particularly ordinary ChatGPT conversations used for long-running technical projects.

I generally prefer to keep one major topic or project within a single conversation. This helps maintain focus, preserve previous decisions, and reduce the risk of mixing unrelated project contexts.

However, some of my technical investigations have already extended across multiple conversations because earlier conversations reached their maximum length. When starting a replacement conversation, I sometimes need to explicitly identify which previous conversation it should continue and restate important background information.

I've also introduced local project-context files, task history, and handoff records into my Codex workflow to reduce reliance on individual conversations. These workarounds are useful, but I think there is an opportunity to make conversation continuity a native product capability.

An additional option: source-indexed conversation continuation

Building on the proposed one-click HANDOFF.md workflow, I would suggest:

  • Offer a Continue in a linked conversation action alongside the existing new-chat option, including when a conversation reaches its hard length limit.
  • Establish an explicit, persistent relationship between the original and successor conversations.
  • Generate a concise, user-reviewable handoff containing the current objective, confirmed decisions, constraints, completed work, pending work, unresolved questions, and next steps.
  • Associate important handoff entries with stable references to their original conversation and messages.
  • Allow the successor conversation to retrieve relevant original messages on demand, rather than loading or summarizing the entire conversation again.

The continuation action could also be available before the length limit is reached, allowing users to choose an appropriate transition point themselves.

Context handoff approaches

Users could choose how much context to carry into the successor conversation:

Approach Context transferred
Original conversation reference An explicit reference to the predecessor conversation.
Structured summary A concise, reviewed summary of the current working state.
Structured summary + source index A reviewed summary with stable references to relevant original messages.

The third approach is particularly interesting to me because a summary, while useful, is inherently lossy.

If an important detail is missing or ambiguous, the assistant should be able to consult the original evidence instead of confidently reconstructing it from incomplete context.

For example, a handoff might say that a Git commit was approved, while the original user instruction explicitly prohibited pushing to the remote repository. Retrieving the original instruction could prevent a misunderstanding about the scope of that approval.

Historical approval should not automatically be treated as current authorization. The assistant should still consider the latest user instructions and actual project state before acting.

If an original message has been deleted or is no longer accessible, the assistant should clearly acknowledge that limitation rather than reconstructing the missing evidence from the summary.

Conversation continuity

Successive conversations could form an explicit conversation chain associated with the same long-running topic or project.

Each conversation would retain its own history, while a lightweight index could help users and assistants locate relevant decisions, constraints, and evidence across earlier conversations.

This is different from ordinary conversation branching. A continuation carries the same work forward, while a branch generally explores a separate but potentially related topic.

The approach could potentially reduce unnecessary context processing while improving traceability, although the actual performance and cost benefits would need to be measured.

The handoff should remain available even after the original conversation reaches its hard limit, and historical references should respect the user's existing access and deletion controls.

Interactive concept prototype

I have published an interactive prototype to illustrate how these ideas could work together:

Linked Conversation Continuation

https://forgottenlab.github.io/demo-gallery/demos/conversation-continuation/

The prototype demonstrates:

  • A simulated conversation-length limit and the distinction between starting an ordinary new chat and creating a linked continuation.
  • Three context handoff approaches.
  • Reviewable and editable handoff summaries.
  • Explicit relationships between successive conversations.
  • Source-indexed retrieval of original messages.
  • Verification of historical decisions and authorization boundaries.
  • Handling unavailable sources when messages are deleted or access is revoked.
  • A multi-conversation chain and a layered context-retrieval model.

This is an independent, client-side concept prototype using fictional data and simulated interactions. It does not access real ChatGPT or Codex conversations, connect to AI models, or execute Git operations.

Related proposals

I see this as complementary to the original proposal, as well as:

  • Discussion #28865 — Message identifiers and selective context transfer. https://github.com/openai/codex/discussions/28865
  • Issue #41531 — Recovery and handoff after a hard conversation-length limit. https://github.com/openai/codex/issues/41531

The goal is not to make every conversation unlimited or to carry all historical context into every new session.

It is to allow users to continue the same line of work with fresh context, a reliable handoff, and a clear path back to the original evidence.

forgottenlab avatar Nov 29 '26 10:11 forgottenlab

I build Concord, and the "write a handoff, start a fresh task, have it read and acknowledge" loop you describe is one of the flows it covers. Concord MCP is an open-source, local MCP server that Codex (and Claude Code, Cursor and others) can connect to. Instead of only a HANDOFF.md, the long task records the decisions it made and the current state of the work as it goes, then hands off with the last commit and test result.

The new task reads that shared state on start, so it isn't depending on a summary written after many compactions, and the decisions stay available to every later task in the project, not only the next one. It's not the one-click built-in flow you're asking for, but it works with Codex today. Happy to try one real handoff with you if you want to see it on your long-running project.

alexechoi avatar Nov 30 '26 09:11 alexechoi

Thank you for introducing Concord and for offering to try a real handoff together!

I've taken some time to explore your repository and documentation. I particularly appreciate the idea of recording decisions and working state throughout a task, rather than relying entirely on a handoff summary generated after repeated context compaction.

I'd also like to clarify a distinction in my original comment.

For my local Codex workflow, I already maintain a persistent governance and context-management system through AGENTS.md, a project-local .ai/ directory, task history, execution evidence, and handoff records.

I've documented part of this approach in my open-source project:

https://github.com/forgottenlab/codex-agents-playbook

When I start a new Codex conversation within the same project, the successor can generally reconstruct the working context from these persistent records, provided that they have been maintained correctly.

The particular gap I was trying to highlight in my comment is more pronounced in ordinary cloud-hosted ChatGPT conversations.

Some of my long-running technical investigations take place primarily in ChatGPT rather than Codex. When a conversation reaches its length limit, I cannot rely on the same project-local persistence mechanism to continue the conversation. This is why I'm interested in native conversation relationships, source-indexed handoffs, and selective retrieval of original messages.

That said, Concord has introduced me to another valuable approach to persistent task state. Its structured records, shared work-state, and agent-to-agent coordination appear to be complementary to my existing governance system, rather than necessarily replacing it.

I'd be happy to follow the project's development and try it in practice. I could initially set up an isolated environment, such as a clean virtual machine, to explore the workflow without affecting my existing Codex configuration. From there, I'd be interested in testing a representative handoff and evaluating how Concord could coexist with my current project-level rules and persistent context records.

I'd also be interested in your perspective on whether some of Concord's underlying design principles could inform a native conversation-continuation mechanism for cloud-hosted AI assistants, even though the environments and access boundaries are different.

Thank you again for sharing your work. I appreciate the additional perspective, and I'd be interested in exchanging practical findings as I explore the project.

forgottenlab avatar Nov 30 '26 11:11 forgottenlab