Repository navigation
fix: Gateway fixture cleanup races participant persistence - #156172
Conversation
Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 5e11a06e-7704-46e5-b79b-c0583b263950
|
🦞👀 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 23, 2026, 2:12 AM ET / 06:12 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR lets background participant recording outlive completed Gateway requests while making test cleanup wait for accepted database writes before releasing their stores. Merge readiness✅ Ready for maintainer review The PR remains useful: current main still retains request roots during participant persistence and lacks the fixture queue joins. The updated evidence resolves the previous proof concern. No actionable correctness or security findings remain. Priority: P2 Review scores
Verification
How this fits togetherGateway participant recording saves who contributed to a session through the agent database writer queue. Request accounting and background-work tracking govern different lifetimes; test fixtures must wait for persistence before closing storage. flowchart TD
A[Accepted session input] --> B[Background participant recording]
B --> C[Request root released]
B --> D[Tracked async work]
D --> E[Agent database writer queue]
E --> F[Participant history persisted]
G[Fixture cleanup] --> E
F --> H[Store selectors cleared and database closed]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +8, Tests +76. Total +84 across 11 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep participant persistence under its async-work owner and retire fixtures only after their canonical writer queues settle. Do we have a high-confidence way to reproduce the issue? Yes, source provides a high-confidence path: hold participant persistence after request completion, then observe retained roots or retire its fixture while the write remains queued. The contributor reports failing-before regressions; this read-only review did not execute them. Is this the best way to solve the issue? Yes. The patch uses the existing async-work and writer-queue owners, preserves persistence checks, and repairs cleanup ordering without changing timeouts, schemas, or user settings. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cb6ef2b3e9ed. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
The main PR body now spells out the observed after-change behavior and links the completed exact-head CI and required CI/security gate. The real SQLite regression keeps both selectors bound while the write is blocked, then observes fulfilled/inserted persistence and database retirement. Separate resolve/reject cases show root count zero while AsyncWorkScope drainage still waits. Review disposition: the recorded “not applicable” proof classification is incorrect; this is applicable, executed owner-boundary proof, not a claim of live operator-Gateway testing. The durable review itself recognizes the real queued-write coverage, unchanged authority, the bot-published exemption, and no actionable code or security findings. No source change or waiver of enforced checks is needed for that classification discrepancy. Proceeding through the normal native maintainer gates under the existing repair-and-land request. |
|
Merged via squash.
|
* fix(gateway): join participant writes before test cleanup Co-authored-by: steipete <[email protected]> * fix: Gateway fixture cleanup races participant persistence Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 5e11a06e-7704-46e5-b79b-c0583b263950 --------- Co-authored-by: steipete <[email protected]> (cherry picked from commit f63d91e)
…156172) * fix(gateway): join participant writes before test cleanup Co-authored-by: steipete <[email protected]> * fix: Gateway fixture cleanup races participant persistence Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 5e11a06e-7704-46e5-b79b-c0583b263950 --------- Co-authored-by: steipete <[email protected]>
What Problem This Solves
Fixes Gateway fixture cleanup racing accepted participant writes after a request has finished.
User Impact
No user-visible feature or configuration change. Best-effort participant bookkeeping no longer keeps a completed Gateway request active, while shutdown and test cleanup still join the persistence they own. Schemas, retention, and write authorization are unchanged.
Why This Change Was Made
Request-root completion is not a storage completion signal. Participant persistence remains tracked by its async work scope; fixture retirement now joins the canonical agent writer queue without rejecting pending writes. Directory-scoped cleanup drains only its own stores, keeps their selectors until writes settle, and preserves the existing read-context disposal. The drain lives in test support rather than adding a test-only production export.
Evidence
Observed after-change behavior
Proof is applicable and executed, using isolated Gateway state rather than a live operator deployment. At this PR head, the real SQLite retirement regression passed with these observations:
The participant lifetime regression separately proves root release while its tracked async scope still waits, for both persistence success and rejection. Its persistence callback is mocked; the retirement regression above uses the real SQLite path.
Latest local execution excerpts:
Exact-head CI completed successfully: 144 successful jobs, with 17 skipped jobs excluded from passing proof. The required CI/security gate also completed successfully. CodeQL was neutral, not counted as success.
Regression coverage and static checks
agentic-control-plane-agent-chatplan throughscripts/ci-run-node-test-shard.mts, default scheduling/forks: 81 files / 1,165 tests pass twice, in 230.79 s and 220.86 s. No timeout increases or worker-policy changes.pnpm check:changed --base 0e79899fedc26ae9a90a196a8bc41b97fd39d7e5run passed, including all selected typechecks, lint, dead-export scans, and guards. GitHub CI and review remain enforced merge gates.Local proof ran on Linux/Node 26 in the isolated task worktree. Initial unrelated mock-provider/CLI failures reproduced with ambient host settings: proxying loopback returned HTTP 502, and an inherited Gateway password changed token-only CLI auth-mode classification. The controlled rerun passed all nine affected tests after removing that password only from the test process and setting
NO_PROXY/no_proxyto127.0.0.1,localhost; external proxy settings and authorization checks remain intact. No unrelated production workaround was added.Worked on by
Work sessions
View the OpenClaw team session