Repository navigation
fix(sqlite): preserve final worker diagnostics during close - #150511
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 17, 2026, 1:09 AM ET / 05:09 UTC (Revision 3). ClawSweeper reviewWhat this changesPreserves final SQLite worker diagnostics by draining console output before acknowledging close and moves the existing drain helper into a shared process module. Merge readiness✅ Ready for maintainer review The fix remains useful: current main still acknowledges final worker close without draining diagnostics. No blocking correctness or security defect was found, and GitHub confirms successful CI for the reviewed head. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s SQLite broker sends database operations to worker threads and retires workers after their backends close. Diagnostic output travels separately from operation replies, so shutdown must allow that output to drain before retirement. flowchart TD
A[Store close request] --> B[SQLite broker queue]
B --> C[Worker closes backend]
C --> D[Release delegation resources]
D --> E{Successful final backend close?}
E -->|Yes| F[Bounded console drain]
E -->|No| G[Send operation reply]
F --> G
G --> H[Broker continues or retires worker]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +7, Tests +3, Docs +5. Total +15 across 10 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one shared bounded output-drain owner and complete final worker shutdown only after backend cleanup and the drain attempt. Do we have a high-confidence way to reproduce the issue? Yes: final-backend teardown diagnostics can race the broker’s immediate worker termination, and the existing real-worker logging fixture supplies a focused regression path. This review verified the source mechanism without executing it. Is this the best way to solve the issue? Yes: delaying only the successful final-close reply addresses the race at its owner while reusing existing drain behavior and preserving failure handling. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 92fdb4bfe91e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Drain output before acknowledging a successful final backend close, after native and delegation cleanup. Reuse the existing five-second best-effort output drain for CLI exits, native hook relays, and sealed worker errors. Forced and failed retirement keep their existing behavior. A bounded close burst makes the existing real worker logging regression fail before this change. The repaired path passed 156 focused tests and a final logging rerun. Selected checks and independent P2 review passed; the initial aggregate lint error was corrected and verified separately.
4ba658c to
fd7c5b3
Compare
|
Merged via squash.
|
Combine main 8dd36a0 with the reviewed final-worker output drain from #150511 at 4ba658ce6c34443796e1d61a3f2230ba08de4041 for local integration proof. Preserve the extracted model-source owner with the current reader contract and keep final output drainage before owned reply transfer. The public #149971 branch remains unchanged until its prerequisites land. Validation: 114 focused tests passed; 2 existing Linux-only skips. Full build, resolution formatting, and fresh independent P2 review passed.
) Drain output before acknowledging a successful final backend close, after native and delegation cleanup. Reuse the existing five-second best-effort output drain for CLI exits, native hook relays, and sealed worker errors. Forced and failed retirement keep their existing behavior. A bounded close burst makes the existing real worker logging regression fail before this change. The repaired path passed 156 focused tests and a final logging rerun. Selected checks and independent P2 review passed; the initial aggregate lint error was corrected and verified separately.
What Problem This Solves
SQLite workers can lose their final diagnostic lines when the last backend closes and the broker immediately terminates the worker.
User Impact
Graceful final-backend close gives pending console output a bounded chance to reach stdout/stderr before acknowledging completion, including when another open is queued. The existing five-second fallback makes this best effort. Database cleanup, queued-write settlement, and error/forced retirement retain their existing behavior.
Why This Change Was Made
SQLite replies and Node worker stdio use separate message channels, so a successful close reply does not prove buffered diagnostics were delivered. Drain output after backend and delegation cleanup but before the successful final-actor close reply.
The existing output-drain helper moves to
src/process; CLI exit, native-hook relay, and sealed-worker error callers move with it. Its callback behavior and timeout stay unchanged, and the old path is removed without an alias. The existing real-worker logging fixture gains a bounded teardown burst while preserving its exact JSON and terminal-diagnostic assertions.Evidence
The initial
check:changedrun passed its preceding guards, production/test typechecks, and export scans, then rejected an implicit-return Promise executor. That expression now uses the equivalent block body. Final targeted typed lint, the logging test, incremental core types, and the exact remaining guards passed; the original aggregate failure is retained rather than relabeled green. The full test suite was not run locally. The first PR CI run passed the real SQLite logging regression on Linux, including the terminal close diagnostic, with 563 passing and two skipped tests in its storage/runtime shard. That run remained red on unrelated Control UI, Qwen, preparation-fixture, and compiler-tooling checks.The refreshed head includes the landed Control UI, Qwen, and preparation-fixture fixes. Its SQLite patch is byte-identical to the reviewed patch, and all ten accepted source-file hashes are unchanged. Required CI completed successfully for this exact head. Its first attempt cancelled two jobs before runner acquisition; the approved failed-only rerun completed both Node test shards on GitHub-hosted Ubuntu. The canonical watcher reports green and the exact run receipt confirms attempt 2 succeeded. Prior failures remain retained, and no test timeout or assertion was relaxed.