Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ S15/S16 target terms below refine product intent. Definitions explicitly marked

**Conversation:** A durable discussion with one or more Bot participants. Membership, a display label and an @mention do not grant execution or resource access.

**Computer needs-you card (S16):** An origin-only conversation handoff for sign-in, verification or CAPTCHA (ADR 0092). Inserting the card precedes yielding the computer under a new screen generation. Watch screen takes exclusive owner control after earlier operations settle. Screen events supply resumed/declined/expired outcomes; the next eligible work receives them as labelled data, and only committed result publication marks the carried set delivered. Routine occurrences use their existing needs-you state without yielding. Sensitive-site sessions remain in the protected browser.
**Computer needs-you card (S16):** An origin-only conversation handoff for sign-in, verification or CAPTCHA (ADR 0092). Inserting the card precedes yielding the computer under a new screen generation. Watch screen takes exclusive owner control after earlier operations settle. Screen events supply resumed/declined/expired outcomes; the next eligible work receives them as labelled data, and only committed result publication marks the carried set delivered. After a resumed hand-back, CONT16-01 schedules at most one host continuation of the original work, retaining its grant, model pin, workspace, charged allowance and memory/file fences (ADR 0094). Decline, expiry and ordinary takeover do not auto-run. Routine occurrences use their existing needs-you state without yielding. Sensitive-site sessions remain in the protected browser.

**Shared client (S16, API16-01):** The browser/native-safe transport and ephemeral projection state over the existing protected Jit service. It submits exact owner commands, reads currently authorized snapshots/control events, recovers the original send identity and reviews exact actions. It is not a second authority, engine or store. The [client contract](docs/contracts/s16-client-v1.md) supports text/tool work and exact decisions. Explicit file composition additionally supports the first [UTF-8 file-to-artifact workflow](docs/contracts/s16-files-v1.md) and React `/s16` client; an explicit strict parser configuration additionally supports [isolated PDF/PNG/JPEG inputs](docs/contracts/s16-binary-files-v1.md) through actual guarded Schway image sends. Explicit [sourced file memory](docs/contracts/s16-file-memory-v1.md) additionally carries exact original/representation pins through later work and inference history, with withdrawal/correction/forget and current recipient/private-scope checks; live steering remains unavailable; Linux isolation and live-account vision evidence remain separate pending acceptance.

