Repository navigation
test(gateway): settle task events before registry cleanup - #153302
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 maintainer review before merge. Reviewed September 20, 2026, 2:58 AM ET / 06:58 UTC (Revision 5). ClawSweeper reviewWhat this changesThe PR makes shared subagent test cleanup await accepted task events and extends the session-reset regression to hold publication pending across reset. Merge readiness✅ Ready for maintainer review Keep open as the selected, focused repair. Current main still lacks settlement in the shared helper, the latest integration preserves the previously reviewed changes, and no actionable correctness defect was found. Priority: P2 Review scores
Verification
How this fits togetherGateway session-reset tests exercise session and subagent cleanup against SQLite-backed task state. Their shared settlement helper must finish accepted background work before asserting that no work remains and releasing fixture resources. flowchart TD
A[Session reset test] --> B[Accepted task event]
B --> C[SQLite write and publication]
A --> D[Shared settlement helper]
D --> E[Capture accepted event fence]
C --> E
E --> F[Assert zero residual work]
F --> G[Release fixture resources]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +30. Total +30 across 2 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Use the existing event owner's fence in shared test settlement, preserving strict residual-work assertions and deterministic reset coverage. Do we have a high-confidence way to reproduce the issue? Yes, source establishes a deterministic path: hold accepted event publication across reset, then call the unfixed shared helper while its detached root remains active. The contributor reports the expected failure; this review did not execute it. Is this the best way to solve the issue? Yes. Reusing the existing owner-bound fence removes repeated local joins while retaining error propagation, original assertions, and real SQLite operations in the regression. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1b3f38e7e4ff. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Merge main while preserving virtualized rail markers and the same-frame navigation fix. Replace the redundant delayed reset fixture with the deterministic accepted-event ordering from PR #153302.
Co-authored-by: steipete <[email protected]>
Preserve asynchronous collector registration and the shared settlement fence. Use a real post-registration progress event for the deterministic regression. Co-authored-by: steipete <[email protected]>
Preserve the reviewed reset settlement delta and contributor ancestry; incorporate the landed Doctor, artifact, and model-runtime fixture repairs. Co-authored-by: steipete <[email protected]>
|
Merged via squash.
|
…53302) Join accepted task-event publication in the shared persistence settlement helper before asserting zero roots. Pin the pending publication across same-turn reset with an ordering gate, covering settlement inside test bodies as well as teardown. Related: openclaw#153147, openclaw#145335. Co-authored-by: steipete <[email protected]>
Refresh the reviewed contributor branch with main repairs for the observed task-event settlement CI failure (openclaw#153302), preserving contributor ancestry. Co-authored-by: Patrick-Erichsen <[email protected]>
Related: #153147, #145335
What Problem This Solves
Gateway session-reset tests can fail with
residual registry roots: tasks:agent-eventswhen accepted task-event persistence finishes after reset and synchronous task reads.User Impact
No user-visible behavior changes. This fixes a test-lifecycle race that can fail unrelated update PRs on contended CI workers.
Why This Change Was Made
The root belongs to a finite task-event persistence/publication batch, not the active continuation itself. The recently added teardown-only fence does not cover calls to the shared settlement helper inside test bodies: the untouched baseline still failed the terminal-capture and yielded-collector cases.
The shared persistence settlement helper now joins accepted events through the existing task-registry fence before checking the unchanged zero-root assertion. The reset fixture uses that same helper before restoring dependencies. Its existing same-turn test holds a real task-event publication across reset with an ordering gate and releases it when settlement captures the fence. No sleeps, new polling, weaker assertions, production seams, or production changes.
Evidence
The original Peter-authored head
2c2fe0163be562fce4867ae0291a53fb3ef5af84is preserved through ordinary merges; no rebase or force push. Integrated head5c6c17fe6e9b1220828c6a1feb8abf03efe5ab04passed exact-head CI, including all 22 reset cases, 16 recursive-spawn cases, and the host-broker cleanup case.Main subsequently made collector registration asynchronous and added three local fences, causing a merge conflict. The new integration retains every new
await, keeps one shared settlement fence, and removes redundant local fences. The deterministic regression now arms its gate after registration and holds a real tool-progress event across reset. New integrated head:ab9ab92f828a0243dee78955f4e10c2d4eaa2afa. Current source base:5f24bb2ae6770dafdd99d5db3c81e9a55756232d.Fresh isolated conflict-resolution proof, with matched source, physical dependencies, and Node 24.19:
tasks:agent-eventsresidual-root failure.The canonical shared-helper repair here is the selected landing path; narrower duplicate #153412 will be closed only after this lands.
Original author evidence, before the integrations:
expected 1 to be +0in the shared residual-root assertion.OPENCLAW_VITEST_MAX_WORKERS=1.node scripts/check-changed.mjspassed all selected checks, including core test types, unchanged ratchets, dead-export scans, and changed-file lint.Production delta: 0 lines. Tests and test support relative to the captured current main: +45/-15 lines (net +30).
Main fixture repair integration
The previous head failed the independent Doctor raw-database snapshot race. The canonical fixture repair is now on main. An ordinary merge of
63f5cc7103ceefceae339593fe7e5542c8affb50produces3a5ba320051ba95d93274b890bfe34a744b44fe6; both changed files and the entire two-file PR patch are byte-identical to the independently reviewed and testedab9ab92version. Contributor ancestry is preserved. Exact-head CI now passes on this integrated head, with a clean fresh ClawSweeper review.