Repository navigation
perf: separate async audit worker imports - #150107
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, 10:25 AM ET / 14:25 UTC. ClawSweeper reviewWhat this changesSeparates asynchronous audit writes into their own module so synchronous SQLite consumers avoid importing host-worker machinery. Merge readiness✅ Ready for maintainer review This remains a useful, narrowly scoped optimization absent from current main. No actionable correctness or security defect was found; the protected maintainer PR should continue through normal merge gates. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw stores configuration diagnostics and cron recovery records in shared SQLite storage. Configuration audit writes use the shared worker, while synchronous consumers use connection-bound operations. flowchart LR
A[Configuration diagnostics] --> B[Async audit module]
B --> C[Shared state worker]
D[Cron recovery records] --> E[Synchronous audit store]
C --> F[Shared audit kernel]
E --> F
F --> G[SQLite diagnostic records]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +3, Tests -4. Total -1 across 5 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep synchronous audit storage independent of host-worker imports while preserving the existing async writer and shared transaction kernel. Do we have a high-confidence way to reproduce the issue? Not applicable as a functional bug report; current-main source confirms the unwanted static dependency, while runtime timing was not independently reproduced. Is this the best way to solve the issue? Yes. Moving the unchanged internal function and all callers removes the dependency edge without duplicating persistence logic or retaining a re-export that would restore it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against afb631bf9efd. LabelsLabel 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
Synchronous audit-store consumers pull in the asynchronous host-worker machinery. The shared SQLite backend reaches that dependency through cron quarantine, even though it only needs connection-bound store operations.
User Impact
Synchronous consumers avoid the host-worker import graph. Configuration audit writes keep the same async registration function, payload capture, maintenance admission, authority checks and transaction behavior.
Why This Change Was Made
Move the existing async registration function unchanged into its own module and update its one production caller and two test imports. Keep the synchronous store and shared kernel unchanged. This separates the existing host and worker responsibilities without a new execution path, delayed import, cache, pool policy, schema or persistent representation.
The function body is byte-identical. Its internal path has no package or SDK export; a compatibility re-export would restore the eager dependency. Production growth is three import-boundary lines after accounting for the move; test imports shrink by four lines. No assertions or test bodies change.
Evidence
All 222 existing config-write cases pass with identical identities, outcomes and order. Another 90 existing audit-store, cron-store and agent-exec cleanup cases pass, including pruning rollback, sibling scopes, payload capture before yielding, quarantine timestamp/idempotence and cleanup before state removal.
During a real writer run, an external observer hash-verified the canonical compiled generation's static emitted imports. The shared backend and transport closure shrinks from 211 files / 2,390,980 bytes to 207 files / 2,334,984 bytes, with the host-owner chunk absent. Bare and dynamic imports were not traversed; this is static closure evidence, not a complete evaluated-module census.
The same-base Node 24.21 diagnostic pair completed all 162 worker lifetimes, with no failed or unmatched replies. Accumulated open-to-reply intervals were 48.58s before and 47.84s after; median 310.0ms and 303.4ms. That is a small single-pair observation. Instrumented wrapper time was 161.22s and 153.84s, but preparation and host variation prevent attributing the entire difference to this change. No aggregate CI saving is claimed.
Independent P0-P2 review and the full changed-file gate passed against the actual branch base. The full pnpm build passed, including declarations and built-plugin validation.