Skip to content

Compaction/reconnect can drop live orchestration state after stream disconnect #21643

Closed

Description

@ty13r

Summary

In the Codex desktop/app experience, a failed remote compaction appears to drop live orchestration state after reconnect, even though the local filesystem and GitHub state remain intact.

This may belong to the app/backend rather than the CLI itself; filing here because this is the public Codex issue tracker I could find. Please route or close if there is a better tracker.

What Happened

During a long-running Codex session with multiple worktrees and PR validation/publish work in progress, the UI reported a compaction failure similar to:

Error running remote compact task: stream disconnected before completion: error sending request for url (.../backend-api/codex/responses/compact)

After reconnect/compaction recovery:

  • The local repo/worktree state was still recoverable.
  • GitHub PR state was still correct.
  • The active thread lost live orchestration context, including handles for reviewer sub-agents that had been running before the reconnect.
  • The assistant had to reconstruct state from disk, git status, worktrees, PR metadata, and the visible transcript instead of continuing from the compacted thread state.

Expected Behavior

If compaction fails or the response stream disconnects, Codex should either:

  • retry compaction without losing live state, or
  • preserve enough resumable state to reconnect to existing sub-agents / active tasks, or
  • clearly report that live agent handles were lost and that recovery must happen from external artifacts.

Actual Behavior

The session resumed with enough transcript to continue manually, but not enough live orchestration state to know whether previously spawned review agents still existed or could be queried. The safe recovery path was to re-check GitHub/worktree state and re-spawn read-only reviewers rather than trust the compacted context.

Impact

This is risky for long-running coding/orchestration sessions because compaction can happen exactly while validations, PR updates, or independent reviews are running. The durable artifacts survive, but the live agent/session graph becomes unreliable.

Workaround Used

I recovered by treating the thread as untrusted and reconstructing from durable state:

  • git status in each worktree
  • gh pr view for PR head/merge state
  • local diffs and commits
  • PR comments and validation output

That worked, but it is manual and easy to get wrong under time pressure.

Environment

  • Product surface: Codex desktop/app session
  • Date observed: 2026-05-08 UTC
  • Local repo work involved Git worktrees and GitHub PRs
  • The failure was observed during automatic context compaction/reconnect, not during a local shell command

Activity

  1. added
    bugSomething isn't working
    appIssues related to the Codex desktop app
    contextIssues related to context management (including compaction)
    connectivityIssues involving networking or endpoint connectivity problems (disconnections)
    subagentIssues involving subagents or multi-agent features
    sessionIssues involving session (thread) management, resuming, forking, naming, archiving
    on May 8, 2026
  2. etraut-openai commented on Jun 29, 2026

    @etraut-openai
    Contributor

    Thanks for reporting this problem. Until recently, Codex used a separate endpoint and server-side logic for compaction. We recently switched to a more robust approach where the compaction logic is moved locally using the same endpoint as normal turns. This eliminates "remote compaction" errors and increases the stability and reliability of compaction operations. If you see further problems with compaction, please use /feedback and open a new bug report.

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 appbugSomething isn't workingconnectivityIssues involving networking or endpoint connectivity problems (disconnections)contextIssues related to context management (including compaction)sessionIssues involving session (thread) management, resuming, forking, naming, archivingsubagentIssues involving subagents or multi-agent features

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions