Repository navigation
refactor(sessions): move bundled session mutations to worker-owned SDK operations - #168453
Conversation
Keep released callback and synchronous contracts with explicit deprecations. Move bundled entry callers, upserts, watermarks, and reply audit writes to prepared worker operations; retain plugin and session authority through commit. Preserve native cross-store and incognito guards pending their separate cutovers.
Move test-only transcript replacement and append fixtures out of core exports, remove the unused native conversation callback wrapper, and migrate Talk session creation to guarded worker preparation. Keep released SDK contracts and named native worker, offline, cross-store, and incognito adapters.
Resolve the registry conflict in the extracted ownership module while preserving prepared patch, upsert, and route lifetime guards. Pin proof baseline to 7008414.
Observe the existing session identity publisher during initial metadata preparation so a same-ID reset cannot authorize capture against a successor lifecycle. Preserve worker transaction fencing and released SDK shapes. Move scoped channel wrappers, patch authority, and test fixtures into their existing responsibility boundaries to satisfy import-cycle and line-cap gates. The unchanged reply capture regression fails before this repair; all 23 cases pass afterward.
|
🦞👀 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 real behavior proof before merge. What this changesThis PR moves bundled session mutations through worker-backed SDK operations while preserving released compatibility adapters. Example: A plugin renames session agent:main:managed to Research.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep this useful maintainer-directed PR open; no discrete introduced bug was established, and the earlier conflict blocker is resolved. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherPlugin and channel callers submit session changes through the SDK; database workers commit SQLite state and publish committed facts to runtime consumers. flowchart LR
A[Bundled callers] --> B[Scoped plugin runtime]
B --> C[Session SDK]
C --> D[Preparation and authority]
D --> E[Database worker]
E --> F[SQLite session state]
E --> G[Committed facts]
Technical reviewBest possible solution: Complete the existing worker-owner cutover while preserving released adapters and demonstrating final-effect plugin authority. Do we have a high-confidence way to reproduce the issue? Current-main source retains native callback compatibility paths that can perform caller-thread SQLite work; this read-only review ran no reproduction. Is this the best way to solve the issue? Reusing the existing worker, exact-snapshot commit, and publication owners is appropriate, with explicitly retained compatibility boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 171df4e1c5a0. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Live-authority guards are present, but their complete managed-plugin composition lacks final-effect proof. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (9 earlier review cycles; latest 8 shown)
Reviewed October 10, 2026, 2:17 PM ET / 18:17 UTC (Revision 10). |
Merge current main into the worker-owned session SDK cutover, preserving incognito read authority, runtime facades, and transcript coverage.
Keep the extracted session-create owner, preserve released SDK callback forwarding in the boundary guard, and make the export-budget fixture independent of the current deprecated count. Fix the worker-access heading hierarchy.
…ync/sw7a # Conflicts: # docs/plugins/sdk-entrypoints.md # scripts/plugin-sdk-surface-report.mts
…sw7a # Conflicts: # src/auto-reply/reply/agent-runner-memory.test.ts
Resolve Telegram test conflicts by retaining main’s reviewed test removals while preserving the prepared session-patch migration.
# Conflicts: # docs/reference/database-schemas/worker-access-inventory.md
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…K operations (openclaw#168453) * refactor(plugin-sdk): share legacy persistence warning budgets * refactor(plugin-sdk): prepare session mutations in owning workers Keep released callback and synchronous contracts with explicit deprecations. Move bundled entry callers, upserts, watermarks, and reply audit writes to prepared worker operations; retain plugin and session authority through commit. Preserve native cross-store and incognito guards pending their separate cutovers. * refactor(sessions): remove retired native transcript exports Move test-only transcript replacement and append fixtures out of core exports, remove the unused native conversation callback wrapper, and migrate Talk session creation to guarded worker preparation. Keep released SDK contracts and named native worker, offline, cross-store, and incognito adapters. * fix(sessions): retain reply identity through worker reads Observe the existing session identity publisher during initial metadata preparation so a same-ID reset cannot authorize capture against a successor lifecycle. Preserve worker transaction fencing and released SDK shapes. Move scoped channel wrappers, patch authority, and test fixtures into their existing responsibility boundaries to satisfy import-cycle and line-cap gates. The unchanged reply capture regression fails before this repair; all 23 cases pass afterward. * test(sessions): exercise SDK patches through worker boundary * chore(sessions): prune retired SDK assertion allowance * test(sessions): align prepared source fixtures and SDK budgets * chore(tests): prune retired session cleanup mock allowance * test(sessions): complete migrated fixture and lint validation * fix(sessions): reconcile SDK runtime integration gates Keep the extracted session-create owner, preserve released SDK callback forwarding in the boundary guard, and make the export-budget fixture independent of the current deprecated count. Fix the worker-access heading hierarchy. * test(meeting): migrate shutdown fixture to prepared session patches
What Problem This Solves
Session SDK methods that return promises can still run SQLite mutations on the Gateway thread, and queued metadata writes can outlive the plugin capability that authorized them.
User Impact
Plugins can prepare entry changes outside SQLite or submit conditional data patches to the owning worker. Bundled callers await these operations, and queued session names, upserts, routes, and Talk updates retain their live authority through commit. Released synchronous and opaque-callback contracts remain compatible and warn once per plugin and capability family on actual legacy use. Their replacements and removal in the next Plugin SDK major are documented.
Process-held incognito compatibility and cross-store entry adapters retain their existing atomic guards pending their separate cutovers. This PR does not claim those routes are worker-only. There is no schema, stored-byte, retention, or update migration. Published-driver × candidate update cell: passed on
808c7b409ec57e201f8cd01f744a3a8c3dbbfba6(reused after subsequent conflict-only merges). The published 2026.9.9 driver completed the candidate update, verified readiness and the running version, and preserved durable and incognito content. The unchanged cell deadline was used with a prebuilt candidate package.Why This Change Was Made
The existing SessionManager async methods and versioned extension/provider replay contracts already own durable writes. This change completes their bundled call graph and reuses the entry writer's exact-snapshot compare-and-swap for callback preparation. Preparation runs once outside the transaction; conflicts never replay it, and null suppresses the write. Data patches, public upserts, and ambient transcript watermarks use typed worker reducers. Correlated replies commit the replayable delivery before their optional audit event, so an audit failure cannot undo the reply.
The shared diagnostic owner deduplicates SessionManager and SDK warnings across source imports, bundles, and plugin reloads. Test-only full-transcript replacement and raw append wrappers leave the core exports, and the unused native conversation callback wrapper is removed.
Lander integration evidence
Final head:
2223b22b14ee08b0ee16135be7816f906c3469c2. Main was integrated with merge commits. Small integration fixes and the meeting fixture migration passed focused proof and independent P0/P1 review. The Telegram conflict resolution retained main's reviewed test deletions and passed all 20 login tests (310.92 s Vitest; 343.75 s command). The repaired meeting four-file group passed 49 tests in 32.81 s. The final merge integrated main's cleanup-handoff lint fix493a499b86e3; its sole conflict was generated worker inventory, which passed regeneration/check andgit diff --check. The published-driver update proof above remains valid after these conflict-only updates.Final-head CI, attempt 1 completed with 114 successful jobs, 20 skipped jobs, six failed root jobs and the downstream gate failure. The requested inherited-failure admin route retains those failures: dreaming restart cleanup, worker placement evidence, Discord ambiguous settlement, Agents API steering variants, the memory cache-pruning test observer deadlock, and private-completion prompt projection. Each has independent main evidence, and the named failing sources are identical between the tested main baseline
d1dc0c1c76dd4732bcaebccb3db80e3069917c44and tested merge8ddd1472ab83fd4f675ecc029807c209e54124b7. No failed check is claimed as passing. The former lint and chat failures passed on this final head.The private-completion projection failure also occurs in scheduled main run 38076523822, job 114284759447, at
b7940621a3fdd14e9944050d6b5a7189445e073f. The scenario and projection owners are unchanged. Separate Testbox baseline attempts stopped during setup/synchronization and are not used as qualification evidence; that lease was stopped.The cache-pruning baseline reproduced its 240-second test timeout and 180-second hook timeout; its stuck teardown was then interrupted. The CI shard stopped at its standard 300-second silence watchdog with incomplete coverage. The observer watches
worker.run, while main's pruning owner now usesworker.execute; the test holds the writer reservation while waiting for an observation that cannot arrive. No unrelated main repairs or CI reruns were added.Evidence
The original lane measurements and proof below belong to the coordinator-approved head
8d82a12b28aa02f57a257f12310bc5241e879107. Lander integration proof is recorded separately.CI=1 pnpm check:changed --base 7008414e344e77f066f1366e9454a6c090cc64b0passed in 1,812.81 s on macOS, Node 26.11.1, pnpm 12.7.0. This includes all typechecks, lint, SDK/export and structural guards. Madge passed; all three dead-export scans returned zero entries. Worker inventory passed.v2026.9.9(1,025 exports / eight entrypoints); there is no candidate-only removal. Released-contract fixtures pass.patchSessionEntryorupdateSessionStoreEntrycall remains; retained boundaries are listed below.src/infra/sqlite-source-fence-admission.ts, also fails on pinned main and is untouched here.Statement gate: passed. Three alternating baseline/candidate pairs ran on the same Linux host (8 vCPU, 32 GB), Node 24.21.0 and pnpm 12.7.0. Both exact source trees passed source-mapped
qaRuntimebuilds (baseline build 68.05 s, candidate 64.47 s). All behavior assertions, observer calibrations, SQL conservation checks, and duration comparisons passed. Counts include all threads and unassigned work.Whole-workload medians: 22,120 → 22,092 all-thread statements, 2,545 → 2,552 main-thread statements, and 3,421 → 3,420 requests. First-turn and warmed-turn raw medians both decreased, so the extra-pair RAW TURN INCREASE rule was not triggered. No duration ratio exceeded 1.5.
[6016, 6155, 6011] → [6013, 5896, 6109], median 6016 → 6013. The deferred-startup combined-window rule passes. Memory-owner whole-workload median remains 1702 → 1702.appendTranscriptMessageSnapshotSyncbody. The +4 total is within the non-turn tolerance.Three alternating affected-operation pairs passed (ten operations per phase per run). Every measured operation has equal or fewer all-thread statements, and the candidate performs no main-thread SQLite in these measured phases. Transcript preparation/duplicate/suppression add one worker request per operation; this is an explicit transport cost of the prepared worker contract. The largest median duration ratio is 1.223, below the 1.5 comparison limit.
Pinned main:
7008414e344e77f066f1366e9454a6c090cc64b0. Candidate:8d82a12b28aa02f57a257f12310bc5241e879107. Both trees were verified before and after measurement; the candidate tree isd703ccbc89186d6aef84b58d92296218be5f4928.Independent review is clean after the cutover, integration, lifecycle correction, and validation repairs. The shared warning helper was reviewed and pushed separately as the first commit,
e2af0450fc64e573ab9b74789711e4882c3eb63e. Main was integrated once to resolve the session-ownership extraction conflict.Diff against pinned main: production/tooling +906/−625 (1,531 changed lines), tests/support +1,406/−864, docs/generated +179/−46. The broad test file count comes from moving fixture-only transcript helpers out of production exports. Command wall times below are measured locally/remotely, not CI estimates.
Publication status: final integration is published at
2223b22b14ee08b0ee16135be7816f906c3469c2. Original SQL measurements remain bound to the approved lane head; final integration and CI disposition are recorded above.Transport costs and native diagnostics
The component transcript preparation/duplicate/suppression paths each add one request, seven admission messages, and five authority envelopes per operation. Upsert and watermark each remove one request, one admission message, and two authority envelopes. Entry preparation is unchanged. Startup traffic in the standalone source fixture includes unclassified transport messages; its raw whole-fixture census is not presented as database-only traffic. The shared built-runtime census remains unfiltered.
Shared-workload envelope medians:
All six shared runs recorded the same existing startup plugin lease-release
BEGIN IMMEDIATEbusy refusal. Baseline run one additionally recorded two admission busy refusals and one shutdown audit-pruning busy refusal. All runs completed their behavior assertions; no new failure signature appeared. The component fixtures recorded no native failures.Native BEGIN elapsed upper-bound medians were 61.14 → 37.01 ms (1,746 → 1,743 calls); COMMIT 114.33 → 121.63 ms (1,716 calls each). These values include execution and scheduling, so they are not isolated lock-wait times; implicit/batch transaction timing and native open/close timing are outside this diagnostic.
Runtime proof, regression controls, and command costs
The initial Linux proof passed 30 suites / 556 unique tests after the worker fixture was routed through the existing forked-process worker suite. Grouped command wall times were 209.47 s (stopped at the subsequently repaired fixture) and 145.70 s. Bun passed 47 tests in 64.04 s. Final fixture repairs also passed the three Memory Host suites (16 tests, 112.95 s), worker/compatibility suites (seven tests, 90.31 s), and plugin-ownership suite (nine tests, 27.47 s) on macOS. Repeated tests are counted once in the aggregate.
The rename and plugin-retirement regressions fail against their original owners. The first candidate run exposed a same-ID reset during reply capture's initial worker read; binding that read to the existing identity publisher fixed the failure without adding SQLite statements or a state owner. All 23 capture tests pass. Explicit barriers prove the worker patch's concurrent-write and revocation cases. The final full changed-check also caught stale generated allowances, test imports/types, and mechanical lint errors; the repaired final head passes.
Each single-file command below used
pnpm test <file> --maxWorkers=1. Command wall time includes transformation and worker preparation.src/plugin-sdk/session-store-runtime.worker-patch.test.tssrc/agents/embedded-agent-runner/run.overflow-context-recovery.test.tssrc/agents/embedded-agent-runner/run.timeout-context-recovery.test.tssrc/agents/embedded-agent-runner/run.overflow-compaction.test.tsCompleted proof is reused where inputs are unchanged. Later production differences are required braces, a type-only import reorder, and removal of an unreferenced internal type alias; the final build and SQL proof use the exact candidate.
Migration coverage and retained boundaries
bindCoreAsync; synchronous methods remain released compatibility adapters. Queued rename retains the original authority for persistent and detached sessions.readOnly: trueor the awaited reader. Remaining bundled writable-default calls are Doctor contracts; the released external default remains explicit compatibility. Gateway/TUI BTW callers supply complete targets and bypass the dormant core marker fallback.replaceTranscriptEvents,replaceTranscriptEventsSync, andappendTranscriptEventSyncmove to test support;runConversationDatabaseWriteis deleted. No released SDK export is removed.