Repository navigation
refactor(state): deslop sessions and state - #156541
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 27, 2026, 2:12 AM ET / 06:12 UTC (Revision 35). ClawSweeper reviewWhat this changesThe branch consolidates configuration, session, and SQLite state helpers and adjusts related QA fixtures while intending to preserve behavior. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 4 items remain The cleanup remains unique on current main. Source comparison does not support the prior whitespace finding: the shipped session helper already trimmed nonblank values. The remaining merge gate is compatibility proof for the changed migration and plugin-startup paths. Priority: P3 Review scores
Verification
How this fits togetherConfiguration and session actions feed the Gateway, while SQLite workers persist state and serve session reads. These helpers sit between those actions and worker replies, session views, and Doctor recovery. flowchart LR
A[Configuration and session actions] --> B[Shared config and session helpers]
B --> C[Admission and ownership checks]
C --> D[SQLite workers]
D --> E[Persisted state]
E --> F[Session views and Doctor recovery]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the consolidation after the shipped updater drives this candidate through a copied legacy-state upgrade and the resulting config, session rows, Doctor recovery, and Gateway restart are checked. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor, not a reported current-main bug. Source comparison is sufficient to reject the prior whitespace allegation. Is this the best way to solve the issue? Yes: consolidating the existing owners is a maintainable direction, and the inspected cutovers have no established correctness defect. The update path still needs proof with existing state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 702de400b4aa. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (34 earlier review cycles; latest 8 shown)
|
f523713 to
cbf2e05
Compare
68f42fd to
3e6808e
Compare
34778b4 to
6bb9350
Compare
239f27d to
158fffc
Compare
4256d13 to
90f0996
Compare
3de966b to
5ffd9b8
Compare
5ffd9b8 to
d23dca4
Compare
d23dca4 to
eadc3ea
Compare
4559643 to
caff8e7
Compare
* refactor(state): deslop sessions and state * refactor(state): reuse config and session helper owners * refactor(config): reuse Talk normalization helpers * refactor(state): complete reader and cleanup cutovers
What Problem This Solves
Session, configuration, and SQLite state helpers repeat traversal, row mapping, worker replies, query construction, and cleanup bookkeeping, leaving multiple places to maintain the same behavior.
User Impact
No intended behavior change. Public SDK contracts, config semantics, session ordering and authority checks, SQLite schemas, persisted state, retention, indexing, concurrency, recovery, projections, and upgrade behavior remain unchanged. Write transactions remain synchronous.
Why This Change Was Made
Repeated work moves to its existing owner. The rebase keeps main's behavior and drops superseded simplifications.
Simplifications and rationale
Rebase and scope
Rebased onto
1c8b3187353b1d7b69faf66ca053bcb2257221f3. Candidate head:caff8e78e2efc6a0ae0e142068738e4bcd0dd4bf; source tree:9167d7fdca81fe960a43ccd4ab25eb0670a491fa.All four simplification commits remain. Three are patch-identical. The first has two mechanical adaptations for main's interrupted-migration repair (#159345): the shared admitted worker callback still forwards
processBound, and the worker keepsreclaimDeadOpenClawStateLeaseInTransactionwhile removing its now-unused direct expiry-reader import. Main's process-owner metadata, recovery, transaction ordering, and admission checks remain unchanged. No additional simplification hunks were dropped in this round. The two previous main merges contained no manual merge resolutions and were flattened by the rebase.The requester-wake fix (#159352) is included from main. Its E2E file and settlement support are unchanged by this PR. The lifecycle redesign and capability-binding patch remain excluded; this refresh adds no SQLite schema or persistent-store semantic change.
Earlier kept and dropped hunks, retained by this rebase
safeParseJsonsubstitution insrc/state/user-channel-identities.ts, and the identical email-alias SELECT helper insrc/state/user-profile-email.kernel.ts. Main's revocation and authority behavior wins.delivery-info.ts,legacy-main-session-migration.ts,session-accessor.types.ts,targets-collision.ts,targets.ts,store-migrations.ts, andsession-transcript-worker-readers.tsbyte-identical to main; drop this PR's former alternatives, including its now-redundant transcript callback completion commit.plugin-auto-enable.shared.ts, retain only the shared configured-provider predicate and ordered configured-plugin loop. Keep main's selected-web-provider tuple loop/resolver, tool-config owner, and channel-key owner.talk.ts, retain only removal of the redundant secret normalizer, composed with main's single-assignment loop. Keep main's integer normalization and grouping.openclaw-state-read-diagnostics.tsand the result union. Their successful/admitted envelope comes from the same worker boundary as every other ordinary result, without changes to queries or admission.82464908822and5ffd9b81fa1were dropped.Evidence
Fresh proof ran on Linux Blacksmith Testbox
tbx_01m3gkh4zggw00bq40wavnvdmp(run 36295751791), throughnode scripts/crabbox-wrapper.mjs. The receiver verified sourcecaff8e78e2efc6a0ae0e142068738e4bcd0dd4bfand tree9167d7fdca81fe960a43ccd4ab25eb0670a491fa; the payload asserted that exact tree and merge base before validation. Dependencies were installed on the lease withpnpm install --frozen-lockfilefirst.node scripts/check-changed.mjs --base origin/main --head HEAD(pinned merge base above)node scripts/run-vitest.mjs src/state/openclaw-state-lease.test.tsnode scripts/run-vitest.mjs run --config test/vitest/vitest.extension-qa.config.ts extensions/qa-lab/src/qa-gateway-config.test.tsOPENCLAW_BUILD_PRIVATE_QA=1 VITEST=1 pnpm buildBoth previously accepted requester failures now pass, including
settles overlapping caller turns with alpha first (same ownership, yielded=alpha)andcaps a stale requester batch despite foreign active work in a global session. No test assertion or settlement implementation was changed to obtain this result.Fresh independent Codex review of the complete candidate is scoped-clean through P2. A diff-only read-isolation finding was rejected after full-source review confirmed that the unchanged preceding active-transaction branch returns through the committed-reader companion; the committed-read regression suite is included in the passing focused selection. No source changes were needed after review.
The remote validation command exited zero. The owned lease is stopped/completed. Two preliminary invocations stopped before validation because of command setup: an unsupported raw-SHA base selector and a HEAD assertion that did not account for the receiver's synthetic carrier commit. The successful invocation uses the supported base selector and exact source-tree/merge-base assertions.
Force-with-lease publication replaced
4559643acc708f9fe3f1ddc512cff80116e1cdf6with the candidate above. A Git merge-tree check against fresh main5e1a2cf4ea761a5493843966e5f785b11154f010reported no conflicts with the tested candidate before publication. CI run 36298883744 is attached to the exact new head and is in progress; this is not a hosted-CI green claim.The coordinator-enabled auto-merge request was retired before replacing the head, as explicitly authorized for requests without a native outcome receipt. This update did not re-arm auto-merge or merge the PR; the coordinator owns the next merge action.
Previously accepted, unchanged-surface SDK proof remains historical: surface/export checks passed, while the TypeScript 7 API-comparison tool failed identically on the earlier clean base and candidate with a DataView bounds error in
api-baseline-declaration-print.ts:260. That tool defect remains untouched and non-gating. Optional package/upgrade proof was not rerun.Size
Production TypeScript under
src/, excluding test files/support: 83 files, 810 insertions, 1,667 deletions: 857 net production lines removed. The previous PR-body filter also includes the assertion-safety baseline (three net lines removed), yielding 84 files, 813 insertions, 1,673 deletions: 860 net production-filter lines removed. Both compare against the pinned rebase base above.The existing doc-baseline fixture continues to import the canonical owner instead of loading the full runtime facade while mocking its siblings. No new tests, assertion relaxations, timeout changes, retries, or test-scheduling changes were added by this rebase.
Focused owner/importer command