Repository navigation
feat: add prepared transcript writes and inactive actor operations - #167715
Conversation
Add awaited preparation and source authority to transcript writes, and migrate bundled consumers. Keep deprecated durable callback and lock behavior with one warning per plugin; incognito callers receive migration guidance. Removal is scheduled for the next Plugin SDK major. Complete explicitly bound actor transcript mutations and lifecycle compositions. Production incognito acquisition remains host-owned, with no schema, durability, retention, permission, or content-cap change and no claimed incognito T1 retirement.
|
🦞👀 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 maintainer review before merge. What this changesPlugins gain asynchronous preparation for saved conversation messages, and explicitly selected private-session workers gain transcript editing and lifecycle operations. Example: A plugin opens the legacy transcript write lock for an incognito session.
Review scores
ProductKind: Feature · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR contains useful, owner-directed work absent from current main. Both prior findings are resolved, and no additional concrete patch defect was established; current CI is still failing. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherOpenClaw saves conversation messages and session metadata through SQLite transaction owners. Plugins submit session operations, and these owners return committed facts and publish conversation updates. flowchart TD
A[Plugin session operation] --> B[Capture physical session owner]
B --> C[Prepare message asynchronously]
C --> D[Check current authority and transcript version]
D --> E[Existing SQLite worker]
D --> H[Refuse stale operation]
E --> F[Publish committed session facts]
F --> G[Conversation update notifications]
Technical reviewBest possible solution: Keep the shared prepared-write contract, documented SDK compatibility window, and separate actor activation boundary. Do we have a high-confidence way to reproduce the issue? Not applicable to this capability proposal; source and recorded worker scenarios establish the intended preparation and ownership behavior. Is this the best way to solve the issue? Yes: extending existing transaction owners and migrating bundled consumers follows the established staged design without introducing a competing writer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a799f4a42891. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
LabelsLabel 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 (5 earlier review cycles)
Reviewed October 9, 2026, 2:27 PM ET / 18:27 UTC (Revision 6). |
Merge current main for the reported conflicts, preserving source-validation facts, transcript reader routing, lifecycle settlement, and SDK compatibility. Normalize the shared actor publication and commit-receipt source before worker transfer, and canonicalize actor-bound SDK target keys before dispatch. Preserve the inactive activation boundary and existing SQL behavior.
Move the OpenCode capture mock and Gateway revocation hook to withSessionTranscriptWrite, matching the migrated production caller. Keep all imported-message and revoked-source persistence assertions unchanged. Both complete files pass on Node; the exact revocation case passes on the pinned Bun runtime.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…penclaw#167715) * feat: add prepared transcript writes and inactive actor operations Add awaited preparation and source authority to transcript writes, and migrate bundled consumers. Keep deprecated durable callback and lock behavior with one warning per plugin; incognito callers receive migration guidance. Removal is scheduled for the next Plugin SDK major. Complete explicitly bound actor transcript mutations and lifecycle compositions. Production incognito acquisition remains host-owned, with no schema, durability, retention, permission, or content-cap change and no claimed incognito T1 retirement. * style(sessions): consolidate transcript worker imports * fix(tooling): include incognito absence in PR wrapper inventory * test(sessions): follow prepared transcript write boundary Move the OpenCode capture mock and Gateway revocation hook to withSessionTranscriptWrite, matching the migrated production caller. Keep all imported-message and revoked-source persistence assertions unchanged. Both complete files pass on Node; the exact revocation case passes on the pinned Bun runtime.
What Problem This Solves
Prepares transcript mutation and session lifecycle operations for explicitly bound actors, and gives plugins an asynchronous preparation contract that can run outside a database transaction.
User Impact
Actor routing remains inactive: ordinary unbound incognito sessions stay host-owned and allocate no actor. Plugins can use
withSessionTranscriptWriteandpreparation.prepareMessage/preparation.source; the mirror equivalent iswithCodexSessionTranscriptMirrorWrite.Deprecated synchronous preparation callbacks and lock scopes retain durable ordering and emit one shared warning per plugin per process. Incognito targets reject those deprecated forms with an actionable replacement error. Removal is scheduled for the next Plugin SDK major. Every bundled production consumer of the deprecated public contract is migrated; the older asynchronous preparation spelling remains compatible.
Why This Change Was Made
Existing transaction owners now serve explicitly bound actors for turns, rewrites, corrections, Goals, manual trim, replacement, message cuts, metadata, and cleanup. Preparation captures the physical owner before yielding; commit checks exact transcript/row predicates and live authority. Acknowledged facts publish before observers, accepted work settles before release, and unknown outcomes never authorize replay.
Actor scopes use optimistic transcript-version checks; native scopes retain their existing writer queue. Each append commits independently. A later scope callback failure preserves earlier commits and discards queued notifications. The migration docs describe ordering, suppression, conflicts, replay, failure, and visibility.
No schema, durability, retention, permission, content-cap, activation flag, or new worker service is introduced. No incognito T1 retirement is claimed. Production selection and native-selector deletion remain separate work. Four internal
workerPreparationconsumers already use normalized outside-transaction preparation and remain to preserve ordinary-turn SQL costs.Evidence
Compared with pinned main
4821885e5b4d961ac0f01af1aa816e875ee3193f, after #166995 merged. Primary runtime/SQL/SDK/build proof is forb9e736c80e0bfabac372a448ba46b402e352d579, tree2a5f31d75b8e22b54150240287556f010db070d9. Original lane source:3dee7218593d30b3bd6f4e18d1428b1f33b6eb9d, treeacf06eb53438d9ded0918124ac2e260b93fd8488. The remote source capsule verified the primaryb9e736c8/2a5f31d7source/tree; its transport commit was45d875bfafed8f6f4b3d0b2a3f5cd8be54697556.pnpm install: passed, 39.45s.pnpm build: passed, 2,980.14s.2026.9.8driver × candidate2026.9.9: passed, 465.12s. Finished update, readiness HTTP 200, running version, and durable/incognito state checks verified.ClientVoiceToolEffectexport as the only remaining diagnostic (fixed on main byd76f6ec74ec63dafea02cfda258bdcf6ad055a52). Its original exit 1 is preserved. All 31 other prefix checks and all twelve continuation commands are accounted for: the import lint was repaired, and the two extension lint setup timeouts were recovered through the existing 1,800,000ms declaration/tsgo budget. Repaired-source core lint passed in 55.01s; extension lints passed in 238.94s and 59.18s. No ignore, skip flag, baseline expansion, or repository timeout change was introduced.The only follow-up to the primary proof consolidates two adjacent imports from the same module. Both value bindings, dependency initialization order, all other source, all exports, and emitted non-import JavaScript are unchanged. Parent runtime, SDK, SQL, build, and unaffected static proof is reused explicitly; format, line cap, core types, failed lint commands, and fresh review cover the repaired source. The duplicate-import finding is repaired, while the extension lint retries use the existing longer declaration-preparation budget after two 300s setup timeouts.
The original remote command exited 1 for the counterfactual text matcher and strict zero-growth SQL arithmetic. Their explicit evidence dispositions are recorded here; those failed receipts were not rewritten as passing commands. The complete downloaded evidence archive was verified against its printed SHA-256 (
6fd41cf791fd834536ec418e6fac580b6f5df2f6bf9ecd334c0635bb6d015c13), and the owned lease is released with cleanup verified.An interrupted local focused run also observed the unchanged
session-accessor.test.tsrejected-preparation mtime assertion: the typed rejection passed, but the database mtime changed during the 31.6s case. The test and twelve relevant owners are byte-identical to the base; setup starts detached maintenance, but the exact touching writer was not traced. The full remote suite passes this case. The local failure remains investigated evidence, with no claim that a replay fixed it and no relaxed assertion.SQL statement medians and attribution
Three alternating base/candidate pairs ran on one host. All six measurements and classifications and the comparison completed successfully; phase/thread/SQL conservation is exact. Every median duration ratio is valid (0.9843–1.0009, below 1.5).
Warmed values are per-run ten-turn means. First-turn +3 (+0.1041%) and warmed +1.1 (+0.0827%) qualify under the standing 0.5% noise allowance with source/site attribution. Connect +2 is within the non-turn allowance. The deferred-startup combined exception is not used.
First-turn residuals are one unchanged cron job-name SELECT, one cron transaction COMMIT, and one ACP metadata SELECT. Warmed residuals are +16/−5 over ten turns, including two additional executions of the existing six-statement session-row-facts read envelope. Its only host caller uses unchanged 1,000ms projection refresh windows and revision-based retry. All six runs have identical warmed inputs and visible events: ten
chat.send, tenagent.wait, twentysessions.changed, sixtychat, and 110agentevents. Connect residuals are unchanged cron/state-read work crossing the phase boundary.All 304 individual SQL+method+normalized-full-stack groups that traverse P02 files in the positive-delta phases have constant counts across all six runs. Across all phases, 623 of 624 touched groups are constant; one existing cache-dependent participant query appears once in the first candidate second-session run and does not increase that phase's median. Every positive residual stack appears in baseline evidence, and all 42 source files in those stacks plus nine host/transport caller files have identical base/candidate blobs. The ordinary unbound writer and native turn prepare/commit commands are preserved.
Normalization removes only checkout/line coordinates, the exact newly inserted forwarding/context frames, and uniquely matched bounded stack truncation; original mappings and counts are retained. The native traces have no initiating-request census or per-statement timestamps. Attribution uses native SQL sites, worker PID/thread, phase timestamp bounds, unchanged caller source, and identical input/event counts; the exact timer-versus-invalidation callback for each read is not reconstructed. The original strict arithmetic failure and census-based
INDETERMINATEresult remain visible.Focused commands, wall time, and cost
All commands used the canonical test runner with one worker on the same pinned source. Times include command setup. Local commands use zero hosted CI seconds. Direct AWS proof took 2,971.87s in the payload and 5,450.11s for the lease pipeline including hydration, sync, and cleanup; hosted CI/currency cost was not supplied by those receipts. Prior fleet refusal/backoff, failed unpublished-source hydration, interrupted local duplicates, and their cleanup remain in the coordinator receipts.
focused-actor-operations: 125 tests, 5 files, 70.09s.
pnpm test src/state/openclaw-agent-execution-incognito.sessions.test.ts src/state/openclaw-agent-execution-incognito.entry-patch.test.ts src/state/openclaw-agent-execution-incognito.lifecycle.test.ts src/state/openclaw-agent-execution-incognito.creation.test.ts src/state/openclaw-agent-execution-incognito.side-data.test.ts --maxWorkers=1focused-bundled-preparation: 239 tests, 11 files, 266.86s.
pnpm test extensions/acpx/src/pi-session-catalog-continuation.test.ts extensions/anthropic/session-catalog-history.test.ts extensions/codex/src/app-server/transcript-mirror.user-idempotency.test.ts extensions/copilot/src/attempt.test.ts extensions/voice-call/src/call-delivery-runtime.test.ts extensions/agentsapi/agentsapi-harness.persistence.test.ts extensions/agentsapi/agentsapi-attempt.test.ts extensions/copilot/src/attempt-transcript-journal.test.ts extensions/codex/src/app-server/transcript-mirror.test.ts extensions/codex/src/app-server/run-attempt.checkpoint.test.ts extensions/codex/src/app-server/settled-turn-finalizer.test.ts --maxWorkers=1focused-capture-consumers: 52 tests, 3 files, 57.22s.
pnpm test src/gateway/session-transcript-preview.hydration.test.ts src/worker/worker-fault-injection.cleanup.test.ts src/config/sessions/session-history-worker-errors.test.ts --maxWorkers=1focused-imports: 41 tests, 7 files, 36.46s.
pnpm test src/agents/sessions/session-manager.import-boundary.test.ts test/scripts/runtime-process-build-graph.test.ts src/config/sessions/session-history-read.imports.test.ts src/config/sessions/session-transcript-reconcile.imports.test.ts src/config/sessions/paths.test.ts src/config/sessions/transcript-target-binding.test.ts src/config/sessions/transcript-write-context.test.ts --maxWorkers=1focused-lifecycle-sharing-receipts: 116 tests, 9 files, 110.78s.
pnpm test src/config/sessions/session-sharing-store.incognito.test.ts src/config/sessions/session-sharing-store.worker.test.ts src/config/sessions/session-reaction-store.test.ts src/config/sessions/session-accessor.compaction-boundary.test.ts src/config/sessions/restart-recovery-receipt.test.ts src/config/sessions/session-cold-storage.preflight.test.ts src/config/sessions/session-accessor.sqlite-cold-read.test.ts src/config/sessions/session-accessor.sqlite-page-reclamation.binding.test.ts src/config/sessions/session-accessor.sqlite-cleanup-reclamation.test.ts --maxWorkers=1focused-replacement-fork: 90 tests, 8 files, 135.38s.
pnpm test src/config/sessions/session-accessor.sqlite-replacement-projection.test.ts src/config/sessions/session-accessor.sqlite-replacement-worker.test.ts src/config/sessions/session-accessor.sqlite-replacement-publication.test.ts src/config/sessions/session-accessor.sqlite-replacement-receipts.test.ts src/config/sessions/session-accessor.sqlite-message-cut.test.ts src/config/sessions/session-accessor.transcript-identity.test.ts src/config/sessions/session-accessor.parent-fork.test.ts src/config/sessions/session-accessor.parent-fork-worker.test.ts --maxWorkers=1focused-sdk-contract: 71 tests, 8 files, 122.49s.
pnpm test src/plugin-sdk/session-transcript-preparation-compat.test.ts src/plugin-sdk/session-transcript-runtime.worker-preparation.test.ts src/plugin-sdk/session-transcript-lock.native.test.ts src/plugin-sdk/session-transcript-mirror-runtime.test.ts src/plugins/session-catalog.test.ts src/plugins/session-catalog-history-import.test.ts src/plugins/compat/registry.test.ts src/plugin-sdk/session-transcript-lock.worker.test.ts --maxWorkers=1focused-session-manager: 76 tests, 6 files, 135.66s.
pnpm test src/agents/sessions/session-manager-incognito.test.ts src/agents/sessions/session-manager.test.ts src/agents/sessions/session-manager-async-entries.test.ts src/agents/sessions/session-manager-maintenance-async.test.ts src/agents/sessions/session-manager.persistence-compat.test.ts src/gateway/server-close.incognito-manager.test.ts --maxWorkers=1focused-turn-rewrite-goals: 253 tests, 12 files, 357.84s.
pnpm test src/config/sessions/session-turn-planning.test.ts src/config/sessions/session-cold-storage.transcript-turn.test.ts src/config/sessions/session-accessor.transcript-turn-initialization.test.ts src/config/sessions/session-message-rewrite.test.ts src/config/sessions/session-transcript-events.worker.test.ts src/config/sessions/goals-operations.test.ts src/config/sessions/goals.test.ts src/config/sessions/transcript.test.ts src/config/sessions/session-accessor.test.ts src/config/sessions/session-cold-storage.lifecycle.test.ts src/agents/run-session-target.test.ts src/config/sessions/session-manual-compact.worker.test.ts --maxWorkers=1Inactive audit, native-deletion ledger, and measured diff
Closed for the explicitly bound inactive arm: SS1, SS2, SS3, SS7, SS9, SS10, SS11, SS12, SS13, SS14, SS16, SS17. Production acquisition/native deletion remains P12; P01 facts, P04 history, and SS4 provider-review persistence are not charged here.
Retain host-native acquisition and selectors until activation. Native kernels still serve durable/offline and worker-local execution. Deprecated durable SDK callbacks remain until the next Plugin SDK major, independently of P12. The inherited durable recovery-receipt locator reread limitation is unchanged; actor rereads retain their captured incarnation.
Production: +3,374/−611 (3,985 changed, net +2,763; 91 files). Tests/support: +2,928/−140 (3,068 changed; 20 files). Docs: 181 changed lines; tooling: one-line shrink. Growth implements complete inactive operation/consumer contracts and the approved SDK compatibility window.
CHANGELOG.mdremains release-owned; migration and release-note context is above.Landing integration
Integrated main
432ade6f500de6cdb0bcd4b0948a07bf466672f1with a merge commit to resolve real conflicts. The integration preserves main's full source-validation facts, reserved transcript reader lane, cold-transcript retry and cancellation, replacement selection, and lifecycle settlement alongside the inactive actor operations. No activation, schema, retention, permission, or new environment-variable contract is added.Two bounded repairs came from landing validation. Main now gives identity publications a commit receipt sharing the same source object; the actor turn normalizes that one shared source so the receipt cannot retain a native symbol that fails worker serialization. Actor runtime-target requests also normalize unqualified SDK keys before canonical worker admission. The public SDK regression failed with
SESSION_CANONICAL_KEY_MIGRATION_REQUIREDbefore the producer fix; strict worker/grant validation remains unchanged.Line-limit cleanup reuses the existing message-cut result type, moves cold-storage batch types into their existing types owner while preserving the existing maintenance-result export, and consolidates identical actor read-grant payloads. No SQL is added by these repairs.
Released SDK signatures were checked against
v2026.10.1-beta.1and stablev2026.9.9; compatibility records and type coverage remain intact, with no deprecated bundled production consumers. The existing classified SDK reports, published-driver update proof, and alternating-pair SQL proof above are reused for unchanged contracts; no new SQL measurement is claimed. Production selection remains inactive and the original T1 result is 781 → 781.ClawSweeper completed review of
3dee7218593d30b3bd6f4e18d1428b1f33b6eb9dwith zero code findings; its outstanding integration item is addressed here. Earlier-head ClawSweeper evidence is retained under the maintainer's scoped landing instruction.Integrated production source:
335fadf59351ae903fc0511f82f66421a668e332. Final candidate:6654a1776ded7c324c842cd53a6153a02d651320. The fresh isolated P2 review is clean. Core, all core-test shards, extension production/test types, targeted integration lint, and Madge (zero cycles) pass. The final focused selection completed 17 files with 229 passed / one independently inherited failure in 1,049.68s; the new SDK normalization regression took 35ms in its warm suite. Local commands used zero hosted CI seconds. Earlier passing SDK worker/mirror, message-cut, import/build-graph, and type-contract proof is reused where inputs are unchanged.The inherited local failure is
src/plugins/compat/registry.test.ts→keeps every record actionable: untouchedworkspace-mutation-guard-callbackmetadata points to deletedsrc/plugins/runtime/runtime-agent.workspace.test.ts. That path is absent both at integrated main432ade6f500dand current main;workspace-mutation-guard.tsis byte-identical in both baselines and the candidate (blob7cc5501f7494d4213ae883bc4f4b335bab772def), and the registry test is byte-identical to the integrated baseline (blob6113149ab4d196adce41fcacb388a018239f484e). The test was removed by98eb5759c934(#167563). No assertion or compatibility exception was changed to mask it.CI run 37966578284 exposed a PR-caused wrapper-inventory omission:
src/state/openclaw-agent-execution-incognito-absence.tswas missing fromscripts/pr-lib/wrapper-components.txt. The one-line fix is8cdd231fe453; both failing eager-import-closure tests pass locally (79.29s command wall time; zero hosted CI seconds), and isolated P2 review of that exact follow-up is clean. Production source and its passing proof are unchanged.Test-only follow-up
6654a1776dedmigrates the OpenCode catalog capture mock and Gateway mid-append revocation hook fromwithSessionTranscriptWriteLockto the production caller'swithSessionTranscriptWrite. CI had exposed both stale hooks; imported-message and revoked-source persistence assertions are unchanged. Both full files pass on Node (32 tests, 240.44s command wall time), and the exact revoked-source case passes on the repository-pinned Bun build (111.34s command wall time, one selected case). Local proof uses zero hosted CI seconds. Production source and its clean P2 review remain unchanged.Inherited CI disposition
The completed current-head CI run tested merge
cc01419c1e20dc7435208346cfc48860ee9c37bb(mainaffd282dba168daeb165f29b8c4bf76267c4023cplus candidate6654a1776ded7c324c842cd53a6153a02d651320). It has 111 successful jobs, 22 skipped jobs, three failed test jobs and the downstream failed gate, with no cancellations. Security passes independently. Native admin landing is authorized for these unchanged/unrelated failures; none is relabeled green.[0,0,1,2]versus[0,1,2]). The fixture logs requests before route dispatch and counts bodies without messages as zero. The raw extra request was not retained, so no specific probe/retry cause or reproduction on main is claimed. Slack presentation, provider routing, and model attempt/retry owners are byte-identical to the CI baseline; the changed inactive actor and missing-key paths are not entered.The native evidence retains the original job logs, exact baseline/tested blobs, checkout correlation, scoped passing proof and uncertainty. ClawSweeper's later
8cdd231fe453catalog-interceptor finding is resolved by6654a1776ded; its earlier review is reused without a new request.