Repository navigation
fix(tasks): keep chat status reads responsive - #149738
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, 7:34 PM ET / 23:34 UTC (Revision 14). ClawSweeper reviewWhat this changesMoves chat task-status reads onto the existing asynchronous task reader so database contention does not block other Gateway work, while preserving task visibility and formatting. Merge readiness✅ Ready for maintainer review Keep open as a useful, review-ready fix: current main still performs synchronous chat task reads. No actionable patch defects remain, and the updated evidence addresses the previous test-cost follow-up. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s task registry combines persisted task records with accepted runtime updates. Chat commands select session-visible tasks or agent-level counts from that registry and format them into replies. flowchart TD
A[Chat tasks or status request] --> B[Existing command authorization]
B --> C[Asynchronous task reader]
D[Accepted task updates] --> C
E[SQLite worker and task projection] --> C
C --> F[Session selection or agent counts]
F --> G[Validate current reader]
G --> H[Formatted chat reply]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +45, Tests +241, Docs +6. Total +292 across 17 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep chat task reads on the canonical asynchronous reader, with unchanged visibility rules, accepted-write ordering, and synchronous formatting after currentness validation. Do we have a high-confidence way to reproduce the issue? Yes: holding SQLite custody while accepted task events precede a chat status read exercises the synchronous path still present on main. This review verified the source path and supplied runtime observations without executing tests. Is this the best way to solve the issue? Yes: extending the existing prepared reader is a focused repair that preserves selection and display semantics without introducing another storage owner or migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 21f3d71a09d4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (13 earlier review cycles; latest 8 shown)
|
Read /tasks and /status task snapshots through the canonical accepted-write fence and prepared read owner, preserving session visibility and strict agent-local counts without synchronous SQLite refresh. Keep the original race guards after a scoped worker-row fixture witness, and repair status fixtures to exercise successful replies. Include the canonical prepared-runtime fixture correction from 2e73d8e.
Preserve current-main terminal freshness, indexed identifiers, and expanded publication coverage while retaining asynchronous chat task status reads. Prepare persisted test fixtures before publication race guards without changing their deadlines, assertions, or the separate cold-read regression.
91a5b1d to
83b558b
Compare
Preserve main's fixed-prefix owner preparation and captured worker context for canonical owner rows while retaining session and agent status selectors. Resolve the query-test imports without dropping either contract or fixture.
Carry the asynchronous status readers onto the current canonical read and projection owners. Preserve settled-task and owner-currentness semantics. Join the lineage fixture accepted-event fence before its unchanged leak guard; pinned-main timing controls reproduce and fix premature polling.
Preserve the asynchronous status feature and its current-owner filtering while integrating the landed Stylelint and identifier-fixture repairs. Keep canonical identifier normalization with its existing write and Doctor owners; no duplicate fixture change remains.
|
Merged via squash.
|
…aw#149738) Read /tasks and /status task snapshots through the canonical accepted-write fence and prepared read owner, preserving session visibility and strict agent-local counts without synchronous SQLite refresh. Keep the original race guards after a scoped worker-row fixture witness, and repair status fixtures to exercise successful replies. Include the canonical prepared-runtime fixture correction from 2e73d8e.
What Problem This Solves
Fixes chat
/tasksand task details in/statusblocking other Gateway work while the task database is busy.User Impact
Task status stays responsive during database contention and includes task updates accepted before the read. Existing text, session visibility, agent fallback, and status overrides are preserved. No configuration or migration is required for this feature.
Why This Change Was Made
Both callers use the existing asynchronous task registry read owner, including its fixed accepted-write fence and bounded projection preparation. Session and strict agent selection share that prepared read; callers validate currentness immediately before formatting. The unused synchronous agent path is removed. Detached task execution retains its required synchronous session accessor, and current main retains ownership of identifier normalization and migration.
The existing lineage fixture joins its already-created accepted-event fence before checking for leaked Gateway work. Paired original-order controls reproduced the premature one-second leak check and verified the ordering repair without changing assertions or deadlines.
Evidence
Candidate:
324531fa81952a6146da6de75ec99bde02551364, incorporating canonical maind5b6e687ca30931c5b6a5e82b1ffbcb1d7162ba3.pnpm build sourcePerformancepasses on Node 24.21.0 in 51.3 seconds, including final metadata and cleanup. This is the runtime build profile, not a fresh declaration/UI build./tasks, contended registered/tasks, and contendedbuildStatusText. Both/taskscases record zero calls to six parent SQLite methods through canonical cleanup. Timers fire at 10.54 ms and 10.65 ms while the coordinator remains held and rendering is pending. Replies and durable readback retain accepted completion and tool count 1.One-worker costs (
pnpm test <file> --maxWorkers=1), measured on the byte-identical prepared sources:task-status.worker.test.tstask-registry-agent-events.lineage.test.tstask-registry-query.test.tsstatus-text.test.tscommands-status.test.tsThe worker regression measures real event-loop responsiveness while an actual SQLite coordinator is held; this requires the physical worker and timer. Transformation accounts for much of the wall time. CI per-file timing extraction remains unavailable after GitHub quota exhaustion; no zero-cost value is inferred.
Compiled proof uses the registered handler chain with prepared authorized context and the normal status-text entrypoint. It excludes inbound transport/authentication, the full
/statuswrapper, real providers, and an operator Gateway. Constructors, close methods themselves, and worker-realm SQL are outside the six-method meter. Linked dependency payloads are not exhaustively hashed; installation manifests are bound.The prior head's CI run 35532890794 failed a shared changed-lanes Stylelint expectation. Its canonical correction landed in #153982. The identifier-fixture import found during the carry landed canonically in #153988 (
1c2bdf3e26532e71ae3fbb189b5bc58671f288f6). Both corrections are now incorporated from main; no duplicate fixture fix remains. Exact-head CI run 35538580296 completed successfully for324531fa81952a6146da6de75ec99bde02551364: all 163 jobs completed with zero failures.The lineage fixture now passes the required repetition campaign on exact candidate
324531fa81952a6146da6de75ec99bde02551364: 20 whole-file standalone runs (16 cases each) and three original Status eight-file shards (216 cases each), in the order original shard, 20 standalone runs, then the remaining two shards. All 968 case executions pass, including 368 lineage executions. These are repeated measurements, not additional unique coverage. No test failed or was retried; two pre-test harness/runtime preflight failures are retained and excluded. Every invocation verifies source identity, recorded file order, and observed child completion. The 62 bound source/installation files, complete 13,204-entry dist inventory, recorded Node 24.21.0 executable, and original build log match before and after; no rebuild or separate compiled three-scenario rerun occurred.For these exact-candidate repetitions, standalone wrapper wall time is 20.146 s median / 33.082 s maximum; the reported per-case time sum is 9.743 s median / 14.115 s maximum. Original-shard wrapper wall time is 75.275 s median / 151.915 s maximum; the lineage file's reported per-case time sum within those shards is 8.829 s median / 11.119 s maximum. All shard files have separately retained per-case costs. Case-time sums are rounded reporter measurements, not per-file wall time or compiler/import time. CI per-file wall/timing extraction remains unavailable.