Repository navigation
fix(doctor): keep SQLite worker debug logs out of JSON output - #150184
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 16, 2026, 1:13 PM ET / 17:13 UTC. ClawSweeper reviewWhat this changesRoutes SQLite worker diagnostics to stderr and adds regression coverage that preserves JSON stdout through worker startup, execution, and close. Merge readiness✅ Ready for maintainer review The PR remains useful: current main still allows worker diagnostics to contaminate structured stdout. The focused repair has no identified blocking correctness or security findings. Priority: P2 Review scores
Verification
How this fits togetherSQLite workers perform database operations for OpenClaw commands and return results through a message port. Their separate logging state determines whether diagnostics interfere with the command’s machine-readable output. flowchart LR
A[CLI command] --> B[SQLite worker broker]
B --> C[Worker backend]
C --> D[Message port results]
D --> E[JSON stdout]
C --> F[Worker logging]
F --> G[Diagnostic stderr]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +3, Tests +78. Total +81 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep diagnostic routing in the generic worker bootstrap so every backend preserves command stdout throughout its lifetime. Do we have a high-confidence way to reproduce the issue? Yes, from source: enable debug logging while a worker-backed JSON command runs; the worker’s independent default logging state permits diagnostics on stdout. The supplied regression exercises this boundary, but this read-only review did not execute it. Is this the best way to solve the issue? Yes. Initializing the existing logging owner before backend loading fixes the producer boundary without adding configuration, changing database contracts, or duplicating routing logic. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a194d5538e46. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Doctor JSON output can become invalid when a SQLite worker emits debug diagnostics during a database read.
User Impact
Worker-backed commands preserve machine-readable stdout while keeping subsystem diagnostics visible on stderr, including when
OPENCLAW_LOG_LEVEL=debugis enabled.Why This Change Was Made
SQLite worker results already travel over their host message port. Each worker has separate logging state, so the caller’s JSON routing does not govern its diagnostics. Enable the existing stderr route in the generic worker bootstrap before backend loading and retain it through close. Result framing, database admission and lifetime, log level, and cleanup budgets are unchanged.
Evidence
An isolated published-driver upgrade cell exposed the defect in selected Doctor lint: its complete raw stdout started with a SQLite budget diagnostic and failed JSON parsing. The earlier updater boundary passed independently; the overall cell remains a failure.
A regression using the actual broker and worker thread reproduces the stdout contamination before the fix and checks exact JSON output plus stderr diagnostics through backend close afterward. Its backend is pure and performs no native database work. All 55 focused tests, the full scoped
check:changedgate, targeted lint, and fresh P2 review pass. No updater or failing native scenario was replayed. The corrected combined Doctor cell has not been rerun; its original failure remains retained.