Repository navigation
refactor(sessions): run reset operations in the agent executor (compound 1b) - #163930
Conversation
…cutor (compound 1a)
Move durable reset boundary, collaboration cleanup, and entry writes into one typed executor transaction using the existing transfer and COMMIT receipt owner. Preserve host builder/callback order, physical FIFO, live grants, and reset conflict identity. Keep native and opaque compatibility paths and extract the reply initialization descriptor for the next cutover. Reset boundary SQL observations: 137 on the caller thread before, zero after. Focused reset, entry-patch, cold-storage, and SDK proof: 69 passed.
|
🦞👀 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 7:40 AM ET / 11:40 UTC (Revision 17). ClawSweeper reviewWhat this changesMoves durable session-reset storage into the existing agent database worker while preserving callbacks, notifications, and reply initialization. Merge readiness✅ Ready for maintainer review This remains useful work: current main has not moved durable resets into the executor. The pinned patch has no actionable correctness or security findings, and the supplied production-worker evidence covers the changed boundary. Priority: P2 Review scores
Verification
How this fits togetherSession reset replaces the active conversation entry and records a transcript boundary. The Gateway prepares the replacement, the database worker commits it, and acknowledged results update session readers and lifecycle observers. flowchart TD
A[Session reset request] --> B[Gateway prepares replacement]
B --> C[Live authority checks]
C --> D[Agent database worker]
D --> E[Atomic reset transaction]
E --> F[Commit receipt]
F --> G[Publish session and notify observers]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +273, Tests +360, Docs +12, Other +1. Total +646 across 22 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep durable reset execution under the existing worker, receipt, and publication owners while preserving the documented native compatibility paths. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is an internal execution cutover. The supplied real-worker scenarios directly exercise reset writes, revocation, rollback, and lost-reply recovery. Is this the best way to solve the issue? Yes. Reusing the existing executor and commit-receipt owner preserves one authoritative reset transaction without adding a competing worker or persistence contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c81d86e82f60. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (16 earlier review cycles; latest 8 shown)
|
Keep reset cleanup rollback proof on the admitted writer connection after the reset executor cutover. Use worker-local TEMP triggers and await scoped resource drainage before fixture reopen. Both faults reproduced in five approved-head runs; all five C1 baseline runs passed, and the repaired file passes all 20 cases.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Integrate compound turn repairs while preserving the reviewed reset delta. Resolve the squashed-stack conflicts with the landed main implementations, retaining both worker error identities and the reset preparation hook. The delta against main remains the same 22 files, with no additional production changes. Validation: 66 reset, compound-worker, entry-publication and Gateway cleanup cases passed (1290.78s wall). Wrapper import inventory passed (31.87s wall). Formatting and whitespace checks passed for the PR delta. Original P2 production review is retained for this mechanical merge.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Merge current main to carry the current Security Review publisher source and the upstream byte-size test correction. Preserve the reviewed 22-file reset delta without rebasing or adding production behavior. Validation on the unchanged candidate tree: 67 reset and publication cases passed in 566.09s; all 20 byte-size cases passed under Node 24.21.0 in 138.14s; the wrapper import inventory check passed in 41.69s. Formatting and whitespace checks passed for the PR delta.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…und 1b) (openclaw#163930) * refactor(sessions): run turn append+entry operations in the agent executor (compound 1a) * refactor(sessions): run reset operations in the agent executor Move durable reset boundary, collaboration cleanup, and entry writes into one typed executor transaction using the existing transfer and COMMIT receipt owner. Preserve host builder/callback order, physical FIFO, live grants, and reset conflict identity. Keep native and opaque compatibility paths and extract the reply initialization descriptor for the next cutover. Reset boundary SQL observations: 137 on the caller thread before, zero after. Focused reset, entry-patch, cold-storage, and SDK proof: 69 passed. * test(sessions): inject reset failures on worker connections Keep reset cleanup rollback proof on the admitted writer connection after the reset executor cutover. Use worker-local TEMP triggers and await scoped resource drainage before fixture reopen. Both faults reproduced in five approved-head runs; all five C1 baseline runs passed, and the repaired file passes all 20 cases.
Related: #163889
The C1 prerequisite merged as
ca77256127e6ba13c00d68bca42194d1b9e2a780. This C2 reset follow-up targetsmain. Current headb4ffdb59da3ed7912e1b12cf7f6ddb3e0fb93534incorporates main9c1e4ce252738c1504182f41ef79379af2e39079without rebasing, including the current Security Review publisher and the upstream byte-size and startup-fixture repairs.What Problem This Solves
Single-entry session resets still scanned transcripts and ran the boundary append, entry write, and collaboration cleanup on the Gateway thread.
Why This Change Was Made
Register a typed reset kernel in the existing agent executor and reuse C1/S10 preparation, live grants, candidate transfer, COMMIT receipts, error hydration, and publication. The host builds the replacement once; the worker rereads the complete target and commits the boundary, collaboration cleanup, and entry together. Progress and identity notifications precede the reset callback, and accepted callbacks retain physical FIFO ordering. Lost replies publish the acknowledged candidate without replaying the builder or SQL; uncertain outcomes remain fenced.
Cold restoration retains the captured physical path. Dirty transcript reconciliation is returned to its existing host owner after acknowledgment. Reset conflicts retain their error-class identity through a leaf error module included in the wrapper inventory. Remove the superseded host comparison helper and extract the bundled reply initialization/upsert descriptor needed by C4.
User Impact
Durable reset storage work moves off the caller thread. Schemas, stored formats, retention, permissions, configuration, and update behavior are unchanged; no migration or operator action is needed. The diff adds zero
OPENCLAW_*names.C3 rewind/branch, native-binding settlement, fork/deletion, and actor activation remain outside this PR. Process-held incognito retains its documented native owner until that cutover. Opaque released SDK transaction callbacks retain their explicit compatibility path. P4b's
captureSettlementremains the sole native companion settlement owner; ordinary C2 reset introduces no second participant owner.Production LOC: +349 / −76 / net +273, 425 changed production lines, across 22 total files including tests, docs, and wrapper inventory.
Evidence
--maxWorkers=1: 67 reset/publication and 57 worker-error transport cases. Wrapper inventory passed (one selected case, 64.54s, 16 unselected). Both bind tree42b1f90cd01073c04c36d2410a15ff2e84e5999b.MESSAGE_ONLY_ERRORSrefactor. The parameter-bearing reset conflict remains beside session-goal errors and retains its validator, payload, constructor and import. No C2 behavior changed. Formatting and whitespace checks pass. Previous integration proof also passed the four secret-metadata worker and 12 transcript SDK cases, and the selected skill-library permission/error boundary.7a635c2117ea6743ccf2b36e1fde56d45e614063is incorporated and passed 8/8, 354.38s wall on the prior integrated tree. Main's byte-size assertion fix7e67fe7d18ecbe1b226a90062807913adcc47416is also retained; earlier focused proof passed 20/20, 138.14s. Focused runtime is Node 24.21.0 / SQLite 3.53.4.60a5900752417fea7ad8aba7f1042a238e422e30received clean isolated review through P2, retained for the mechanical main integrations and conflict resolutions. The introduced delta remains 22 files, +884 / -238.security-fastandopenclaw/ci-gate. No jobs were rerun. This head uses ordinary native landing, with no inherited-failure exception.security-fast. It tested mergec95baff3bf7ee3783ae110d7ac93969b550edc0a, whose tree matches Git's recomputed merge. The sole root was the independently proven main terminal-fixture defect below. Inspection of main9c1e4ce252738c1504182f41ef79379af2e39079at 2026-10-03T10:58:27Z found no fixture fix; all five causal blobs remained identical. Any native inherited-failure admission must be refreshed for the new exact head and completed CI attempt.The preceding head's CI run 37112781425, attempt 1, failed only the four terminal-output cases in
attempt-stream-prepare.test.ts(job 111173954646), plus the downstream gate. Main commitaff22764a883286f7ad20af771b28c2302e3cce1introducedterminal.readSanitizedResult(), while the unchanged subscription fixture omitted it on both success and error terminals. Five runs on actual CI merge1174d26d41e507a949539b21c5ccbea5f8ec1cc6and five on its main parent2a58339e793171ad389db75e6815757037180adceach reproduce exactly four failures / 47 passes. Scheduled main run 37113342869, job 111175455568, independently matches all four. The failing fixture uses an in-memory manager and does not require C1b reset/database work. Branch-only replay was not substituted for the executed CI tree. Main subsequently repaired both missing terminal accessors inb1c49290c8d5335331c63fc176d75a80805fa953, preserving the four cases. Current exact-head CI passes. No CI job was rerun and no inherited-failure exception is needed for the final head.An earlier CI attempt reported
AgentDatabaseRegistryChangedErrorin the SDK's concurrent first-write case. Five head and five main-baseline runs passed all 12 cases, and the current integration's SDK run also passes. The original log cannot identify the precise registry invalidator, so this remains an unreproduced timing-sensitive refusal, with no claim that passing replays fixed it. No SDK source change or CI rerun was made for that observation.Initial PR CI exposed two reset-cleanup fixture assumptions. All five original-head runs failed those cases and all five C1-base runs passed. Repair
01e664751e259cfac55fc7473467010bc7f3e90emoves fault injection to worker-local TEMP triggers and joins scoped cleanup before reopen, preserving error, rollback, revocation and reopen assertions. No cases were added; the repaired file originally passed 20/20 in 186.99s (original CI case cost 48.834s).Historical main-only byte-size and startup failures were incorporated from their upstream fixes. An older auth-failover mock failure also matched five prior-head, five main-baseline runs and scheduled main CI. A native admission stopped before dispatch on stale Security Review publisher source; a legitimate main merge refreshed it. Subsequent actual worker-error conflicts were resolved while retaining all main and reset identities. No CI job was rerun merely to obtain green.