Repository navigation
fix(state): reuse prepared owners for session inspections - #188070
fuller-stack-dev wants to merge 3 commits into
Conversation
OpenClaw-Publication: 8a68b38c-d835-4354-8970-3ee41449faa1
|
🦞👀 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 changesReuse an already-prepared agent database connection for eligible exact-session inspections while retaining the existing private-reader fallback. Example: Repeated readiness observations for agent:main:inspection after committed session updates.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a concrete database-sized copying cost still present on current main; no actionable introduced defect was found, and required CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherSession readiness requests pass through the history-reader owner, which selects a prepared agent executor or private reader and returns bounded session facts under current source and disclosure checks. flowchart TD
A[Session readiness request] --> B[History reader owner]
B --> C[Prepared executor eligibility]
C --> D[Existing native connection]
C --> E[Private reader fallback]
D --> F[Exact session facts kernel]
E --> F
F --> G[Current authority and disclosure checks]
Technical reviewBest possible solution: Use the existing executor and query kernel for eligible warm inspections while preserving cold fallback, physical identity, live authority, and accepted-work settlement. Do we have a high-confidence way to reproduce the issue? Current-main source directly shows the private-image path, and the committed readiness regression measures it after real updates; no target code was executed during this review. Is this the best way to solve the issue? The change removes unnecessary copying at the existing execution owner, reuses the exact-facts kernel, and preserves justified fallback paths without introducing a cache or competing owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bef0acc094c0. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +323, Tests +627, Docs +12, Other +2. Total +964 across 21 files. Added test files: 3. 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 29, 2026, 11:46 PM ET / October 30, 2026, 03:46 UTC. |
|
Thanks for digging into this, @fuller-stack-dev. The prepared-owner borrow is careful work, and the regression that reproduces the private image on each warm read was useful. I'm closing this because #188025 (merged as bdaf7df) removes the cause rather than reducing it:
If other inspection paths, such as Doctor, would still benefit from borrowing a prepared owner, please open that as a separate PR scoped to those callers. #188009 (byte copy instead of reflink) may also still be worth it for Doctor-side copies. Thanks again. |
What Problem This Solves
Repeated artifact-preserving session readiness reads can materialize the whole agent database and WAL, even when its execution owner already has a prepared native connection. On large stores, that turns a bounded session lookup into database-sized I/O and temporary allocation.
Follow-up to #187152. Complementary to #188009 (inspection transfer policy) and #187989 (history-read writer admission); this does not duplicate either change.
User Impact
Eligible warm exact-session inspections now query the already-prepared agent executor’s existing connection. They do not create another execution owner, open another native connection, or copy a database image. Cold, synchronous-host, unprepared canonical, and active-transaction cases retain the existing private-reader fallback.
This does not eliminate initialization/recovery copies, change SQLite durability or retention, or establish that all Team-server latency and disk growth are resolved. No deployment or restart is included.
Why This Change Was Made
The registered readiness regression reproduced a private image equal to the database plus WAL on each warmed observation, growing after a real committed update. The fix adds a strict prepared-generation borrow and non-opening worker accessor, then reuses the existing exact-facts kernel. It cannot enter generation creation, replacement, preparation, or schema-refresh paths.
Existing physical-source validation, canonical readiness, live request authority, cancellation, and accepted-work settlement remain authoritative. Plain ineligibility may use the old reader; revoked authority, changed identity, abort, and invalidated validation fail rather than selecting another owner.
Evidence
Review and Validation Limits
Canonical independent API re-review completed on the final candidate at P0–P2: scoped-clean, both full-scope assessments complete, zero findings or filtered findings, and frozen source verified. Earlier findings covering post-query validation revocation, read-admitted startup fallback, and custody across prepared-read ineligibility are fixed with failing-before/passing-after controls. A separate native peer-review attempt timed out without a verdict and is not counted as approval.
The supported typecheck wrapper rejects the required canonical pnpm global-store layout before compiler launch with “Declaration input escapes checkout.” The wrapper, boundary implementation, package manifest and lockfile are unchanged from the base. Supplementary pinned-compiler checks show no touched-file diagnostics, but report unrelated transport/UI diagnostics; no clean typecheck is claimed. PR CI remains a separate gate.