Repository navigation
[Bug]: Codex compaction can reopen a finished task as Working #31944
Description
Operating system
macOS
Orca version
Observed locally with Orca 1.4.237. The specific hook-sequence regression below is reproduced against current source at ea60ec5d7c.
Details
A Codex SessionStart hook with source: "compact" is treated as new work. After a turn has finished, it changes the sidebar row and terminal tab from Done back to Working. During a live turn, it also clears the prompt, subagent roster, transcript cursor, and tracked turn ID, which can prevent the existing session-log completion fallback from settling that turn.
This report isolates a deterministic hook-sequence regression. A local report of finished Codex tasks remaining Working led to the investigation; the exact triggering event for that original session was not captured, so this issue does not claim that all stuck Codex indicators have this cause.
Reproduction
Using an isolated Orca instance and its normal authenticated /hook/codex endpoint, send these events on the same pane and session:
UserPromptSubmitwithturn_id: "turn-1"and a prompt.Stopwith the same turn ID. Confirm the row is Done.SessionStartwithsource: "compact", the same session/transcript path, and no turn ID.
Actual: the row becomes Working again and loses its prompt. No new user turn was started.
Expected: compaction preserves the existing turn and status. A finished turn stays Done; a running turn retains its identity and can still settle from its own task_complete; a human question stays waiting.
Before / after evidence
The same synthetic hook sequence was replayed through the real host listener, IPC, renderer store, and sidebar, with Playwright controlling isolated hidden Electron instances. No real Codex model request was needed and no user session was modified.
| Current main | Narrow fix: ignore compact SessionStart |
|---|---|
![]() |
![]() |
Related work and scope
- [Bug]: Codex CLI /review finishes but agent remains Working #28198 / merged Mark completed Codex reviews Done when Stop is absent #28860 cover completion records when Codex omits Stop. This is a follow-up: compaction can discard the tracked turn that that fallback needs.
- Closed, superseded fix(agent-status): settle a Codex turn that failed, from its session log #22753 explicitly described ignoring compact SessionStart, but current main still processes that event as a reset.
- Open fix(codex): preserve hook-driven agent status #8292 changes startup/resume handling, but its current patch resets all root SessionStart events without preserving an in-flight compact turn.
- Open Fix stale working spinners on remote terminal tabs #25205 concerns stale remote client projections; Fix Codex stream error status completion #7202 repairs fatal stream-error output. Neither changes this host-side compact-event path.
The proposed scope is only to ignore SessionStart when source is compact, preserving existing startup/resume behavior and avoiding a new timeout or status protocol.
Separate wrong-project observation
A later local inspection found a Codex session whose session/turn directory belongs to one project while its inherited ORCA_PANE_KEY and workspace identity belong to another. Existing open #23411 (shared-daemon hook attribution) and #28267 (inherited host/chat pane identity) cover those attribution paths. This issue and its narrow fix do not claim to resolve that separate problem or establish the cause of the original report.


Activity