You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(codex): read a turn's late error after herdr reports the pane at rest - #4791
Fixes#3760. A Codex turn whose error line is written to its rollout after herdr has already reported the pane at rest still showed a green DONE with a finish alert: the server re-read the rollout only when herdr's own status was done, and herdr reports a resting Codex pane as idle or unknown.
Now an unfinished Codex rollout is checked again at idle/unknown rest on later snapshots, per turn and per session: a later turn or a new Codex session in the same pane never inherits an earlier turn's failure, a second turn that rests while the first turn's read is pending gets its own check, a rollout that disappears stops the search, and an inconclusive tail is re-read only after the file changes.
Known limits: the finish alert can still go out before the next snapshot reads the late error, and moving the pane to another workspace drops a pending check.
Validation
New regressions (late error at idle/unknown rest; overlapping turns with a failed and a successful second turn; replacement session; vanished rollout) fail on origin/main and pass here; 296 focused Codex/Claude/Letta status and completion tests and bun run typecheck pass.
bun run check fast at f11644f: green apart from one load timeout in scripts/relay-ios-sim.test.ts (unrelated), which passed 2 of 2 runs alone.
Reviews: omo gate (HIGH) and Codex (5 MEDIUM, 1 LOW) on the first head; fixed in f11644f with failing-first tests.
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Late Codex rollout failures are now detected during later status checks, including when the resting pane is reported as idle or its status is unknown.
Status updates are less likely to reflect an earlier task after a new turn begins, the session changes, or the pane switches away from Codex.
Missing or unavailable rollout information receives a limited retry, helping prevent repeated checks when the rollout can no longer be found.
Codex status tracking now rechecks eligible resting panes for late rollout errors. Turn and session checks prevent stale lookup results from changing pane status. Tests cover late failures, pending reads across turns, session and agent changes, and missing or expanded rollout files.
Changes: Codex status tracking
Layer / File(s)
Summary
Track Codex turn and session lifecycle server/core/status.ts, server/core/codex-status-hub.test.ts
Codex tracking now stores turn and session state and clears it when a pane closes, disappears, or changes agent. Pane moves carry session and retry state. Tests cover pending reads across turns, session replacement, and agent changes.
Recheck resting panes and guard rollout results server/core/status.ts, server/core/codex-status-hub.test.ts, changelog.d/codex-late-failure-rest.md
Eligible resting panes can trigger rollout checks when a lookup is pending or a failure is recorded. Reads retry once after failure and apply results only while the original turn remains current. Tests cover late failures, vanished rollouts, and expanded rollout files. The changelog documents the late-failure fix.
devswha/ovis#3733: Changes the Codex status path that reads rollout errors when a pane reports DONE.
Merge Risk: Minimal · previous review f1164
Late Codex rollout errors are now picked up when herdr reports a resting pane as idle or unknown, and stale lookups cannot affect a later turn or session. No actionable merge-blocking risk remains. The documented limits are a possible finish alert slightly ahead of the late-error read, and a pending check dropped when a pane moves workspace.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: a fix so that a Codex turn's late error is read after herdr reports the pane at rest. The changeset rechecks unfinished Codex rollouts at idle/unknown rest, which matc…
Description check
The description follows the repository template. It has a Change section that describes the problem (late Codex error missed at idle/unknown rest), the resulting behavior (per-turn and per-session re-…
Linked Issues check
[#3760] The stated fix requires a snapshot re-read of a resting Codex pane whose last check returned "under way" and which still shows DONE, regardless of whether herdr reports idle, unknown, or `…
Out of Scope Changes check
All changed files relate to #3760. The changelog entry describes the fix. The status-hub tests cover the late-error, overlapping-turn, replacement-session, and vanished-rollout cases. The status.ts ch…
Full details: Title check
Explanation
The title names the main change: a fix so that a Codex turn's late error is read after herdr reports the pane at rest. The changeset rechecks unfinished Codex rollouts at idle/unknown rest, which matches the title. The title is 73 characters, within a concise length, and uses the conventional fix(codex) prefix.
Full details: Description check
Explanation
The description follows the repository template. It has a Change section that describes the problem (late Codex error missed at idle/unknown rest), the resulting behavior (per-turn and per-session re-checks, vanished rollout stops search), the linked issue (#3760), and known limits. It has a Validation section that lists the checks run (focused status tests, bun run typecheck, bun run check fast) with results and notes the one unrelated timeout. The template's contract-test note for HTTP/WS changes does not clearly apply, and the description does not say whether contract tests were run. This is a minor gap that does not block the check.
Full details: Linked Issues check
Explanation
[#3760] The stated fix requires a snapshot re-read of a resting Codex pane whose last check returned "under way" and which still shows DONE, regardless of whether herdr reports idle, unknown, or done. The summary of status.ts says rest checks now run for eligible done or unknown statuses when a lookup is pending or a failure is recorded. The idle case is covered by the same snapshot path per the summary. The PR adds regression tests for a late error at idle/unknown rest (codex-status-hub.test.ts), and the author reports these fail on origin/main and pass on this head. [#3760] The pending-read race is addressed: the turn identifier is checked before delayed status is written, and stale results are discarded after a session or agent change. [#3760] The 1 s finish-notification delay is described in the issue as a side effect found in review. The PR does not change it, and it lists the related alert-delay limit as known. This is not a stated fix target, so it does not fail the check. Evidence is the PR summary, the changed-file summaries, and the author's test report. I did not read the source diff directly.
Full details: Out of Scope Changes check
Explanation
All changed files relate to #3760. The changelog entry describes the fix. The status-hub tests cover the late-error, overlapping-turn, replacement-session, and vanished-rollout cases. The status.ts changes add turn identifiers, session tracking, retry state, and pane move/close cleanup, which support the turn/session isolation and stale-result rules the fix needs. No unrelated feature or refactor appears in the summaries. Evidence is limited to the PR summary and file summaries; I did not inspect the diff hunks.
Finishing Touches
Generate unit tests (beta)
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.
Reviewing files that changed from the base of the PR and between 03d50dd and f11644f.
Files selected for processing: 3
changelog.d/codex-late-failure-rest.md
server/core/codex-status-hub.test.ts
server/core/status.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.
Merged through pr-merge at head 8c97bf090. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.
Reviews: omo gate (HIGH) and Codex gpt-6.2-sol-fast xhigh (5 MEDIUM, 1 LOW) on the first head; one fix round (f11644f) with failing-first tests; two known limits documented; check fast green apart from one unrelated relay-ios-sim load timeout (passed 2/2 alone). Merged by lane issue-fix-1126 on the lead's word. Unrelated CI timeouts (codex-status-hub once, relay handshake test once, both on loaded P620 runners) were re-run.
Release 0.5.10, prepared only. **Waiting for the maintainer's go**:
nothing here is merged, tagged, deployed or submitted to a store by this
PR's session. Relay PR #4779 is merged and the A15 recheck passed on
`main` 12b8d90, so this PR is now ready for review; it is on `main`
84469d3. #4790's fragment, merged after the fold, was moved into
0.5.10 by hand.
- `package.json` and `herdr-plugin.toml`: 0.5.9 -> 0.5.10.
- `REMOTE_BUNDLE_VERSION` 53 -> 54 (`shared/machines.ts`): the release
guard says the bundle's inputs changed since `remote-v53` (the files
under `server/`, `shared/`, `patches/`, `scripts/` and others). After
this merges, `remote-v54` is tagged on the merge commit and the **Remote
PC bundles** run publishes it before the Release run. Until the Release
run is done, nothing touching `server/`, `shared/`, `bun.lock` or
`patches/` merges.
- `CHANGELOG.md`: `bun scripts/changelog-fold.ts 0.5.10` folded 258
fragments (186 PRs) under 0.5.10, dated 2026-11-26, with their PR links.
`by @login` credits added to the 31 links of PRs from outside
contributors (one, #4176, already had it).
- `release-summaries.json`: 0.5.10 in en, ko, ja and zh: 5 new, 5
improved, 5 fixed, each English line at most 70 characters. Left out on
purpose (they stay in the changelog): everything behind the account's
signed list (its switches stay off at the account service), and the
phone apps' carried shell and iPhone SSH, which reach people only with
the next store builds.
- Android 1.0.7 (15) bump included (`app/android/app/build.gradle`,
`app/store/android.md`; commit cherry-picked from
`chore/android-1.0.7`): the store build is made from the v0.5.10 tag, so
it must be on `main` before the tag.
- `telemetry/deployed.json` unchanged: `shared/telemetry.ts` changed
since v0.5.9, but main already records that Worker deploy, and the
release guards agree.
## Release checklist (maintainer's go needed for every step)
1. [ ] **Account service first** (ovis-sh/account): production runs
migrations up to **0039** and the Worker at **26eabfd**. Apply the
migrations, then deploy the Worker right after (the account README's
order; migrations only go forward). Confirm which migration production
is on before the release: the pre-release survey could not read it.
2. [ ] **Relay**: `relay/` changed since v0.5.9 only in
`relay/bun.test.ts` (#4557), so no relay deploy is needed for that
range. #4779 and the commits since did not touch `relay/` either, apart
from `relay/worker.test.ts` (#4787). If `relay/` changes before the tag,
deploy relay.ovis.sh and relay-ap from the **same commit** before it.
3. [ ] **#4553** (privacy policy: direct connections are off by default)
merges together with this release: the default changed in #4543 and the
site deploys on merge.
4. [ ] `MIN_SUPPORTED_CLIENT_VERSION` stays **0.4.20**
(`server/relay/client-floor.ts`): raising it would stop the live phone
apps (iOS 1.0.2 (11), Android 1.0.5 (13)) at "Update the app".
5. [ ] The account's list switches stay **off** (`OVIS_LIST_ACCOUNTS =
""`, `OVIS_LIST_MIGRATE_ACCOUNTS = ""`, `PC_LIST_PROOF = "off"`): a list
pin cannot be undone; turn them on separately once the new store builds
are installed.
6. [ ] Right before merging, rebase onto `main` and move by hand any
`changelog.d/` fragment merged after the fold (the Release run refuses
while one is left; #4788 merged after the last sync). Merge this PR
after CI passes, push `remote-v54` on the merge commit, wait for
**Remote PC bundles** to publish it, then run **Release** with `0.5.10`.
7. [ ] **Android: a new store build on release day.** On the live
Android app (1.0.5 / 1.0.6 native), Back on More -> Connect a PC
(`/#add`) closes the app (the on-screen back arrow works; reopening
returns to the PC). The page cannot fix it safely; main's native code
already does (#4435). Android 1.0.7 (15) bump included in this PR;
upload that build from the v0.5.10 tag the same day (steps:
`~/.dori-sa/reports/android-store-build-0510/STEPS.ko.md` on the
maintainer's PC).
8. [ ] **iOS next build**: it moves the shell to
`capacitor://app.ovis.sh`, so people who update sign in once more and
re-pair PCs that are not in an account. Write that line into the update
notes before it ships.
Evidence for the checklist: the pre-release blocker survey and the
old-native QA of the 0.5.10 shell on the live store apps (iOS 1.0.2
(11), Android 1.0.5 (13) and 1.0.6 (14)): every flow passed except the
Android Back in step 7; signed-in account flows were not exercised
there.
## Contract diff v0.5.9..main (old phone apps, mixed versions)
**Not purely additive.** No HTTP route or method, WebSocket message
`type`, or relay frame was removed or renamed, and `WIRE_VERSION` "1",
`RELAY_PROTOCOL` 1, `BRIDGE_PROTOCOL` 1, the minimum server version
0.4.21 and the client floor 0.4.20 are unchanged. The live iOS 1.0.2 /
Android 1.0.5 apps load the hosted shell, so they pin no old parser; the
old-native QA above passed on it. What changed meaning, all in adding
one account PC to another (#4435) or behind the signed list:
| Change | v0.5.9 -> main | Mixed versions |
| --- | --- | --- |
| `POST /api/machines/relay/account/pair` NDJSON progress `{digits}` ->
`{waiting:true}` | `server/machine-api.ts`, `src/lib/api.ts`
`pairAccountPc` | A 0.5.10 shell (app.ovis.sh) on a 0.5.9 PC, or the
reverse, ignores the other's progress line, so the approval hint does
not show; the final `machine`/`error` lines still arrive. |
| Relay `pair-intent-vouched` needs `pair-pc-proof` |
`server/relay/session.ts`, `server/relay-pc.ts` | Adding a PC between a
0.5.9 and a 0.5.10 PC fails (the old one is told it is outdated).
Existing pairings reconnect as before. |
| Vouched approval: `RemotePairingRequest.choices` [] and
`proven_server_id` + `pc_label` instead of six digits |
`shared/machines.ts`, `server/relay/pairing-approvals.ts`,
`server/relay/routes.ts` | An old approver cannot approve a new vouched
request. Ordinary digit comparisons keep their shape. |
| A PC pinned to a signed list refuses legacy joins and signed
`link`/`add`; one-press admission needs `listing_id` |
`server/relay/session.ts`, `server/account/*` | Only with the list
switches on, which stay off for this release. |
| Direct connections default off when no choice is saved (#4543) |
`server/relay/service.ts` | Relay keeps working; a saved choice is kept.
Hence #4553 with this release. |
| `POST /api/relay/reset-identity` validates its body, adds an optional
`removed` guard | `server/relay/routes.ts` | An old shell's empty body
still works. |
The commits after the first audit (03d50dd..84469d3: #4779, #4784,
#4478, #4787, #4790) only add, or change no wire shape: `list_held` on a
non-list PC's own joins, a `held_here` join refusal for a key a block
keeps out, and a `consumed` outcome for a settled pending input.
Verified by reading both refs (`git diff v0.5.9 origin/main -- shared/
server/ relay/`, `git show` of each file at both refs); the first row
was checked line by line. No skew test was run. **For the maintainer's
go:** the first three rows mean PC-to-PC adds need both PCs on 0.5.10;
nothing else an old phone app or an existing pairing uses was removed.
## Validation
- `bun run check fast` on this PC at 8f4a344 (main 84469d3 + this
PR's three commits): every step ok (unit: 28779 pass, 0 fail, 259 skip).
Before that at f914315 (main 12b8d90 + the release commit): every
step ok (unit: 28770 pass, 0 fail, 259 skip; typecheck, build, generated
types and themes, workflow syntax). Earlier also at 0caf043 on main
03d50dd: 28720 pass, 0 fail.
- CodeRabbit's three findings on 8f4a344 fixed in d96ac26
(superseded delegated-helper and plain `ovis` lines made to say the
final behavior; the Memory summary no longer says agents use the notes);
`bun run check fast` there: every step ok (unit: 28779 pass, 0 fail). CI
on 8f4a344: success. CI on d96ac26: success after one rerun of
Browser regression 3/3, where `scripts/application-paging-regression.ts`
failed once and passed on the retry (a flake not quarantined; the PR
changes no code it runs). CodeRabbit reviewed d96ac26 with nothing
new.
- After the Android cherry-pick: `bun test
scripts/app-bundled-shell.test.ts scripts/app-shell.test.ts
scripts/ci-browser-reach.test.ts` (the tests that read the Android
version files): 120 pass, 0 fail.
- `bun test scripts/changelog-fold.test.ts scripts/release-notes.test.ts
server/release-notes.test.ts scripts/release-guards.test.ts`: 60 pass, 0
fail.
- `bun scripts/release-guards.ts --base origin/main`: "Release 0.5.10:
remote bundle, telemetry Worker and release metadata are in order."
(before the bump it asked for 53 -> 54).
- `bun scripts/release-notes.ts 0.5.10` renders the notes (New features
5, Improvements 5, Bug fixes 5).
- Not run: `check full` (versions, notes and one constant); a
mixed-version runtime test of the contract rows above.
- Release day (lane release-0510-go, on the maintainer's go): merged
`main` 3fbdb17 and moved by hand the three fragments merged after the
fold (#4788 under Changed, #4791 and #4794 under Fixed; #4787 and #4795
are test-only and had none). `bun run check fast` at 0bbca5b: every
step ok (unit: 28807 pass, 0 fail, 259 skip). `bun
scripts/release-guards.ts --base origin/main`: in order. The
release-notes and guard tests: 60 pass, 0 fail. The account service is
already on migrations 0039 and Worker 26eabfd in production, with the
list switches off.
… turn (#4803)
## Change
Fixes the flaky `server/core/codex-status-hub.test.ts` test "still finds
a late failure after the
rollout tail contains no turn markers (#3760)" that failed the 0.5.10
Release run's
"Fast checks (GitHub-hosted)" job (run 45782602477: `Expected number of
calls: 3, Received: 2`).
The product is fine: the snapshot that follows the late error does start
the third rollout read,
but `codexRest` begins that read only after `stat()` of the rollout
returns from the thread pool.
The test counted reads after `settled()`, which waits for one
`setImmediate`; on a slow 2-core
runner the `stat` has often not returned by then. The test now awaits
the read itself
(`h.looked()`) before counting, with a bounded 2 s timeout like its
neighbours. `h.looked()` itself now fails after 1.5 s, before
the test's own timeout, so a missing read fails the test with its
`finally` run and the file's spies restored.
Test-only change: no changelog fragment.
## Validation
- Reproduced on this PC with the test pinned to 2 CPUs (`taskset -c
2,3`) under 4 busy loops on
the same CPUs: 20 of 30 runs failed with `Received number of calls: 2`
on origin/main.
- Same conditions with this change: 50 of 50 runs of the whole file
passed (0 failures).
- With `server/core/status.ts` from before #4791, the changed test still
fails (times out at 2 s),
so it still guards #3760.
- `bun run check fast`: green at 950c2bc (28807 unit pass, 0 fail).
Re-run green at 3efac03 (28807 pass, 0 fail). A first run under the
lane's long `TMPDIR` failed only `server/ssh-account-add.test.ts`
because its forwarded socket path exceeded the Unix socket limit; with a
short `TMPDIR` it passes 3 of 3, unrelated to this change.
- Reviews: Codex (gpt-6.2-sol, xhigh) confirmed the root cause and that
the test still guards #4791; 2 LOW notes (a timeout leaves the spies
installed until the file ends; three nearby negative read counts could
pass before `stat()` returns, which can hide a regression but never
fails a run). omo gate: confirmed the root cause and no product change;
1 MEDIUM (a missing read hit only the runner's timeout, so `finally`
never restored the spies), fixed in 3efac03. Re-checked: with
`status.ts` from before #4791 the test now fails at 1.5 s with `no
rollout read finished`; 50 of 50 runs pass again under the 2-CPU load.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Fixes #3760. A Codex turn whose error line is written to its rollout after herdr has already reported the pane at rest still showed a green DONE with a finish alert: the server re-read the rollout only when herdr's own status was
done, and herdr reports a resting Codex pane asidleorunknown.Now an unfinished Codex rollout is checked again at
idle/unknownrest on later snapshots, per turn and per session: a later turn or a new Codex session in the same pane never inherits an earlier turn's failure, a second turn that rests while the first turn's read is pending gets its own check, a rollout that disappears stops the search, and an inconclusive tail is re-read only after the file changes.Known limits: the finish alert can still go out before the next snapshot reads the late error, and moving the pane to another workspace drops a pending check.
Validation
bun run typecheckpass.bun run check fastat f11644f: green apart from one load timeout inscripts/relay-ios-sim.test.ts(unrelated), which passed 2 of 2 runs alone.