Skip to content

feat(cloud-workers): durable transcript commit protocol for worker sessions - #104809

Merged
steipete merged 6 commits into
mainfrom
claude/cloud-workers-transcript-ingest
Jul 12, 2026
Merged

steipete merged 6 commits into
mainfrom
claude/cloud-workers-transcript-ingest

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Part of #104294 (cloud workers, milestone 2, PR 6). Builds on the merged milestone-1 stack plus #104688 (authenticated worker role). Design: docs/plan/cloud-workers.md ("Session backend RPCs" — durable transcript commits).

What Problem This Solves

An admitted worker (PR 5) still can't put anything in a session. This PR adds the durable transcript-commit contract: the worker appends semantic message turns and the gateway turns them into real transcript entries visible to normal sessions.messages.subscribe clients — so a worker-run session appears in the sidebar exactly like a local one — with DAG integrity and idempotent replay guarantees.

Why This Change Was Made

  • Strict semantic commit RPC on the closed worker allowlist: the frame carries only runEpoch, sequence, base-leaf CAS anchor, and resume-valid user/assistant/tool-result messages. There is no wire session/entry/parent id at all — the admitted credential is the destination session, so appending to another session or supplying ids is not schema-expressible (unrepresentable, not just rejected).
  • Gateway-side application validates credential-session binding, owner epoch (stale/fenced workers rejected), and base-leaf CAS (a reconnected worker cannot fork the DAG), then writes each entry through SessionManager.appendMessage so parent/leaf/DAG invariants hold and the gateway generates all ids.
  • Durable (sessionId, runEpoch, seq) replay ledger (two dedicated tables — pending claim, ordered cursor, cached terminal RPC result) so a tunnel reconnect replaying the last commit is idempotent: no duplicate or reordered entries. At-least-once delivery with deterministic dedupe, not exactly-once.
  • Branched-commit recovery: if a prior commit's entries already exist in the DAG (crash between append and cursor write), the applier matches the commit's idempotency-key chain against existing children and fails closed on ambiguity rather than duplicating.
  • Appended entries flow through the normal session broadcast/fanout — no parallel notification path.

User Impact

Opt-in only; no worker loop or inference yet (PRs 7-8 add live-event streaming and the inference proxy, PR 9 the worker mode). This is the mechanism by which worker sessions will populate the sidebar. No config/changelog/version-bump changes.

Evidence

  • Blacksmith Testbox: 6 Vitest shards green (transcript-commit protocol + store, worker admission, session-accessor SQLite path, session-manager DAG, session-message-events fanout with generated ids across sequences, state-DB migration, worker admission handler, lint-suppressions).
  • Rebased onto main across a large session-accessor SQLite refactor: the pre-refactor append helper was obsolete, so the integration adopts main's native withTranscriptWriteTransaction (writer queue + one outer agent-DB transaction) instead of keeping a second path.
  • Codex fresh autoreview on the final rebased head: clean, no actionable findings (two earlier findings fixed in the harden/recover commits). Local: oxlint (23 files), check:test-types, madge zero, db:kysely:check, docs:map:check, protocol:check all green.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 12, 2026
@steipete
steipete merged commit 04f945f into main Jul 12, 2026
144 of 146 checks passed
@steipete
steipete deleted the claude/cloud-workers-transcript-ingest branch July 12, 2026 00:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 12, 2026
…ssions (openclaw#104809)

* feat(cloud-workers): add transcript commit protocol

* feat(cloud-workers): persist transcript commit replay state

* feat(cloud-workers): apply transcript commits to sessions

* fix(cloud-workers): harden transcript commit admission

* fix(cloud-workers): recover branched transcript commits

* fix(cloud-workers): preserve diagnostic semantics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant