Compaction/reconnect can drop live orchestration state after stream disconnect

Resolved 💬 2 comments Opened May 8, 2026 by ty13r Closed Jun 29, 2026

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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