Repository navigation
refactor(sessions): run lifecycle and deletion transactions in the agent executor (compound 3b) - #164922
Conversation
Move durable lifecycle planning, audited native-participant reclamation, and exact message rewrites into the existing executor. Preserve reversible precommit vetoes, conditional compensation, unknown-outcome blocking, current grants, and accepted settlement at close. Retain the released opaque callback contracts. Keep physical shared-store ownership during rewrites and publish filtered committed lifecycle facts so a delayed receipt cannot report an obsolete reset after a successor. Focused caller, native settlement, import, and real Gateway close-order checks pass. Independent Codex review is clean through P2. No schema, retention, durability, configuration, or update migration changes.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs changes before merge. Reviewed October 4, 2026, 2:23 PM ET / 18:23 UTC (Revision 11). ClawSweeper reviewWhat this changesMoves session lifecycle planning, native-companion deletion, and selected transcript rewrites into the existing agent database executor while preserving native callback and settlement contracts. Merge readiness⛔ Needs changes before merge - 1 item remains The PR remains useful: current main does not complete this lifecycle and native-deletion worker cutover. No actionable introduced defect was found, and the earlier worker-registration finding is resolved. Likely related people: @steipete, with high-confidence routing from prior merged session-executor work. Priority: P2 Review scores
Verification
How this fits togetherSession storage handles conversation initialization, resets, deletion, and transcript updates requested by Gateway and agent callers. The agent executor performs SQLite work and returns committed facts for host-side publication and cleanup. flowchart TD
A[Gateway and agent requests] --> B[Capture physical store and live authority]
B --> C[Worker preparation]
C --> D[Host builders and message transforms]
D --> E[Worker transaction and currentness checks]
F[Native companion deletion veto] --> E
E --> G[Commit receipt and owner publication]
G --> H[Conversation updates and cleanup]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +944, Tests +554, Docs +13, Other +3. Total +1514 across 39 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep lifecycle persistence under the existing executor and publication owners, preserving released callbacks, physical-store identity, reversible native vetoes, and settlement without replay. Do we have a high-confidence way to reproduce the issue? Not applicable as a refactor; source and recorded actual-worker boundary checks establish the targeted caller-thread SQL paths, and the isolated Gateway workload exercises lifecycle persistence. Is this the best way to solve the issue? Yes. Reusing the existing executor, transaction kernels, native participant owner, and publication machinery preserves one authoritative storage path while keeping released callback contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bd6416c6d5b4. 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 (10 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Merge current main to incorporate the independently diagnosed prepareRuntimeRefresh fixture repair from #164938. Preserve the compound 3b worker lifecycle, native deletion, and exact transcript rewrite cutover. The merge is conflict-free and retains the previous candidate's stable patch ID. Refresh focused integration, SDK, and published-driver update proof for the new surrounding worktree and placement owners.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Merge main after #164984 aligns the catalog E2E with the model picker's quiet send state. Preserve the compound 3b executor cutover alongside main's incognito lifecycle dispatch without manual conflict resolutions. The compound 3b stable patch ID remains unchanged. Refresh the affected import, build, update, and SDK evidence for the integrated candidate.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Integrate main at 2be4d4f, including preservation of native SQLite errcode across worker transport and schema preparation before worker binding. The compound 3b patch is unchanged and fresh P2 review is clean. Refreshed SDK, lifecycle, build, package, and published-driver update proof remain merge preconditions.
|
@clawsweeper re-review Reviewed head |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…ent executor (compound 3b) (openclaw#164922) * refactor(sessions): run lifecycle and deletion in the agent executor Move durable lifecycle planning, audited native-participant reclamation, and exact message rewrites into the existing executor. Preserve reversible precommit vetoes, conditional compensation, unknown-outcome blocking, current grants, and accepted settlement at close. Retain the released opaque callback contracts. Keep physical shared-store ownership during rewrites and publish filtered committed lifecycle facts so a delayed receipt cannot report an obsolete reset after a successor. Focused caller, native settlement, import, and real Gateway close-order checks pass. Independent Codex review is clean through P2. No schema, retention, durability, configuration, or update migration changes. * fix(scripts): register session executor worker protocols
Use the canonical admitted metadata writer for projection and configured-only multi-store fixtures. Lifecycle executor planning from #164922 otherwise spends the deadline seeding stores before the list probes begin. Publish the sibling fixture's config once before writing its rows. Retain #165623's per-runtime store reuse. That change alone still timed out in two of three fresh-main repetitions. Preserve all 29 agents, six search/runtime combinations, filesystem counters, and result assertions. Both affected cases pass three runs; all nine path siblings pass. Production behavior and timeouts are unchanged.
Use the canonical admitted metadata writer for projection and configured-only multi-store fixtures. Lifecycle executor planning from openclaw#164922 otherwise spends the deadline seeding stores before the list probes begin. Publish the sibling fixture's config once before writing its rows. Retain openclaw#165623's per-runtime store reuse. That change alone still timed out in two of three fresh-main repetitions. Preserve all 29 agents, six search/runtime combinations, filesystem counters, and result assertions. Both affected cases pass three runs; all nine path siblings pass. Production behavior and timeouts are unchanged.
What Problem This Solves
Durable lifecycle planning, deletion with native companions, and exact transcript rewrites still run synchronous SQLite work on the Gateway thread.
User Impact
The moved operations execute their session SQL in workers while preserving callback order, deletion vetoes, and shutdown settlement. Schema, stored formats, retention, durability, configuration, and update behavior stay unchanged. The existing cross-database crash window remains; this change adds no durable cross-store journal.
Why This Change Was Made
Lifecycle preparation and exact-message transforms use the existing agent executor. Host builders run outside SQL; synchronous worker transactions reread authoritative rows and exact transcript bytes before committing. Native companion deletion uses the existing participant owner, precedes—and can veto—the agent commit, conditionally restores the actual removed row after confirmed rollback, and fences unknown outcomes without replay.
Committed facts publish before dependent effects. The cutover retains physical shared-store ownership, reacquires post-builder references through the executor, preserves error identity, and suppresses obsolete reset events after a successor publication. Uncertain commentary rewrites retain their media through the reclamation owner. Private commands use the existing domain envelope without changing registered executor command keys.
Related overlap: #164891 (landed; its shared publication helper is reused), #163592, and #162433. Main is integrated with merge commits, without rebasing. The remaining compound3b patch is unchanged across the main integrations.
Opaque SDK callbacks, Doctor transfers, and process-held incognito retain their native contracts. Follow-up debt remains in initial reply snapshot reads (
src/config/sessions/session-accessor.reset.ts:146) and existing live placement authority reads (src/gateway/worker-environments/session-placement-lifecycle.ts:170,:195). These short reads of another owner's state keep revocation checks live; the zero-caller-SQL claim covers only the moved operations.Evidence
Final head:
ff43481cd192b7f98e6d32bf5d4ddecabbf69f29. Integrated main:2be4d4fc561b281a13042ec1c55d3c7b1b5404bf. The PR delta is 39 files; production +1,196 / −252 / net +944. Added 0 newOPENCLAW_*names. Static T1 remains 902 → 902 because retained native consumers still use the shared kernels.The canonical local SDK comparison passed in 1,440.53 s including cleanup: 132 reachable-only changes, 0 direct signature/export changes, and 0 added/removed entrypoints. Digest:
dd0af1fd858ce9411caf777f6ce25a01b4689756e3086383a67f4227251f43cb. The affected export identities and declaration-change arrays match the prior report; common-main declarations appear on both sides of the refreshed comparison.The exact-head isolated full build passed in 779.3 s, and canonical package integrity passed in 42 s. The grouped owner checks passed all 35 tests in 95.31 s: runtime process graph (10), get-reply imports (1), incognito lifecycle (18), and native reclamation (6). The separately selected PR wrapper inventory passed its one test in 11.72 s; 16 unrelated cases were deliberately filtered. Both commands used
pnpm test … --maxWorkers=1.The published
[email protected]driver updated to the freshly builtff43481candidate successfully in 498.614 s. Durable run394cfea2-7a51-4856-87bc-77c43b66985ffinished successfully,/readyzreturned 200, the running-version check passed, and service cleanup exited 0. The remote command exited 0 and released its workspace owner. Candidate SHA-256:7251223082fdcb11df4d4c3519e225c366650820904444595c24f40b50ad44a3. Build identity:2026.9.8-ff43481cd192-2026-10-04T18-36-26.726Z. The current full build’s startup gzip stage was report-only: 373,837 B against 373,454 B (383 B over), with build exit 0; this is not strict UI-budget success.Released SDK audit: compared the affected exports,
api.runtimereachability, and callback signatures with v2026.9.8. The opaque rewrite adapters were already async with synchronous callbacks and retain their signatures; the relocated error remains re-exported. The additional lifecycle argument is optional and internal. No new released-contract shim is needed. Reachable declaration changes include the new error-codec discriminator; zero direct signature changes does not mean every transitive declaration is identical.The original unchanged-input proof passed 264 contract tests (1 Linux-only managed-SIGTERM case skipped on macOS) in 1,048.89 s and 31 focused rewrite/reclamation/media tests in 394.19 s. Negative controls reproduced shared-store owner mismatch and obsolete reset publication before their regressions passed. Changed checks passed in 3,269.45 s, Madge found 0 cycles, and the worker ratchet showed no T1 growth. A mock-provider Gateway workload exercised chat, spawn, cron, compaction, reset, deletion, and graceful shutdown: 903 moved SQL calls in workers, 0 moved calls on the caller thread (78.76 s). The workload logged existing lock retries, conservative close receipts, and one aborted activity-summary publication; those are recorded, not claimed fixed.
The original full build passed but its report-only UI gzip stage was 41 B above budget (373,495 B / 373,454 B); the coordinator accepted this note. It is not strict budget success. Earlier published-driver cells passed at
d7907e3,52d7161, and76c1f55; they remain historical evidence. Theaab73ddreplacement attempt was superseded before build or runtime proof after main fixed the diagnosed SQLite failure.CI findings and repairs
The PR-caused inventory omission was repaired in
0f559d59a5b954a089884d1c343b28d03e0357cd: both new worker modules require the loader'sbindSqliteWorkerBackendprotocol registration. The collision guard failed before and passed after; all 54 guard tests passed in 5.12 s, and P2 review was clean.Independently diagnosed main failures were incorporated through merge commits: #164938 repaired the dispatch fixture's missing
prepareRuntimeRefresh; #164984 aligned catalog E2E expectations with the removed spinner;c88dd9375fe873e216cca0adc0f731d25c861600preserves validated native SQLiteerrcodethrough worker encoding/decoding so provisioning can classify the error. These were source-supported main failures, not compound3b repairs. The newest integration includes the SQLite fix and schema preparation before private worker binding.Exact-head CI 37223773369, attempt 1, completed with 100 successful jobs, 20 skipped jobs, and 0 cancellations (627 s elapsed; 22,427 aggregate job-seconds). The provisioning shard and
security-fastpassed. Its only non-aggregate failure is real-Gateway job111499403255, followed by gate111501099037. The tested checkout isc6c8497d5d4d659354df0ca7c8b35be4583c0df9, with ordered parents mainc9bff77155b0d6fde8214b5e9cbfbc32178eff09and this PR head; independently recomputed merge-tree matches35a2d993467a3db3b57d2e19becb94c67aee82a2. The current log repeats the full accepted-input → second-run placement rejection → one-launch assertion chain. Source and transitive-owner inspection supports reuse of the independent main reproduction below. This is failed CI retained under the operator-approved native inherited-failure route, not a green result; no rerun was requested for this failure.Historical real-Gateway initial-setup failure: the second queued run was rejected with
Session setup-proof-session placement authority changed, followed by launched=1 / expected=2. Fresh Linux/Node 24.19.0/pnpm 12.5.1 comparisons ataab73ddpassed 5/5 on the PR; main5f497e71had one identical failure and four passes. Twelve decisive blobs matched actual tested main587f6f2eand merge3818d7e3. The invalidating event remains unidentified; no fix is claimed.Historical CLI recovery failure remains unattributed. Five PR and five base full-file runs, exact-main replay, and original serialized Node24 groups all passed. Its single operator-authorized failed-job rerun passed in CI attempt2; that is not a fix claim. A local
76c1f55reclamation batch timed out while its lazy import closure needed 130.520 s; a following case saw an extra callback. Unmodified original-order replay and exact selected CI passed all six cases; secondary overlap was not directly traced, and assertions/timeouts were not changed.ClawSweeper completed its trusted review of this exact head at 2026-10-04 18:23:42 UTC (run
37223959730): no actionable code or security findings. Its only outstanding item was the refreshed integrated-head qualification recorded above. Fresh isolated P2 autoreview of the complete final candidate is clean.