Repository navigation
refactor(tasks): move state notification acknowledgements off the Gateway thread - #151815
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 21, 2026, 3:02 PM ET / 19:02 UTC (Revision 10). ClawSweeper reviewWhat this changesMoves task-notification acknowledgment writes into the existing database worker while preserving the originating run, delivery watermark, and cleanup settlement. Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: current main and the latest release still need this repair. Prior findings are resolved, and the reviewed diff has no new blocking correctness defect. Priority: P2 Review scores
Verification
How this fits togetherThe task registry turns background-task events into channel messages or queued session notifications. After delivery, acknowledgment records prevent repeated notifications and update the task’s activity timestamp. flowchart TD
A[Background task event] --> B[Capture task and event identity]
B --> C[Prepare notification]
C --> D[Channel send or session queue]
D --> E[Database worker acknowledgment]
E --> F[Recheck current ownership and task run]
F --> G[Persist watermark and timestamp]
G --> H[Publish committed task state]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +342, Tests +732, Docs +10. Total +1084 across 29 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the existing worker and publication owners for acknowledgments, with the coordinated child completing notification preparation and terminal persistence. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main acknowledges by task ID after delivery waits, permitting a replacement run to receive the old acknowledgment, and performs those writes synchronously. No runtime reproduction was executed here. Is this the best way to solve the issue? Yes. Reusing the existing worker, admission, and publication owners is a focused repair, and the coordinated child explicitly owns the remaining synchronous notification work. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b485dd0b988f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
d5cdb89 to
057207f
Compare
Retain the producing task identity through delivery and acknowledgement, preserve monotonic watermarks and requester origins, and settle queued acknowledgements through cleanup. Carry current registry batching and the canonical lineage fixture fence. Private qualification checkpoint for #151815. Current main has an unresolved TS2345 in update-triage-resolution.ts; publication remains pending its canonical repair.
Preserve the reviewed acknowledgement patch and current task event preparation and publication owners. Include the canonical formatter arity repair from main; all three previously blocked type graphs now pass.
Preserve the acknowledgement feature unchanged while incorporating the landed identifier fixture correction and current filesystem dependency owner. Current core and affected test type graphs pass.
cd0f00d to
125d471
Compare
|
Merged via squash.
|
Join real task-delivery promises before the maintenance fixtures close SQLite. Observing queued system events does not imply worker-backed acknowledgements have settled; retain the existing delivery owner and propagate failures. Repairs CI run 35661057519 job 106536622445 after #151815. All 48 maintenance, delivery-lifetime, and state-notification tests pass (44.21s wrapper); selected agents-other type graph, formatting, lint, and independent P2 review pass. The local baseline passed and does not erase the observed hosted race.
…eway thread (openclaw#151815) * fix(tasks): persist state notification acknowledgements in worker Retain the producing task identity through delivery and acknowledgement, preserve monotonic watermarks and requester origins, and settle queued acknowledgements through cleanup. Carry current registry batching and the canonical lineage fixture fence. Private qualification checkpoint for openclaw#151815. Current main has an unresolved TS2345 in update-triage-resolution.ts; publication remains pending its canonical repair. * test(tasks): join event retirement before leak checks * test(tasks): join native notification fixture deliveries
Join real task-delivery promises before the maintenance fixtures close SQLite. Observing queued system events does not imply worker-backed acknowledgements have settled; retain the existing delivery owner and propagate failures. Repairs CI run 35661057519 job 106536622445 after openclaw#151815. All 48 maintenance, delivery-lifetime, and state-notification tests pass (44.21s wrapper); selected agents-other type graph, formatting, lint, and independent P2 review pass. The local baseline passed and does not erase the observed hosted race.
Related: #151917
What Problem This Solves
State-change notifications write acknowledgments on the Gateway thread, and delayed acknowledgment can target a replacement task run.
User Impact
Acknowledgment writes use the existing state worker while preserving sent/session-queued outcomes, producing task identity, newest watermarks, and current requester origin. No configuration, schema, retention, or operator change is required.
Why This Change Was Made
Capture task receipt and event before preparation/transport yields, revalidate the original run before persistence, and retain separate best-effort watermark/timestamp transactions. Join already-started acknowledgment work during cleanup without replaying committed writes.
This remains the parent of the coordinated two-PR sequence. Complete Terminal candidate
8964be4e0d9dbebee0ae80f35945482b1f1f3162contains terminal persistence and asynchronous preparation; keep it queued and verified before this parent lands, then land the child.Evidence
ACK
6d32972d295dd1eb2dacccf3ae9b3f889ccc7abb, tree96d793758790101c921d15dbc1a6f32dd705a7fe, merges the qualified public ACK with pinned main6d65c8b7f229641bf9b32e16da2c0fec1b64079f. The automatic merge is clean, with exact ordered additions/removals preserved across all 29 feature files. The previous ACK qualification remains attributed to its source: P2 clean and 77 intersection cases across three files passed in 119.50 seconds. Complete Terminal has separate reader review, targeted checks and compiled proof on its production-identical predecessor 0155; those complete-caller results are not a standalone ACK claim.This PR qualifies worker-backed acknowledgment writes, not zero SQLite calls across the complete notification caller. Complete-caller Node/Bun measurements belong to the composed Terminal candidate; historical measurements retain their original source bindings. The complete Terminal candidate stays queued before ACK landing. Existing public history and the original two-PR dependency remain intact; hosted exact-union CI and native current-main admission remain pending.