Repository navigation
fix(tests): join terminal persistence fixtures after cancellation - #156197
Conversation
|
🦞👀 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 changes before merge. Reviewed September 23, 2026, 5:37 AM ET / 09:37 UTC (Revision 3). ClawSweeper reviewWhat this changesThe Gateway persistence tests now observe test cancellation and wait for fixture cleanup before another case reuses the same run ID. Merge readiness⛔ Needs changes before merge - 1 item remains The cancellation cleanup remains useful on current main. The integrated patch addresses the previous review request, preserves the settlement assertions, and has no identified correctness defect. Priority: P2 Review scores
Verification
How this fits togetherGateway lifecycle persistence records terminal run outcomes and releases run ownership afterward. These tests hold a database writer to verify that ordering, then retire subscriptions and claims before shared teardown. flowchart TD
A[Terminal test scenario] --> B[Held database writer]
B --> C[Exact claim settlement]
D[Test cancellation] --> E[Cancellation-aware wait]
C --> E
E --> F[Fixture cleanup]
F --> G[Shared teardown and next case]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +11. Total +11 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Retain main's exact settlement notification and use the existing fixture lifetime to finish cancellation cleanup before shared teardown. Do we have a high-confidence way to reproduce the issue? Yes: current main contains the uninterruptible notification wait, and the supplied controlled-cancellation comparison exposes the missing body join and verifies successor isolation. No tests were executed during this read-only review. Is this the best way to solve the issue? Yes: the patch reuses the existing cancellation and fixture-lifetime owners without weakening assertions, changing timeouts, or modifying production behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b51ea77c1ece. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Reviewed One cleanup regression needs fixing before landing: the new uncancelled The bounded correction is to race this wait with the real test-context signal and retain/join the body through the existing |
|
@clawsweeper re-review The PR body now embeds the inspectable original poll failure followed by the same execution’s terminal publication and verified persisted/owner states, the passing contention output, 20 clean standalone runs with one-worker cost, three clean original local reproduction-group runs, and 58 passing owner-sibling cases. Hosted CI is green at the unchanged exact head. Broader hosted-shard repetitions were outside the explicitly focused validation scope; the original failure reproduced standalone as well as in the local group. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Retain the terminal owner-claim table body and join its cleanup after cancellation. Race the publication wait against the test signal so a missing event cannot leave the claim owned by an abandoned body. Preserves the terminal persistence synchronization and contributor history from #156197.
|
Extra data point from #148397, whose CI hit exactly this case: Locally (Apple M1 Pro, no CPU contention) I timed the gap between the persisted status matching and the owner reaching
Only the failed path is slow. For So contention isn't required: running only the settled-failure case with no load failed 2/2 against the original 1 s This supports waiting on the terminal publication instead of a deadline. The terminal The awaited failure record dates from #139439. #156095 moving transcript writes to a worker could plausibly lengthen that step, which fits your hypothesis, but I didn't bisect it. I also haven't timed |
|
@clawsweeper re-review Please review current head The updated PR body separates the author’s |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Please review exact head eda2268. The main overlap is resolved by retaining its direct exact-claim The rewritten PR body records fresh proof for this integrated tree: 9 focused tests, 13 owner siblings, the original ordered 22-file/264-case cohort, and discriminating baseline/fixed cancellation controls with the unchanged next same-ID case. The control uses a simulated wrapper cancellation signal; it does not claim an observed outer timeout. Source restoration, process cleanup, and native Testbox closure were verified. The earlier review's integration and cancellation-proof requests are addressed; required publication gates and CI remain separate. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper status |
|
🦞👀
|
|
Merged via squash.
|
…enclaw#156197) * fix(tests): await terminal persistence before checking owner release * style: format terminal event condition * fix(tests): join terminal persistence fixture cancellation Retain the terminal owner-claim table body and join its cleanup after cancellation. Race the publication wait against the test signal so a missing event cannot leave the claim owned by an abandoned body. Preserves the terminal persistence synchronization and contributor history from openclaw#156197. * fix(tests): join terminal claim fixture cancellation Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Fixes: cancelled Gateway persistence tests can leave their run claim and subscriptions alive after the test wrapper finishes, contaminating the next case.
User Impact
No runtime behavior change. The terminal-persistence table now finishes its owned cleanup before shared teardown and before the next case reuses the same run ID.
Why This Change Was Made
The original timing repair by @obviyus is now covered by main's direct claim-settlement notification in 897b8e9. This update preserves that notification and its exact-claim, status, warning, and held-writer assertions.
Vitest cancellation aborts the test wrapper without joining a suspended body. The remaining wait now observes the actual test-context signal; the existing fixture lifetime retains the body, and a file hook joins its normal cleanup before shared teardown. Scenario order, assertions, and timeouts are unchanged. Production LOC: 0; tests: +127/-116, including reindent (net +11).
Evidence
Fresh proof for signed candidate
eda2268d3b64d6c7be5d7da35d152efc90c2278c, treee01fa9b173fab0291cf2eca2db59c98bd77b9016, in the focused Linux campaign:--maxWorkers=1, nine passes; Vitest file 6.489 s). End/cancellation/settled-failure rows took 608/104/613 ms; the AWS execution recorded 790/100/786 ms. Its test command passed, but the publisher later failed; these timings do not claim gate success.This observes controlled cancellation, not a real outer Vitest timeout or a production failure. Required publication gates and exact-head CI remain separate.
Cancellation-control observations