Repository navigation
fix(sessions): keep history readers independent of host acquisition - #174586
Conversation
PR #174294 intentionally adds local client credential schema facts to the shared lazy SQLite catalog reader. The service anchor's lineage writer retains that reader, so its emitted closure includes the client catalog. Keep the exact artifact inventory and all unresolved-import assertions. Current-main baseline: 56 passed, one exact seventh-asset mismatch. After: 57 passed (122.56 s wrapper / 118.15 s Vitest). Targeted tsgo, type-aware lint, format, and P2 autoreview pass.
PR #174360 correctly requires the agent engine to revalidate retained maintenance authority, including ordinary forward opens. Importing that guard through the lease owner also pulled host state acquisition into the read-only history graph. Move the existing strict guard and its single AsyncLocalStorage context to a private leaf. Migrate every strict-guard consumer and the existing fault-injection spies. Lease identity, expiry and scope checks are unchanged. Baseline: history import boundary fails with engine -> lease -> host state. After: all 42 focused history, maintenance and migration tests pass; wrapper source closure 3/3 passes. Targeted types, lint, formatting and P2 review pass. PostgreSQL migration execution remains PR CI proof (no local server).
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesMoves the maintenance guard into a private leaf module, updates its consumers, and repairs two existing test expectations or cleanup paths. Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This PR repairs a current import-boundary regression while preserving maintenance authority checks; no actionable introduced defects were found, and current-head CI remains unresolved. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherHistory readers open existing agent databases through the engine adapter; maintenance callers supply the retained lease context that authorizes migrations and archive publication. flowchart TD
A[History readers] --> B[Read-only database opener]
B --> C[Agent engine adapter]
C --> D[Maintenance authority leaf]
E[Maintenance lease owner] --> D
F[Migration and archive writers] --> D
Technical reviewBest possible solution: Retain the strict guard in the private leaf and complete native landing once the current-head CI gate is resolved. Do we have a high-confidence way to reproduce the issue? Source establishes history reader → read-only opener → engine → lease → host state acquisition, contradicting the existing architecture assertion; no target code was executed during this review. Is this the best way to solve the issue? Moving the unchanged guard and shared context together fixes the dependency at its producer while retaining lease ownership and every existing effect-boundary check. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6c07f3ddc035. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -3, Tests +3, Other +1. Total +1 across 16 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 HistoryReview history (1 earlier review cycle)
Reviewed October 16, 2026, 4:36 PM ET / 20:36 UTC (Revision 2). |
CI finished the first resume case but root removal raced asynchronous agent-database resource retirement and failed with ENOTEMPTY. The synchronous close API starts that retirement without joining it. Await the existing async owner before the shared fixture removes its root. Keep every assertion and deadline unchanged. All six file cases pass locally (38.36 s wrapper); targeted types, type-aware lint, format and isolated P2 review pass. The CI failure is not claimed to be a regression caused by the history import repair.
Integrate main a3355d9 and resolve the engine import conflict from #174036. Retain both schema-version imports and the strict authority guard from the private maintenance-authority module. No unrelated repair edits. Focused proof: 107 tests across the relay inventory, wrapper closure, history imports, maintenance, storage migration and Doctor migration suites; 22 PostgreSQL tests across four direct engine/owner/port/migration suites. Targeted typechecks, type-aware lint, formatting and isolated P2 review pass. No CI dispatch or rerun.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…penclaw#174586) * test(build): include client catalog in service relay closure PR openclaw#174294 intentionally adds local client credential schema facts to the shared lazy SQLite catalog reader. The service anchor's lineage writer retains that reader, so its emitted closure includes the client catalog. Keep the exact artifact inventory and all unresolved-import assertions. Current-main baseline: 56 passed, one exact seventh-asset mismatch. After: 57 passed (122.56 s wrapper / 118.15 s Vitest). Targeted tsgo, type-aware lint, format, and P2 autoreview pass. * fix(sessions): keep history readers independent of host acquisition PR openclaw#174360 correctly requires the agent engine to revalidate retained maintenance authority, including ordinary forward opens. Importing that guard through the lease owner also pulled host state acquisition into the read-only history graph. Move the existing strict guard and its single AsyncLocalStorage context to a private leaf. Migrate every strict-guard consumer and the existing fault-injection spies. Lease identity, expiry and scope checks are unchanged. Baseline: history import boundary fails with engine -> lease -> host state. After: all 42 focused history, maintenance and migration tests pass; wrapper source closure 3/3 passes. Targeted types, lint, formatting and P2 review pass. PostgreSQL migration execution remains PR CI proof (no local server). * test(gateway): drain agent resources before removing resume fixture CI finished the first resume case but root removal raced asynchronous agent-database resource retirement and failed with ENOTEMPTY. The synchronous close API starts that retirement without joining it. Await the existing async owner before the shared fixture removes its root. Keep every assertion and deadline unchanged. All six file cases pass locally (38.36 s wrapper); targeted types, type-aware lint, format and isolated P2 review pass. The CI failure is not claimed to be a regression caused by the history import repair.
What Problem This Solves
Restores the history-reader import boundary broken by the agent-engine migration guard in #174360.
User Impact
No change to migration permissions or normal history results. Read-only history code no longer loads the host state-acquisition module just to reach the retained maintenance-authority check.
Why This Change Was Made
The engine imported its strict guard from the lease module, introducing
history reader → readonly open → engine → lease → openclaw-state-db. #174360 explicitly requires that “the family guard also runs for ordinary forward opens,” so removing the guard would be wrong.Move the existing guard and its single AsyncLocalStorage context into a private leaf module. The lease owner retains publication/renewal; all strict-guard consumers and their existing fault-injection spies use the leaf. Expected-context identity, live lease ownership and scope admission checks retain their order and behavior. There is no compatibility re-export, new authority mechanism, schema change, or migration change.
Evidence
Current-main baseline reproduced the exact forbidden backedge (4 pass / 1 fail). The existing architecture assertion remains unchanged.
Focused history-reader, maintenance, transcript-directive migration and historical-media migration suites cover the moved guard's consumers, including authority expiry before transaction commit, archive rename and final publication. All 42 focused cases passed (174.09 s including worker compilation); the wrapper inventory passed all 3 cases (6.93 s). Targeted source/test typecheck, type-aware lint, formatting, and isolated P2 autoreview pass. The native worker bundle builds successfully. Wrapper source-closure proof includes the new private leaf.
The PostgreSQL engine receives the same strict guard. After integrating main, all 22 cases in the direct engine, agent database owner, port, and Doctor PostgreSQL suites passed locally against the CI-pinned image, including the v27→v28 rollback cases. The temporary database was removed after proof.
The same change also updates the exact service-relay artifact inventory for the client SQLite catalog intentionally added by #174294. The runtime lineage writer retains the shared lazy catalog reader; the new catalog is a required emitted asset. All no-extra-chunk and unresolved-import checks remain. Its full test file moved from 56 pass / 1 fail to 57 pass (122.56 s wrapper), with targeted types, lint, formatting and separate P2 review passing.
The direct push of the test-only commit lost a main update race before writing any ref. Both reviewed fixes are included here for one CI run. No CI dispatch or rerun was used.
CI follow-up
The first CI run, 38954337120, exposed an existing worker-resume fixture cleanup gap: the case body completed, but root removal raced asynchronous database-resource retirement and failed with
ENOTEMPTY. The follow-up awaits the existing async close owner before root removal. All six cases pass locally (38.36 s wrapper); targeted types/lint/format and P2 review pass. Every assertion and deadline is unchanged.That run also hit the pinned-Bun CLI fork-recovery deadlock at its unchanged 100-second guard. It reproduces on this candidate and on clean base
746a52a3618ewith the same no-output/no-diagnostics failure; the earlier #174545 independently records it on unchanged main. This remains an inherited CI failure, not a passing check or a repaired runtime. No retry, timeout change, skip or CI rerun was used. The previous auto-merge request was retired through native recovery before publishing the real fixture repair.The prior head's run 38956699936 repeats that CLI deadlock and reports seven offline-maintenance refusals in
sessions.abort-durability.test.ts. The abort suite passed all seven cases on the prior PR head. All seven failures reproduce on the run's exact protected-main parentf2f87767245f(46.79 s), with the same shared-state broker-admission stack. The test, shared-state authority owner, broker admission/reply and replacement worker have identical blobs between that baseline and the tested mergec229587471e2. These failures are inherited from the newer main context, not claimed fixed here; admission checks and every abort assertion remain intact. These observations qualify only the prior head; the new head requires its own CI result.Main integration and current proof
Merged main
a3355d9ef3d24cb6d89bb2fce84161ce996028b0into the PR asac02919bea050cfd3276457cd95edfb233babc8c. The single engine import conflict from #174036 is resolved by retaining main's new schema-version imports and this PR's maintenance-authority import. The final diff against that main remains the same 16-file repair; no unrelated repair edits were added.On the merged tree, 107 cases passed across the relay inventory, wrapper closure, history imports, maintenance, storage migration, and Doctor migration suites (356.41 s including worker preparation). Another 22 cases passed in the four PostgreSQL importer/owner suites (160.76 s including catalog verification and worker preparation). The generated PostgreSQL catalog reported zero unexplained differences. All tests used one worker; assertions, coverage and deadlines are unchanged.
Targeted source/test typechecks, type-aware core and tooling lint, formatting, and isolated P2 review passed. The review found no actionable P0–P2 findings. No CI workflow was dispatched or rerun. The PR remains ready for the lead to land after the new head's CI; prior-head CI is retained only as prior-head evidence.