Repository navigation
fix: recovery tests wait for committed outcomes - #154995
Conversation
Reject the pending admission observer when a session-change read throws, preserving the original error and existing listener cleanup. A deterministic regression reproduces the swallowed failure and covers successful admission and teardown.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 1:51 PM ET / 17:51 UTC (Revision 3). ClawSweeper reviewWhat this changesRecovery tests now propagate database-read errors, wait for committed outcomes in each physical session store, and await scheduler cleanup. Merge readiness✅ Ready for maintainer review The repair remains useful: current main retains the faulty test waits. No actionable correctness or security defects were found, and the patch preserves the existing recovery assertions. Priority: P3 Review scores
Verification
How this fits togetherStartup recovery resumes interrupted agent sessions and records their outcomes in session storage. The changed test fixture observes those committed rows so recovery assertions and cleanup run at the correct time. flowchart TD
A[Seeded interrupted sessions] --> B[Startup recovery scheduler]
B --> C[Committed session rows]
C --> D[Session change events]
D --> E[Test outcome observer]
E --> F[Recovery assertions]
E --> G[Stop and join scheduler]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +174. Total +174 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the shared committed-state observer for these recovery waits while preserving exact store identities, outcome assertions, and joined scheduler cleanup. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure path: a session read thrown from the original listener is swallowed by the event bus, leaving its promise pending; asynchronous recovery can also exceed the existing one-second polling cutoff. No tests were executed during this read-only review. Is this the best way to solve the issue? Yes. Extending the existing observer removes the timing assumption and preserves the original error and recovery assertions without changing production code or increasing timeouts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 78a45d69cfb5. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash auto-merge.
|
* commit '8a26ae487b5fb9b72ea2c12bf384e9c776659429': (154 commits) fix(ui): preserve skill group expansion when filtering (#150911) test(gateway): consolidate server history and lifecycle fixtures (#155063) test(codex): select HTTP fallback in native finalizer fixtures (#155008) improve: reduce isolated Gateway CI test time (#154366) test(gateway): await approval registration acknowledgments fix(workboard): explain blocked-card claim recovery (#154990) perf(agents): consolidate exec target policy tests (#155060) perf(config): consolidate environment test fixtures (#155062) fix(ui): keep the chat rail anchored through composer resize fix: recovery tests wait for committed outcomes (#154995) fix(codex): keep inference bursts from failing turns (#154945) fix(memory): keep generated REM reflections out of promotion rankings (#154994) fix(sqlite): reclaim scratch files when storage is full (#154937) test(cli): spawn the compiled Doctor entry in the output process test (#155055) fix(update): distinguish config validation execution failures (#154892) test(doctor): await session cleanup before deleting fixture state fix(update): report unavailable service inspection accurately (#154896) test(gateway): observe plugin approval response completion perf(msteams): reduce file-consent test scaffolding (#155050) fix(ui): retain saved permissions during delayed startup reads (#154982) ...
* test: report recovery fixture read failures promptly Reject the pending admission observer when a session-change read throws, preserving the original error and existing listener cleanup. A deterministic regression reproduces the swallowed failure and covers successful admission and teardown. * test: await committed recovery before checking final charges * test: await recovery across physical session stores
Related: #154424
What Problem This Solves
Recovery tests can hide database-read failures or fail while valid startup recovery is still running.
User Impact
No production behavior changes. Tests report the original read error promptly, wait for committed recovery state, and join their scheduler before finishing.
Why This Change Was Made
The session-change bus intentionally isolates listener exceptions, so the test observer must reject its own promise on a read failure. Admission and terminal-state waits now share that observer and remove subscriptions when settled.
CI exposed one-second polling deadlines in the final-startup-retry test and its adjacent two-store case. They expired before recovery changed the seeded sessions. Both now observe committed failure state, keep their charge, reservation, tombstone, session identity, and dispatch assertions, and use Vitest cancellation to stop and join the scheduler. No timeout was increased.
Evidence
The original read-error case fails before the fix. Seven observer cases cover successful admission, terminal recovery, read errors, cancellation, listener removal, cleanup joining, and both completion orders for two physical stores sharing a logical session key.
The original CI failure left the session running at its seeded revision and charge count. An unchanged replay passed with the target taking 770 ms, close to its 1,000 ms cutoff; that replay is not a fix claim. A controlled startup pause beyond 1,001 ms of virtual time reproduced the exact failure, while the fixed test waits for real recovery and preserves its original outcome assertions.
The second CI failure was the adjacent two-store case; the first repaired case passed. Its controlled delayed-start reproduction failed with the same charge-count mismatch in 16.23 seconds; the fix passed in 14.81 seconds. Both store identities and final assertions are preserved.
The final original-order replay passes all 229 cases: seven observer, four admission, and 218 recovery tests, in 131.30 seconds total single-worker wall time. The two-store case took 1,241 ms in the full file. The final observer loop cleanup was then verified separately: seven cases in 2.19 seconds. The first delayed-start regression also failed before its fix (16.21 seconds) and passed afterward (13.03 seconds). Exact CI host latency was not separately attributed; the demonstrated defects are polling over asynchronous startup, not production recovery failures.
The owning test type graph, scoped lint, formatting, and size ratchets pass. Fresh independent review is clean through P2. Exact-head hosted CI passed with 27 successful jobs and 19 skipped; the changed-node test job took 177 seconds. ClawSweeper found no actionable correctness or security issues. Merged as
5406706770346421dea3ddf37ce47d3d3c546071.