openai / openai/codex

Support message-boundary and range-based context compaction

Open
#38,953 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app context enhancement
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

Codex app

What feature would you like to see?

I would like Codex to support user-controlled, message-boundary context compaction.

From any message in a conversation, users should be able to:

  • Compact everything before this message
  • Compact everything after this message
  • Select a range of messages to compact

Messages outside the selected range should remain unchanged. Ideally, Codex should also allow users to preview and edit the generated summary before applying it, and provide an option to undo the compaction.

Possible UI actions:

  • Compact messages above
  • Compact messages below
  • Compact selected range

At the API level, this could be represented using parameters such as beforeTurnId, afterTurnId, or startTurnId / endTurnId.

This would provide more precise context management than the current thread-level /compact behavior. It would be particularly useful when a long conversation contains completed work, verbose logs, failed explorations, or unrelated discussions that no longer need to remain in full context.

Related issue: #36669 discusses model-callable selective compaction. This request focuses specifically on user-controlled message boundaries and chat UI actions.

Additional information

A previewable and reversible workflow would reduce the risk of losing important decisions or constraints during compaction.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing thread-level /compact behavior and the conversation model around message or turn boundaries. Define how the proposed beforeTurnId, afterTurnId, and startTurnId/endTurnId controls map to UI actions, preview and editing, and undo. Done should preserve messages outside the selected range and provide the requested user-controlled compaction workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.