Skip to content

Fix stale Working status for completed Codex subagents - #32937

Merged
nwparker merged 1 commit into
mainfrom
nwparker/codex-child-status-reconciliation
Oct 24, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/codex-child-status-reconciliation

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​117 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​117
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​83 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​83

ELI5

A paused Codex session could keep spinning yellow in Orca because one of its already-finished subagents still appeared to be working. Orca now checks that child's transcript and settles the pane when the child finishes, even if its stop hook never arrives.

What Changed

Enroll hook-discovered and restored Codex children in the existing bounded transcript reconciler, including when the child is absent from the root rollout's retained tail. Reconcile child starts using the known root transcript, recover that path from retained session metadata after restart, and remove the tracked cursor on an explicit child stop.

Four regression cases cover a live child completing without a stop hook, a delayed start for a completed child, restart recovery, and explicit stop before the transcript completion is flushed. Added experimental reliability gate agent-status.codex-hook-child-transcript-completion.

Why

The reported pane correctly had a done main agent but retained a working catalog_tests child whose transcript already recorded completion. Hook-only children were never enrolled in transcript polling. Reusing the existing reconciler preserves live-child aggregation and the existing read limits and cadence.

Linked Issue

Internal maintainer report from a live Orca session; no separate issue.

Visual Proof

Before/after verification in this PR worktree used separate hidden Electron instances and fresh profiles with a non-git folder workspace. Replayed hook events against copies of the actual affected root and child rollout tails through each test app's authenticated hook endpoint; no fresh provider turn was started.

The parent implementation stayed visibly yellow Working for the already-completed child (main agent done) throughout a 3.5-second observation. Identical input on the PR implementation settled to green Done. Screenshots and renderer/main status snapshots agree.

Parent implementation: completed child remains Working

PR implementation: same completed child settles Done

The fixed app also kept a live child Working, then settled through the real server poll scheduler after only appending transcript completion. An active root stayed Working after its child completed, and explicit child stop settled before transcript completion flushed. All test windows stayed hidden; owned test apps/tabs were closed and the worktree was restored clean.

Testing

  • Reproduced the stuck yellow state on the parent implementation and verified rendered completion on the PR code in hidden Electron via CDP.
  • The committed regression suite fails three cases on the parent implementation; all four cases pass with the fix.
  • Added automated regression tests; 131 tests passed across 17 focused Codex suites on the PR branch.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm tc:node passed.
  • pnpm run check:code-quality:changed, reliability-manifest validation, and git diff --check passed.
  • The actual 146 MB root rollout reconciled its completed phantom child in about 10 ms using the existing 1 MB read cap.
  • CI passed: full PR aggregate gate, all five Node test shards, relay integration, static/typecheck, packaging including Windows, mobile verification, WSL Ubuntu/Debian/Fedora, persistence, and managed hooks on Node 18.

Review

Invariant: a completed hook-only child must not keep a done lead working; a live child must still hold the combined state open. Root-session ownership and the child transcript are the oracle. Explicit child stop must also retire its cursor and end polling.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material copied.

Notes

macOS local normalization and hidden UI are covered. Non-git folder workspace status was exercised end to end; local/daemon PTY lifecycle and routing are unchanged. SSH and WSL share the normalizer; their transport integration, Windows/Linux execution, and mobile UI are unverified. No wire-format change, new timer, subprocess, or global scan. A child with no known root transcript still relies on hook completion. Launch-before-transcript-flush races and cross-day resumed-child discovery remain outside this gate.

Checklist

  • Small and focused; behavior and mechanism explained.
  • Working/Done screenshots attached.
  • Self-reviewed for correctness and performance.
  • Cross-platform, remote, mobile, folder-workspace, and compatibility impact considered.
  • Focused tests, node typecheck, changed-code quality, full CI, and baseline/fixed hidden UI checks passed.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 38063d1a-3eee-4951-94cd-56fff81ff6c8
📥 Commits

Reviewing files that changed from the base of the PR and between 3a3e9c4 and f59b77c.

📒 Files selected for processing: 4
  • config/reliability-gates.jsonc
  • src/shared/agent-hook-listener/providers/codex-events.ts
  • src/shared/codex-hook-child-transcript.test.ts
  • src/shared/codex-subagent-transcript.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

Codex lifecycle hooks now reconcile child transcripts using the parent transcript path when available. Transcript reconciliation seeds missing child tracking entries from the roster. Tests cover completion through transcript polling, delayed hooks, restart reconciliation, and explicit stops. The reliability-gate configuration records the experimental gate’s verification details and criteria.

Priority: Normal

Merge Risk: Minimal · up to f59b7

The change appears mergeable after normal checks. The remaining platform and transport scenarios have not been verified, but no concrete failure is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the primary change: correcting stale Working status for completed Codex subagents.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template well. It has an ELI5, What Changed, Why, Testing, Review, Notes, and Checklist. Its Testing section gives specific platforms and commands. It also state…
Full details: Description check

Explanation

The description follows the repository template well. It has an ELI5, What Changed, Why, Testing, Review, Notes, and Checklist. Its Testing section gives specific platforms and commands. It also states macOS-only coverage and the remaining gaps for SSH, WSL, Windows, Linux, and mobile. Three gaps remain. The Linked Issue section says there is no separate issue and gives only an internal maintainer report, so it does not follow the template's 'Fixes #' format. The AI Disclosure section is empty. The Visual Proof section gives before/after screenshots and a hidden Electron verification method, so it meets the UI requirement. The Agent skill upstream boundary box is checked.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit a87d880 into main Oct 24, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant