Skip to content

feat(stream): a lease holder watches its own lease's screen - #1025

Merged
V3RON merged 21 commits into
feature/1013-adrfrom
task/1015
Oct 27, 2026
Merged

V3RON merged 21 commits into
feature/1013-adrfrom
task/1015

Conversation

@V3RON

@V3RON V3RON commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1015

Status

Implement: done (5/5 green, audit 4/4 Done when) Review: passed round 1, 0 open Hardware: n/a Gate: waiting for the stack
Next: merges with the #1013 stack

Assumptions

  • Assumption: where does the 0x07 test run? — at the stream module's surface (src/stream/create.test.ts), since the device-lost cases need a real health monitor and an enrolled phone

Done when

  • pnpm test passes with the five tests above. — five Tests lines built and green locally (build 5/5, audit probed 6/6); CI pending on head
  • The OpenAPI document lists GET /v1/leases/{id}/stream with its statuses. — check-openapi.mjs passes (34 operations)
  • watching-the-screen.mdx and access-control.mdx say a lease holder can watch its own lease, and how a stream ends. — pages edited in this PR; website build passes
  • src/stream/AGENTS.md and src/http/AGENTS.md describe the lease route. — both edited; audit fixed two stale lines in src/stream/AGENTS.md

Review

Spec review: 1 blocking, 0 fixed, 0 notes. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 1. Tokens: 7.0M.
Runs: 8. Cost USD: 6.3551. Agent seconds: 2518.
Assessment: complete

Rejected:

  • spec: unknown tag has no test (ui/src/data/stream.test.ts:517) — [incorrect] the alive frame takes the same unhandled-tag path and the 0x07 after it still arrives (ui/src/data/stream.ts:239-250)

Written by an agent.

@V3RON
V3RON added this pull request to stack #1027 October 26, 2026 15:15
@V3RON

V3RON commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Decision taken

Question: a module's lease route is /v1/leases/{id}/<module name>. Core already has lease sub-routes renew and exec. What happens when a module's name is one of them? Today the host only checks names against core first segments, so such a module would load and the routes would clash.

Options:

  1. The host refuses to load the module (taken). A user who loads a module named renew or exec gets a load error, as a name clashing with a core first segment does today. POST /v1/leases/{id}/renew and exec keep working.
  2. The module route wins. renew or exec stops working for every lease on that daemon.
  3. Core wins silently. The module loads but its lease route is never reached; the user sees no error.

Why 1: it is the rule the host already applies to first segments, it keeps every core route working, and no shipped module has such a name, so nobody sees a change today.

Reverting: drop the names from the host's clash check and the #1015 test that pins it; the ADR 0049 line changes with it.

Raised in the ADR review on #1014; folded into #1015 (Modules touched and Tests), marked pending the maintainer. This PR builds it.

Written by an agent.

@V3RON

V3RON commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Decision taken

The audit found three branches no test catches and one test away from its named seam. Nothing a user sees changes; these settle what the tests pin.

  1. Worker's own 404 UNKNOWN_LEASE (lease missing from the worker's registry, src/stream/worker-link.ts). Options: add a row at the worker's stream lease handler (taken), or leave it untested. Taken because a deleted check would serve a picture for a lease the worker no longer holds. Reverting: delete the row.
  2. An unleased device going absent writes no 0x07. Options: add a row to the 0x07 test (taken), or rely on the older follows its device test. Taken so the 0x07 test catches its own condition. Reverting: delete the row.
  3. The relay's leaseId has no effect on the stream target yet. Kept as the spec (F5) names it; no test, since nothing reads it here. Input socket for a lease #1017 is its first reader.
  4. The 0x07 test runs in src/stream/create.test.ts, not the e2e file the Tests section names: the device-lost cases need a real health monitor and an enrolled phone. Options: keep it there (taken), or move it and fake both in the e2e daemon. Reverting: move the test.

Folded into #1015's Tests, marked pending the maintainer.

Written by an agent.

@V3RON

V3RON commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 0f28cc7
Round fix-check: 46ea88c

