Repository navigation
fix(hooks): avoid blocking CLI during relay lookup - #148102
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: blocked before merge. Reviewed September 14, 2026, 5:36 PM ET / 21:36 UTC (Revision 7). ClawSweeper reviewWhat this changesMoves native-hook CLI database lookups into a dedicated worker, shares existing query and error handling, and updates worker packaging and regression coverage. Merge readiness⛔ Blocked before merge - 1 item remains The fix remains necessary on current main, and no actionable patch defect was found. The previous migration blocker is inapplicable: the patch preserves the stored format, schema admission, and decoding semantics. Priority: P2 Review scores
Verification
How this fits togetherThe native-hook CLI receives hook arguments and input, reads a stored locator, and sends an authenticated request to the local relay. This change moves the database read off the CLI thread while preserving the existing response and fallback paths. flowchart TD
A[Hook arguments and input] --> B[Native-hook CLI]
B --> C[Read-only locator worker]
C --> D[State database]
D --> E[Schema check and row decoding]
E --> F[Close database and join worker]
F --> G[Authenticated local relay]
G --> H[CLI output]
B --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +89, Tests +127, Docs +5, Other +5. Total +226 across 17 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one shared locator query and decoder, execute the cold read off-thread, and preserve existing admission, cleanup, deadlines, and fallback behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main executes synchronous SQLite operations on the CLI thread, and the supplied before/after CLI evidence measures those calls. This read-only review did not rerun the scenario. Is this the best way to solve the issue? Yes. Reusing the worker transport and existing query/decoder removes caller-thread SQLite work without introducing a competing storage owner or changing persistent contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eb38ff8353dd. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
2834fc7 to
6b099d0
Compare
|
@clawsweeper re-review Please refresh the review for |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Please refresh for |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d5088db to
c3caa9d
Compare
|
@clawsweeper re-review The branch now includes the merged fixture prerequisites from main. The current PR body records the preserved locator behavior and deadlines, 30 focused tests, the full build and changed gate, generated CLI proof with zero host SQLite calls, and fresh independent review. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
c3caa9d to
6b25630
Compare
|
@clawsweeper re-review The branch now includes the verified main routing repair. The current body records exactly one canonical wizard recovery route, five fresh locator/import cases, preserved deadlines, and the retained build/static/generated-CLI proof for unchanged locator inputs. All 17 reviewed PR files are unchanged. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* fix(hooks): avoid blocking CLI during relay lookup * test(hooks): cover standalone locator build graph * test(e2e): isolate server-error probe classification
What Problem This Solves
Fixes blocking SQLite reads on the native-hook CLI thread when locating a registered relay, even though the lookup already returns a Promise.
User Impact
Cold CLI locator reads execute on a worker while preserving command output, loopback authentication, schema admission, retries, and deadlines. No configuration or data migration is required.
Why This Change Was Made
The cold CLI uses the existing worker transport for its read-only lookup and joins the worker before consuming its result. The worker shares the query and row decoder with the existing relay store and stays outside shared-state writer startup. Native error serialization is extracted from its existing owner, with canonical schema-error hydration retained at the caller. Standalone runtime entries are bundled independently.
Data-model compatibility: the read-only worker retains the schema-version guard, uses the same locator SELECT, and consumes the unchanged row decoder. No table, column, stored row, or schema version changes. The extracted error schema describes an existing in-memory response shape, not stored data. The source links establish that no migration is introduced; the existing runtime review also resolved this compatibility concern without patch or security findings. Maintainer disposition of Revision 5: its data-model checkbox is inapplicable because the tagged caller and worker preserve the stored format and all admission/decoding contracts, as that review itself confirms. No migration or schema change is required.
Evidence
fs-safe0.11 update. That evidence is retained: all 17 reviewed PR files are unchanged, and the latest main intersection only adds an unused named filesystem-helper re-export. The five current cases verify module evaluation and the actual compiled-worker flow. Independent P2 review remains clean.Focused command:
node scripts/run-vitest.mjs src/cli/native-hook-relay-cli.locator-worker.test.ts src/cli/native-hook-relay-cli.import-boundary.test.ts test/scripts/tsdown-runtime-config.test.ts.Gateway-side relay persistence remains with its existing owners and is outside this cold locator read change.