Skip to content

Reduce user-visible latency from context compaction with pre/background compaction #19485

Closed as duplicate

Description

@qiankunli

Problem

In Codex desktop, automatic context compaction can block the user-visible turn for a long time. In one recent session, the UI showed:

  • Context compacted
  • Worked for 1m 17s

During that period, the user cannot distinguish useful agent work from context maintenance, so the compact step feels like a visible stall.

Proposal

Could Codex reduce perceived latency by preparing compaction before it becomes blocking, or by doing it in the background?

Possible approaches:

  • Start preemptive/incremental compaction once the conversation crosses a soft threshold, before the hard context limit is reached.
  • Maintain a background compacted checkpoint while normal interaction continues.
  • Run compaction while the session is idle or after a discrete task phase completes.
  • If compaction must block, show progress that makes it clear the delay is context maintenance rather than task execution.

Why this matters

A one-minute-plus compact step is noticeable enough to interrupt the development flow. Even if total compute time is unchanged, moving part of the work off the critical path would make Codex feel much more responsive.

Environment

  • Product: Codex desktop app
  • Observed compact duration: 1m 17s
  • Date observed: 2026-04-25

Activity

  1. added
    enhancementNew feature or request
    appIssues related to the Codex desktop app
    contextIssues related to context management (including compaction)
    on Apr 25, 2026
  2. github-actions commented on Apr 25, 2026

    @github-actions
    Contributor

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

    Powered by Codex Action

  3. etraut-openai commented on Apr 25, 2026

    @etraut-openai
    Contributor

    Thanks for the suggestion. This is a duplicate of #18007, so I'm going to close this in the interest of consolidation. I realize that the other one specifically mentions the CLI, but the desktop app is built upon the functionality in the CLI. Feel free to add more details to the other thread if you feel like it doesn't fully capture your idea.

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

    appIssues related to the Codex desktop appcontextIssues related to context management (including compaction)enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions