Repository navigation
perf(state): reuse admitted paths for agent database validation - #169701
Conversation
Keep validation receipts bound to the physical connection when a filesystem alias is retargeted. Reuse the canonical path already captured at open instead of synchronously resolving it on every validation read. Preserve path-only admission, revocation, and repair checks.
|
🦞👀 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. What this changesThis PR reuses each open agent database connection’s captured canonical path for validation lookup and publication. Example: An open /state/alias.sqlite connection points to /state/original.sqlite, then the alias is retargeted to /state/replacement.sqlite.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this focused performance and receipt-identity repair remains necessary on current main, and no actionable correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherAgent database openers capture physical identity and canonical path; session readers consume validation receipts from the process-local cache, with shared cells carrying revocation. flowchart TD
A[Database opener] --> B[Captured connection identity]
B --> C[Validation cache]
C --> D[Session readers]
E[Schema and lifecycle revocation] --> C
F[New path admission] --> A
Technical reviewBest possible solution: Use the connection-owned canonical path for handle-bound receipts while retaining physical admission, path-only checks, and shared revocation. Do we have a high-confidence way to reproduce the issue? Current-main lookup resolves the retargeted alias, finds the replacement receipt, and rejects its physical identity for the original connection; the extended regression exercises this exact path, though no tests were run during this read-only review. Is this the best way to solve the issue? Reusing the identity owner’s captured path fixes the lookup at its source and removes repeated filesystem work without introducing another state owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1e34f7505111. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -7, Tests +17. Total +10 across 2 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 12, 2026, 3:11 AM ET / 07:11 UTC. |
…claw#169701) Keep validation receipts bound to the physical connection when a filesystem alias is retargeted. Reuse the canonical path already captured at open instead of synchronously resolving it on every validation read. Preserve path-only admission, revocation, and repair checks.
What Problem This Solves
Agent and session reads repeatedly resolve the database pathname even though their open connection already owns a canonical path. Retargeting a symlink can also make that still-open connection lose its validation receipt.
User Impact
Keeps validation bound to the database the connection actually opened and removes synchronous filesystem work from repeated validation reads. No schema, configuration, or update migration changes.
Why This Change Was Made
Reuse the canonical path already captured by the connection identity owner for validation lookup, lifetime binding, adoption, and publication. Existing shared revocation cells still govern validity. Path-only readers, new admission, explicit invalidation, and repair retain their current filesystem checks.
Production LOC: −7. No additional cache or invalidation lifecycle.
Evidence
pnpm test src/state/openclaw-agent-db-identity.test.ts src/state/openclaw-agent-db-validation-cache.test.ts --maxWorkers=1: 59 passed. Overall cold local wall time 214.74 s, including compiler preparation; test execution was about 55 s across the two existing files. No new test file or added fixture boot.oxfmt, repository oxlint, andgit diff --check: passed. Independent autoreview: no actionable findings.These normalize the same mixed-workload window; they are not exclusive per-request attribution. Remaining native filesystem SELF was 11,523.5 → 9,398.0 ms in these separate samples, dominated by other owners, including filesystem watcher guards. Contention and the candidate cleanup failure prevent attributing that overall difference to this patch.
Full typecheck, suites, and other broad gates are delegated to this PR's CI. No Testbox/Crabbox leases were allocated; the Linux rig was used only for measurements. No production Gateway was accessed.