DreamLake

Memo session round trip

Status: unreleased backend draft. Browser product integration and a live native provider disconnect/reconnect acceptance run remain unverified. Human acceptance is separate from execution verification.

The session owner's personal namespace controls dispatch. A memo can belong to an organization the owner can edit. Linking a memo never grants session control. Register the exact native session and explicitly link its saved ID through the CLI before dispatch. This feature resumes that saved identity; it never creates a replacement session, selects another host, or expands to another person's session.

Dispatch

POST /namespaces/:owner/session-commands/memos/:memoNamespace/:memoId

json
{
  "sessionId": "0123456789abcdef01234567",
  "revision": "<opaque retained memo revision>",
  "mode": "tmux",
  "idempotencyKey": "memo-task-attempt-1"
}

mode is required: tmux preserves a persistent interactive runtime; headless runs a bounded provider turn. The current CLI headless adapter has a 15-minute provider timeout. Do not select headless for an unbounded implementation task. An optional runnerId selects an existing owned runner under the existing routing rules; it cannot move a session already bound to another runner.

The server reads the retained revision and extracts exactly one fenced text block under ## Prompt. It stores the revision and prompt hash on the existing session command. It does not rewrite the memo. The memo writer grant and explicit session link are fenced at enqueue and claim. A removed grant/link fails queued work without blocking later commands on that runner. A grant revocation after handoff is not a cancellation mechanism.

Keep the same idempotency key after a lost response or reconnect. A matching retry returns the existing command; changing the prompt revision, target, or mode under that key conflicts. Existing uncertain handoffs are not automatically re-executed. A new key is a new intentional execution request, not a recovery operation.

Durable read and execution verification

GET /namespaces/:owner/session-commands/memos/:memoNamespace/:memoId returns at most 50 newest commands with nextCursor and hasMore. Continue with ?cursor=<nextCursor>. Reads require current memo access and only return the caller's own command ledger, including the original prompt provenance and runner receipt. Browser disconnect does not cancel the command. Reconnect by reading; never enqueue merely because a browser was reopened.

The executionState projection distinguishes queued, running, failed, cancelled, uncertain, awaiting-result, awaiting-verification, and verified-complete. A completed terminal paste or tmux launch is awaiting-result, not verified work. A matching headless receipt or correlated Codex tmux terminal receipt with a nonempty reply is awaiting-verification. resultText projects the retained result; result preserves the original delivery receipt and nativeReceipt identifies the provider session, turn, prompt hash and transcript offset. Explicit :memo[id] and :artifact[namespace/id] result directives populate resources (up to 20 references); current read permissions are checked on every read. Saved legacy :note[id] directives remain readable; use :memo[id] for new results. Resources created without an explicit result directive are not inferred.

The companion CLI runner saves an exact native transcript cursor before sending the memo prompt. It waits for a matching user prompt and task_complete event in that same Codex turn; terminal paste alone is insufficient. Its observer has no 15-minute provider timeout. Interruption retains the cursor for reconciliation without sending the prompt again. A late correlated result may project completed execution while the original command status remains uncertain; the original lease outcome is never rewritten. Missing, changed, steered or ambiguous native evidence remains unresolved. This tmux collector currently supports Codex only.

POST /namespaces/:owner/session-commands/:commandId/verify-memo-result accepts {"evidence":"<specific acceptance check and evidence reference>"} only for a matching execution result. The first acknowledgement is immutable: repeating the same evidence succeeds; conflicting evidence is refused. It records the token holder and time. This is caller-supplied verification evidence, not proof that the server independently ran that check or that the caller is a human.

Every memo result still reports acceptance: pending-human-review. No autonomous branch finish, runner receipt, or verification call grants human acceptance. The native adapter and backend remain unreleased. Live same-session browser acceptance and consumer integration must be validated before claiming end-to-end product completion.

Storage and compatibility

SessionCommand gains optional memoId, memoContext, and memoVerification fields. Existing commands and runner wire inputs remain valid. The existing idempotency reservation, runner lease, cancellation and reconciliation mechanisms remain authoritative. No new scheduler or cloud provisioning is introduced.

Local recovery evidence

The isolated Mongo/Chromium regression fixture passed with the backend source: a browser submits a command and closes; the store records the synthetic runner result; a fresh browser reads that same command, retries its key without another execution, and records execution evidence while human review stays pending. This is backend recovery evidence with synthetic authorization, memo storage and provider output, not a live native-provider acceptance run. The fixture also regresses absent/null verification storage and conflicting verification receipts.