Expand Down
121 changes: 121 additions & 0 deletions docs/adr/0094-s16-continue-after-computer-hand-back.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
status: scoped implementation for CONT16-01 (#459); owner outcome confirmed by the issue; review and required CI pending
date: 2026-11-18
scope: CONT16-01 (#459); S16-AC06/AC07/AC11; FR-10/14/15/35/38/40; NFR-07/14
---

# Continue the existing work after a computer hand-back

## Confirmed target and retained boundaries

The owner requests an automatic Bot run after handing back a `needs_you` takeover (#459). There is at most one
automatic continuation per card, no routine continuation, and the run uses ADR 0092's existing outcome source.
The owner need not send another message after signing in. Hand-back is a scheduling trigger, not approval of an
effect or permission to change the original task. S16-D07 and the current standing policy still decide every action.

ADR 0092 / PR #463 supplies durable origin-only cards, exact screen outcomes, actual-VM-scoped outcome delivery and
publication-only delivery marks. Jit already owns durable CHAT requests, work authority, VM attempts and MODEL step
identities. Schway owns each execution loop, retries and native session; Jit must not replay a claimed loop/tool call.

## Alternatives and selected engineering choices

1. Reopen the old native session or replay its claimed request. Rejected: the previous run may already have ended
or have an uncertain claim, and another request cannot certify native/tool settlement.
2. Submit a synthetic owner message and admit unrelated new work. Rejected: a new work identity loses the original
workspace affinity, can select a different computer/model, resets per-work allowances and misrepresents the owner.
3. Continue the existing Jit work through a fresh CHAT request, VM session and public MODEL step. Chosen: retain
the original authority, computer/workspace affinity, model pin, disclosure ancestry and finite charged allowance;
only the execution attempt and receipt are new. This uses the current Jit services and Schway public surface.

The Rakazo-style outcome is continuity after human control. Importing another continuation worker/authority stack
is unnecessary for that outcome and would require a replacement/state-preservation contract. No upstream runtime,
source, asset or dependency is imported by this choice.

## Contract

1. **Trigger.** Only the durable `yield_resumed` event creates eligibility. Decline and expiry do not request another
run. An ordinary screen hand-back with no needs-you card creates none. The existing S15 scheduler scans the
protected events/cards on boot and each wake, even while another conversation keeps the shared drain active; successful owner hand-back also wakes it. Events remain eligible
across a process loss before scheduling. No model, guest, page, typed reply or notification invokes this ingress.
2. **One durable binding.** An additive conversation-store record binds one card ID to one deterministic continuation
request ID, source request and original work/root. The binding and CHAT request commit in the same conversation
transaction. A retry/restart re-registers only a saved queued request with the same binding; completed, held,
stopped, running-at-crash or otherwise claimed work is never submitted again. Unfinished bindings are not evicted.
3. **Existing authority.** Protected `s16-computer-continuation/v1` metadata identifies the source card/request and
original task. It is not accepted on the public message API. The continuation keeps the original work ID,
policy revision, purpose, resources, route/model pin and frozen intent. It does not run another interpretation or
mint owner authority. Current owner generation, original work/policy, Bot/private scope, source binding and
parent/delegation restrictions are guarded before admission, every send/tool and publication. An explicit stop,
withdrawn authority, changed owner or uncertain prior claim prevents execution and remains visible.
4. **Finite budget.** Existing POLICY/MODEL per-work reservations and unknown usage remain charged to the same work.
CHAT also narrows the new attempt's ceilings to the original task's remaining model/tool allowance, including
earlier continuation attempts. A new receipt cannot reset or increase a budget. Exhaustion is an honest hold.
A delegated continuation retains its original parent/slice and runs only while that authority is current; routines
use their existing occurrence `needs_you` state and never enter this path.
5. **Fresh sessions, persistent state.** `WorkingVmService.openAttempt` creates a fresh session ID/unit and operation
claims while retaining the original `chat_<workId>` workspace key. The MODEL step ID is domain-separated by the
continuation receipt/card; earlier loop/tool/session claims remain untouched. The original work's durable pool affinity keeps the browser
session and workspace on the card's computer, even if another shared member is less loaded. An unavailable/full
original computer holds the attempt rather than falling back. A changed Bot setting affects new work, not this
existing work's pin. File receipts retain their original ingress/memory semantics and are rechecked for withdrawal.
6. **Context.** The fresh execution step receives the original task and bounded, labelled prior work evidence so it
can inspect progress without replaying old calls or trusting a model claim of success. This is data, not authority
or parsed memory claims. The screen outcome remains solely in `screen-outcome-data-never-authority`; it is selected
after actual placement and marked only in committed result publication, as in ADR 0092. Source bytes participate
in MODEL input validation/hash. The newest eight prior requests are ordered deliberately, with the posting source
last; the bounded byte budget favors their newest observations. Interpretation context is unchanged. Unknown effects require reconciliation.
7. **Serialization and existing progress.** A posting run still running is allowed to finish before a continuation
starts. Only a live run or a queued request with a process-local authenticated owner blocks that conversation;
an ordinary stranded queue after restart is not runnable and cannot keep an unrelated original task pending forever. Another run already carrying the same outcome is observed to settlement before another automatic run is
considered. A committed run that already carried it can cover the binding, avoiding duplicate work; this records
an existing continuation, not a claim that the original task is complete. A failed/held/unknown such attempt
remains attention rather than becoming an outer provider/effect retry loop. One conversation continues to run
only one request at a time. No pending job holds a VM/native session while waiting.
8. **Owner experience.** The card projects actual pending/queued/running/completed/held/stopped/covered/unknown
continuation facts and the linked request. It does not promise success before publication. The transcript labels
this as continuation of the existing task, not a new owner message. Model usage maps the exact work and MODEL
step to its receipt, so sharing the work cannot attribute all earlier usage to the latest request. English/Thai,
keyboard focus, mobile layout and session-loss withholding use the existing shared client.

## Migration and compatibility

Only additive protected metadata/bindings are needed. Existing cards can become eligible from their terminal
events; delivered/claimed ones are coalesced or held according to the rules above. Old clients ignore additive
projections. The S14 default, S15 opt-in, standing policy, historical private scope and protected-host boundary do not
change. Disabling the relevant computer service must leave retained continuations inert and must not erase/replay
their identities. Real guest/account/device acceptance and owner-host adoption remain #431 and separate cutover gates.

## Required conformance evidence

Use scripted models, protocol fixtures, fake clocks and barriers to prove:

- Real `computer_browser` needs-you → owner takeover/login/hand-back → automatic execution/result with no owner
`continue` message; the actual MODEL request carries ADR 0092's outcome and fresh generation.
- Two shared members: automatic work keeps the signed-in member/workspace despite load/drain; another member
cannot consume its outcome. Work prepared before the outcome cannot mark it.
- Source run finishing after a quick hand-back; same-event duplicates; crash before scheduling, between binding
and request commit, after queue commit and after model/tool claim. No duplicate loop, tool, effect or result.
- No continuation on ordinary takeover, decline, expiry, routine, explicit stop, changed owner, revoked scope,
archived/private-mismatched Bot, exhausted allowance or uncertain claims; holds/results reflect actual facts.
- Shared logical-task budgets and model pin survive multiple handoffs; previous workspace edits/file semantics
remain available without silently rewriting original/private state. Withdrawn files and new private recipients
retain their existing fences; hand-back approves no payment, credential change or other human-required action.
- Current-run/other-run coalescing and failed publication preserve the exact outcome delivery set. Production and
fallback paths, per-receipt usage attribution, restart recovery and actual English/Thai client flows all conform.

Run affected suites, typecheck, provenance checks and full required CI on the final head. Record actual native
browser fixture evidence separately from guest Chromium/SSH/sudo, subscription, physical-device and live-host proof.

## Local conformance record

The deterministic continuation suite covers automatic production and fallback execution, the original work/workspace
and finite allowance, per-step receipt usage, two-computer affinity, quick hand-back, duplicate events, queued and
claimed-state restart recovery, coalescing, stop/revocation/owner/budget/unknown fences, memory forget before/during/after
the run, queue/publication rollback and refusal of public continuation forgery. Restart tests reopen persisted
journals and explicitly seed an interrupted claim; they do not claim a physical guest/process power-loss test.
The native Chromium English/Thai fixture exercises keyboard takeover, a real password form and cookie reload,
automatic continuation without another owner message, host-labelled transcript, focus restoration, mobile width
and authentication-loss withholding, including opening a retained continuation after 34 newer requests. Guest operations and MODEL are fixtures; no live account, subscription, real
SSH/sudo or owner-host adoption is certified. ADR 0092's separate delivery suite isolates the CONT16 scheduler to
continue testing ordinary next-run delivery and publication rollback. Required final-head CI/review evidence belongs
in the implementation PR.
24 changes: 23 additions & 1 deletion docs/contracts/s16-computer-browser-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,29 @@ Provider failure, cancellation, publication rollback or `result_unavailable` pre
no-computer work, a different shared pool member and outcomes arriving after preparation do not mark them.
A logical pool resource alone never proves placement. Inputs validate and hash the outcome set.
Interpretation and memory-claim parsing receive no such source. A fresh run starts at the hand-back generation;
observations from before yield remain stale. A durable per-VM observation high-water mark makes each control transition exceed every previously exposed browser generation, including after multiple reads or restart. Automatic continuation is separately owned by #459.
observations from before yield remain stale. A durable per-VM observation high-water mark makes each control transition exceed every previously exposed browser generation, including after multiple reads or restart. CONT16-01 (#459 / ADR 0094) schedules one automatic continuation after `yield_resumed`, without another owner message.

Each service wake scans screen events through a durable bounded cursor, including while an unrelated conversation
keeps the shared drain active. Only live runs and runnable owner-registered queues block the same conversation. A conversation-store binding and
one deterministic queued CHAT request commit together; restart re-registers only a saved queued request. Claimed,
held, completed and stopped runs are never replayed. The source run must settle first; another committed run that
already carried the outcome covers the binding. Failure/unknown status remains attention rather than triggering
another automatic attempt. Decline, expiry, ordinary takeover and routine occurrences never schedule this path.

The new receipt retains the original work grant, frozen scope, model pin, charged allowances and VM workspace
`chat_<workId>`, with a fresh VM session and MODEL step. Actual placement must still be the signed-in computer.
Original-task CHAT model/tool ceilings are narrowed by all earlier attempts, including at activation. Current owner,
policy, Bot/private scope, parent authority, file withdrawal, memory ancestry and unknown tool claims are fenced
before every send/tool/publication. Hand-back approves no effect. Bounded prior tool observations enter only
`prior-computer-work-data-never-authority` (validated and included in MODEL's input hash); outcome facts still use
only the existing source above. Copied instructions are never retained as new owner messages or interpretation
history; inherited claim ancestry invalidates the new native context after forget/withdrawal.

Cards optionally project `continuation: { state, requestId, code }`, with actual `pending`, `queued`, `running`,
`completed`, `held`, `stopped`, `covered` or `unknown` status. This read never starts work. Transcript rows carry
`computerContinuation: { cardId, originalRequestId }` and a host-continuation label, with exact MODEL step usage
attributed to that receipt. Opening a retained continuation uses the guarded request endpoint and revalidates it
on refresh, including beyond the 32-row transcript window. These are additive authenticated client fields, not public authority-bearing ingress.

Routine runs return a host-observed `computer_needs_you` completion hold, mapped to the existing occurrence
`needs_you` state. They neither create a desktop card nor yield an unattended computer.
Expand Down
12 changes: 11 additions & 1 deletion src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5758,7 +5758,17 @@ export const en: Record<MessageKey, string> = {
"s16.needsYou.declined": "Declined",
"s16.needsYou.expired": "Request expired",
"s16.needsYou.void": "Request unavailable",
"s16.needsYou.continue": "Send a message to continue.",
"s16.needsYou.continue": "Control returned to the Bot.",
"s16.continuation.pending": "Waiting for the current work to settle before continuing.",
"s16.continuation.queued": "The Bot is queued to continue this task.",
"s16.continuation.running": "The Bot is continuing this task.",
"s16.continuation.completed": "This continuation finished. See its result below.",
"s16.continuation.held": "The continuation needs attention.",
"s16.continuation.stopped": "This continuation was stopped.",
"s16.continuation.covered": "The Bot already continued in another run.",
"s16.continuation.unknown": "The previous run needs reconciliation before continuing.",
"s16.continuation.open": "View continuation",
"s16.continuation.label": "Continuing the existing task",
"s16.needsYou.protected": "This site requires the protected browser.",
"s16.needsYou.failed": "The screen state changed. Refresh before trying again.",
"s16.browserCard.title": "Review this browser action",
Expand Down
Loading
Loading