Repository navigation
fix(sqlite): prevent worker timeouts through state path aliases - #152190
Conversation
Register the shared worker's already-admitted raw and canonical database paths with its grant service. Native handles can report a canonical pathname even when the caller opened a symlinked state directory; the service must remain reachable while a synchronous writer waits on the worker's transaction. Keep current authority, the five-second admission budget, FIFO, and settlement ownership unchanged. Add real-worker forced-order regressions for successful renewal and revoked authority through an explicit directory alias, and document the retained identity boundary.
|
🦞👀 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 18, 2026, 6:11 PM ET / 22:11 UTC. ClawSweeper reviewWhat this changesRegisters SQLite worker grant services under their retained filesystem aliases so overlapping native writes do not cause worker timeouts. Merge readiness✅ Ready for maintainer review The alias-specific defect remains on current main, and this focused follow-up addresses it without changing authorization or storage contracts. No blocking correctness or security findings were identified. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's SQLite broker coordinates background database workers with synchronous writes in the host process. When a worker needs permission to finish a transaction, the waiting native writer must find and service its grant callback. flowchart TD
A[State operation] --> B[SQLite worker broker]
B --> C[Retained physical database aliases]
C --> D[Grant service registry]
E[Competing native writer] --> D
D --> F[Current authority check]
F --> G[Commit or reject worker write]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +8, Tests +126, Docs +3. Total +137 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep alias resolution with the physical database owner and reuse its retained paths while preserving existing grant checks, deadlines, and settlement cleanup. Do we have a high-confidence way to reproduce the issue? Yes: current-main registration and canonical native lookup establish the mismatch, and the supplied forced-order regression exercises it through a symlinked state directory. This review did not execute tests. Is this the best way to solve the issue? Yes: reusing the broker's retained physical identity fixes the shared lookup boundary without duplicating canonicalization in callers or changing persistence contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 52e409a739b1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready for Fresh current-main commands passed under Node 24.19.0: Both real-worker regression cases passed; the same cases failed before the alias repair. Fresh isolated P2 review found no actionable findings. The full selected changed-file gate had already passed for the identical patch and owner bytes before moving it onto current main; exact-byte comparison and these fresh checks preserve that attribution. The composed runtime proof passed five handoff pairs plus one fanout pair, 12/12 runtime cells without retries. All 24 Gateway logs and six suite logs were inspected; there were no admission refusals or history timeouts, and the maximum of 22 observed history handlers was 734 ms. The five SQLite production files match that proof exactly. Both prerequisites, #152050 and #152172, are now merged. The measured macOS alias defect remains distinct from the original Linux coordinator stall. ClawSweeper's latest exact-head review lists no findings or before-merge changes. This follow-up adds eight net production lines to reuse retained identity; authorization, settlement, schemas and timeouts remain unchanged. |
|
Merged via squash.
|
…pr-149099-main-20260918 * commit '795e460278d4f8f41545dc8b4a66da1d12defd90': (1902 commits) refactor(slack): share Markdown preparation (#149129) fix(tooling): release completed PR operations with exited loaders (#152209) fix(release): allow stable npm bootstrap under an operator soak waiver (#152206) fix(daemon): avoid false restart timeouts during slow startup (#151387) feat: read agent documents from a host-owned workspace (#150584) improve(startup): skip redundant single-agent directory checks (#152192) test(ui): await board widget readiness before size reports (#152198) perf(browser): move dashboard event discovery to SQLite worker (#151952) improve(auth): reduce pauses during concurrent credential reads (#152140) improve(ui): load older chat history in smaller pages (#152093) fix(release): reject incomplete legacy npm install trees (#152186) refactor: share current-conversation binding row serialization (#152134) test(tooling): preserve Node and terminal fixture ownership under Bun (#152187) fix(sqlite): service worker admission through retained path aliases (#152190) improve: reduce CPU work for long CLI reasoning streams (#152191) chore(ui): refresh control ui locales (#152196) test(subagents): align lifecycle retries with durable completion owners (#152184) perf(gateway): defer participant maps for owned sessions (#152097) refactor(stream): share auxiliary queue overflow handling (#149282) fix(test): execute CLI fixture preloads on Node and Bun (#152076) ...
…penclaw#152190) Register the shared worker's already-admitted raw and canonical database paths with its grant service. Native handles can report a canonical pathname even when the caller opened a symlinked state directory; the service must remain reachable while a synchronous writer waits on the worker's transaction. Keep current authority, the five-second admission budget, FIFO, and settlement ownership unchanged. Add real-worker forced-order regressions for successful renewal and revoked authority through an explicit directory alias, and document the retained identity boundary.
Related: #152050
What Problem This Solves
Completes the shared-state admission repair in #152050 for symlinked state directories. A worker could register its grant service under a caller's alias while
DatabaseSync.location()returned the canonical path. An overlapping synchronous native writer then missed that service, blocked until the existing five-second admission deadline, and caused a valid renewal to fail.Investigation context: Release Checks run 35382455441. The canonical coordinator-custody fix in #152050 landed as
bc9e86ff940cfd22f63744ded4911f89b6476bf8while this follow-up was being validated. This PR contains only the additional alias defect measured on macOS; the/varalias timing below is separate from the original Linux CI stall.User Impact
Shared-state worker writes, including native-hook relay renewal, remain serviceable when state directories use filesystem aliases such as macOS
/var. Current-owner checks still reject revoked writes. No schema, configuration, permission, deadline, or retry policy changes are introduced.Why This Change Was Made
The broker already retains the physical actor's admitted raw and canonical paths. Registering those paths alongside the caller's retained locations keeps the grant service reachable without filesystem discovery on the request path or separate fixes in each store caller. The existing operation admission still owns authorization; path registration grants no write authority.
The regression uses a real SQLite worker and an explicit directory alias. It observes the worker's transaction-grant request, then enters the competing synchronous native transaction while the normal host listener remains queued. The current-owner case must renew the persisted record; the revoked-owner case must preserve its previous expiry. It keeps the original five-second admission bound and all outcome assertions.
Production LOC: +21/-13 (net +8); tests: +126; docs: +3. Most of the production diff moves the existing dispatch closure to capture its already-resolved actor. The added behavior carries retained identity into service registration.
Evidence
2cfd36a9714c0c0f28d69a35df6753834dd23fceand passes with this repair under Node 24.19.0. An explicit fixture type annotation subsequently passed typechecking and the same two runtime cases without changing inputs or assertions./var/...and the native handle reported/private/var/.... The repaired raw-path flow completed in 39.6 ms and persisted the expected renewal.subagent-handoffruntime pairs and onesubagent-fanout-synthesissibling pair: 12/12 runtime cells, no retries. Inspection covered 24 Gateway logs and six suite logs, with zero admission refusals or history timeouts; 22 history responses had a maximum handler duration of 734 ms. All five SQLite production files are byte-identical between the frozen proof and this publication candidate. The only fixture difference is the erased record type annotation. This is composed evidence with fix(codex): deliver delegated results after the parent yields #152172, not standalone proof without that receipt prerequisite.{"handoffPairs":5,"fanoutPairs":1,"runtimes":["openclaw","codex"],"passedCells":12,"failedCells":0,"retries":0,"gatewayLogsInspected":24,"suiteLogsInspected":6,"historyResponses":22,"maxHistoryHandlerMs":734,"admissionOrHistoryTimeouts":0}Focused command:
node --import ./scripts/tsx.mjs scripts/test-projects.mts --maxWorkers=1 --reporter=verbose src/infra/sqlite-worker-shared-state-admission.test.ts.