Runs: 10. Cost USD: 6.5132. Agent seconds: 2575.
Tokens input 506, output 132153, cache read 20869365, cache write 769626.
- build implementer: claude-sonnet-5-5 841 s $1.9657
- build implementer: claude-sonnet-5-5 134 s $0.2749
- audit implementer: claude-sonnet-5-5 319 s $0.6251
- fix implementer: claude-sonnet-5-5 76 s $0.1696
- review 1 reviewer: claude-sonnet-5-5 552 s $0.3262
- review 1 spec: claude-sonnet-5-5 50 s $0.2935
- review 1 claims: claude-sonnet-5-5 85 s $0.3409
- review 1 code both: claude-opus-5-5 461 s $2.3592
- fix ci implementer: claude-sonnet-5-5 33 s $0.0857
- review fix-check reviewer: claude-sonnet-5-5 24 s $0.0724
Finding outcomes: {"incorrect":1}. Classes: {"testing 3":1}.
{"findings":[{"id":"R1","role":"spec","class":"testing 3","outcome":"incorrect","path":"ui/src/data/stream.test.ts","round":"1"}]}

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review October 26, 2026 15:37
@V3RON
V3RON merged commit 569b0c4 into main Oct 27, 2026
48 of 50 checks passed
@V3RON
V3RON deleted the task/1015 branch October 27, 2026 21:13
V3RON added a commit that referenced this pull request Oct 27, 2026
Closes #1019

### Status

Implement: done Review: passed (round 2) Hardware: unavailable (disk
14.8 GiB free, the lane needs 15) Gate: waiting for the stack
Next: needs-hardware. Run Done when line 3 on a machine with disk space
and an iOS simulator

## Assumptions

- Assumption: where the iOS device input lives —
`src/drivers/ios/input/` (an `index.ts` and `device-input.ts`, as
Android's `input/`) instead of the spec's single `input.ts`, so its test
goes through an `index.ts` (testing rule 6).

## Done when

- [x] The two Tests lines and the `byte-pipe` test pass in `pnpm test`,
and `src/source-hygiene.test.ts` passes.
- [x] `pnpm build:capture` builds `simlock-screen-capture` with the
input mode where Xcode is selected.
- [x] On a simulator, `e2e/slow-agent-device.test.ts` opens a lease and
the Appduct fixture through agent-device, opens `WS
/v1/leases/{id}/input`, gets 0x83 and 0x82, taps the centre of
`tab-status` as agent-device's snapshot places it, and the next snapshot
shows the Status tab's screen (slow lane, iOS simulator). — slow lane on
2ffb9ae, 2026-10-27: passed (18 passed, 17 Android cases skipped)
- [x] `watching-the-screen.mdx` lists what input does on iOS: touch,
scroll, Home, keys on iOS 26 runtimes; not the app switcher, Lock,
rotation or keys on iOS 27 (#1024).
- [x] An agent token streams its own lease through a gateway and through
a standalone worker, and gets 404 for anyone else's. — #1015 (PR #1025),
`src/daemon/stream-gateway.e2e.test.ts`
- [x] A test client that follows T3 Code's message order (waits for
0x83, reads 0x82, sends touches and keys) drives a faked device through
a gateway, in the fast lane. — #1017 (PR #1034),
`src/daemon/input-lease.e2e.test.ts`
- [x] A real iOS simulator and an Android emulator take a tap through
the input socket: a tap on a known control opens the next screen, as
agent-device's snapshot shows (slow lane). A person confirms a tap on an
Android phone (slow lane, person at the phone). — simulator and emulator
taps passed on the slow lane 2026-10-27; the phone tap
(`e2e/slow-android-physical-manual.test.ts`) was confirmed by the
maintainer at the phone
- [x] Ending the lease ends both the stream (with a 0x07 frame) and the
input socket (close 4001). — #1015 (`src/stream/create.test.ts`), #1017
(`src/daemon/input-lease.e2e.test.ts`)

## Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 1 blocking, 1
fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 28.5M.
Runs: 11. Cost USD: 6.0555. Agent seconds: 2652.
Assessment: complete

_Written by an agent._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A lease holder streams its lease's screen

1 participant