Repository navigation
refactor(hooks): run bridge storage off the calling thread - #149397
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, 2:41 AM ET / 06:41 UTC (Revision 5). ClawSweeper reviewWhat this changesMoves native-hook bridge storage into OpenClaw’s shared database worker and routes affected tests through worker-capable runners. Merge readiness✅ Ready for maintainer review The change remains useful: current main still performs bridge SQLite work on the calling thread. No actionable introduced defect was found, and the maintainer-authored PR is protected from automatic closure. Priority: P2 Review scores
Verification
How this fits togetherThe native-hook bridge lets hook CLI processes locate and contact an active OpenClaw relay. Its storage owner publishes, renews, reads, and removes the local endpoint record while the relay lifecycle controls readiness and cleanup. flowchart TD
A[Relay registration or renewal] --> B[Shared database worker]
B --> C[Check current host registration]
C --> D[Bridge locator database]
E[Hook CLI] --> F[Read-only locator worker]
F --> D
F --> G[Authenticated local relay]
H[Relay cleanup] --> B
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +148, Tests +50, Docs +13. Total +211 across 23 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one shared-worker storage owner while preserving live registration checks, conditional row mutations, and settlement before listener closure. Do we have a high-confidence way to reproduce the issue? Not applicable as a refactor review; current-main source directly confirms synchronous SQLite inside the asynchronous facade, but this review did not measure runtime blocking. Is this the best way to solve the issue? Yes. Reusing the canonical database worker and extracting the existing SQL preserves one storage owner without introducing a parallel implementation or changing persisted contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 199039e7d5ff. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
a5cc31b to
a00acec
Compare
a00acec to
52b0401
Compare
|
Merged via squash.
|
What Problem This Solves
Native hook relay registration, renewal, lookup, and cleanup return promises but still execute SQLite on the calling thread.
User Impact
Bridge persistence runs on the shared-state worker while preserving readiness, expiry, stale-owner rejection, and cleanup ordering. No configuration, schema, or retention change is required.
Why This Change Was Made
The store sends typed operations to the canonical worker. Publication and renewal ask the live host to validate the current registration inside the write transaction. Pruning keeps process-liveness planning on the host and compares the complete candidate with the current row before deletion. Accepted bridge operations remain drained before owned removal and listener closure. The cold CLI locator keeps its existing worker; the test-only reset helper retains native cleanup without adding a production worker command.
The shared admission prerequisite, #148623, is now landed in
2fa9fe3825fa6973069e17b298f7d765ac0d646d. This branch carries only the relay change on main containing that commit.CI on the previous head exposed incomplete test routing: the CLI fixture and aggregate Codex extension runs could still reach the broker from a Vitest thread. These consumers now use the canonical worker inventories. The two redundant Codex leaf owners are removed, the Gateway fixture uses its Gateway worker owner, and the CLI fixture awaits canonical database cleanup.
Evidence
69bb8f6, including all selected type graphs, lint, storage guards, and import-cycle checks. The composition ontodb1d5d2preserves that feature delta and both relay and subagent commands in the shared worker; fresh core, state/agent test, and root test types and independent P0–P2 review passed. The subsequent carry onto932846b5preserves the exact patch and all 23 source-file bindings, incorporating the canonical UI/Goal and planner-fixture fixes from fix(cron): suppress control tokens and retain retry usage #149697 and fix(ci): accept file paths in extension packing fixtures #149726. The unchanged native proofs and complete gate run were not replayed; they remain attributed to their qualified candidates.No provider, live PID, held-lock, fault, or orphan scenarios were run locally. The facade and packaged-command proofs remain distinct; previous-head CI is not claimed as current-head validation.
CI on
a00acecdalso recorded Gateway startup-close and Codex side-question close timeouts. Those failures are retained for attribution. Fresh CI run 35061856866 passed on52b040165188b9fa197642259a6d08061b339817, including every previously failing job. No timeout or assertion was weakened.