Repository navigation
feat(remote): contract rev 19 host feed, run streams, control and paging (multi-host PR 2/9) - #313
Conversation
Record the 2026-10-02 decisions (symmetric peers, full chat parity including host-started runs, Tailscale one-click pairing, revision 19 grants, sidebar organizations, Bots, no tour tile) and replace the delivery sequence with a nine-PR breakdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extract the generation-notification-to-wire-event projection from the remote stream service so a host-wide run journal can produce identical events. Mobile stream behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Streaming content events are journaled at most every 250 ms instead of cloning and writing the whole device journal on every delta. Terminal, prompt, cancel, snapshot, first-event and state-change events still write immediately, and settlePersistence flushes any pending write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HostRunRegistry keeps a bounded, epoch-stamped, in-memory journal of every generation run on the host. It projects notifications through the shared run content projection, tracks pending approvals and questions, fails runs that settle without an outcome, and wakes subscribers so a behind cursor gets snapshot_required instead of a silent gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
llm-client now feeds HostRunRegistry from the same seams as the chat activity registry: run begin, every generation notification (before the owner check, so runs whose window closed keep journaling), delivered approval and question prompts, their resolution, and settle. Recorder faults are logged and never break a generation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Approval details carry unbounded caller-supplied text such as workspace names. A prompt can be a run's only retained event, which per-run and total trimming never drop, so oversized details could push the journal past both byte budgets. Details over 64 KiB are now omitted and the event is marked detailsOmitted; the prompt itself stays pending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fixed 64 KiB allowance could still exceed smaller configured budgets when several runs each retain only a prompt. The allowance is now the smallest of 64 KiB, half the per-run budget, and half an equal share of the total budget across the run cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Approval details were measured alone, so a long summary plus details could exceed the derived allowance. Details are now kept only while the complete prompt fits, and the options document that the parser-bounded prompt a run keeps as its sole event sets a floor under small budgets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… control Adds the host-wide feed, run stream and run control services, the chat messages window, desktop-only host grants and the opt-in host health descriptor. Wiring, docs, fixtures and tests follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add change hooks for the summary index, workspaces and renderer broadcasts, a credential-free repository identity cached from ordinary Git status reads, and construct the host feed and host-run services in the desktop Remote runtime. Revocation drains both without cancelling runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document the host feed, run streams, run control routes, the messages window and the opt-in host health descriptor in OpenAPI, add revision 19 samples to both byte-identical fixtures, and validate them fail-closed in the shared fixture parser, including credential-free repository keys and the run.ended sequence rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both native decoders learn run_gone and approval_resolved and the winning decision, outcome and resolvedAt details, and the API reference documents the host feed, run streams, run control and message paging routes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… descriptor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ow feature Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hermes Review BotConfidence: 5 Engine: SummaryProtocol revision 19 introduces the host-side contract primitives for the desktop multi-host experience, establishing the transcript-free host feed ( Confidence Score: 5/5Deep behavioral trace completed across all changed services, router endpoints, SSE streaming mechanics, mobile contract models, OpenAPI specifications, and integration test suites. 📁 Important Files Changed
Findings[P2] Chat access authorization bypassed before terminal state check in
|
There was a problem hiding this comment.
Caution
A revoked device can open a host subscription after revocation cleanup has completed and continue receiving data. Two additional feed-recovery defects are detailed inline.
Reviewed changes: Reviewed the revision 19 host contract across the server, desktop peer pairing, protocol artifacts, and both native clients.
- Host feed: Transcript-free sidebar snapshots, epoch-based replay, change notifications, Bot filtering, and cached repository identity.
- Run observation: Host-wide resumable streams, pending-prompt recovery, approval-detail filtering, and terminal
run.endedevents. - Run control: First-responder approval/question resolution, cancellation, mid-flight inputs, and idempotent outcome replay.
- Grants and compatibility: Desktop-only grant issuance/negotiation, revocation cleanup, opt-in host health, bounded transcript paging, and unchanged mobile grant vocabulary.
- Contract coverage: Updated documentation, OpenAPI, shared fixtures, Swift/Kotlin error decoders, and registered behavioral suites.
Validation: npm run test:aiden-remote, npm run type-check, npm run test:ci-policy, and the focused Android Remote/Bot contract tests passed. Three independent feed reproductions fail on the invariants described inline. iOS tests could not execute locally because this Linux runner has no xcodebuild.
gpt-6.1-sol | 𝕏
…pshots Re-check the device authorization immediately before a host-feed or run-stream subscription registers, so a revocation that completes while the feed's opening read is suspended refuses the subscription with credential_revoked instead of leaving a stream the cleanup missed. Split host snapshots larger than 256 KiB into partial frames without SSE ids, followed by a final frame carrying the id, so no frame approaches the 1 MiB peer limit and an interrupted snapshot is resent whole. Reschedule a pending invalidation after the first subscriber registers, so a change signalled during the opening read reaches it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: Reviewed 4ece706c against the prior Pullfrog review at a3b70980, with the full PR diff checked for context.
- Fenced subscription admission with a fresh synchronous device-authorization check after asynchronous feed refresh or run chat authorization.
- Rescheduled opening-read invalidations so a change signalled before the first subscriber registers reaches that subscriber without another signal.
- Chunked large host snapshots with
partial: trueon intermediate frames and an SSE cursor only on the final frame, preserving complete reassembly and interrupted-snapshot recovery. - Added behavioral coverage and contract documentation for revocation during admission, pending invalidation delivery, and 4,000-summary snapshots through the actual bounded peer reader.
Validation: npm run test:aiden-remote passed (617 passed, one skipped in the main aggregate, plus the peer-host and LAN suites), as did npm run type-check, npm run test:ci-policy, and the focused Android Remote/Bot contract tests. The first Android invocation reached the shell tool's 120-second timeout; one subsequent invocation completed successfully. iOS tests could not run locally because this Linux runner has no xcodebuild.
gpt-6.1-sol | 𝕏
very-hermes-bot
left a comment
There was a problem hiding this comment.
Inline review — 1 finding(s) anchored to the diff. See the pinned summary comment for the overview.
The router reads every run-control body as application/json and the
cancel route accepts only {}, so the OpenAPI requestBody for
POST /runs/{runId}/cancel is required, not optional.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: Reviewed 15911ad2 against the prior Pullfrog review at 4ece706c, with the full PR diff checked for context.
- Corrected the cancel request contract by marking the OpenAPI request body required and documenting
application/jsonwith{}, matching the router's existing enforcement without changing runtime behavior.
Validation: The focused protocol and router suites passed all 81 tests. Prior Pullfrog threads remain resolved; the separate cancel-schema finding is substantively addressed, with its thread left to its originating reviewer. Native clients are unchanged by this delta, so native suites were not rerun.
gpt-6.1-sol | 𝕏
…ost-contract Main now holds the squashed PR 1, whose tree this branch already contains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ost-contract Resolve against main's run-journal follow-ups: - host-runs.ts takes main's createHostRunRecorders shape; recordRunAttentionResolved keeps the optional HostRunPromptResolution so losing responders learn the winning decision. - The hostRunRegistry singleton is imported from host-runs-main.ts. - host-run-registry.ts keeps both the resolution bounds and deltaCoalesceMs. - git.ts keeps both import sets. - The Android contract fixture copy is gone; the revision 19 changes already live in protocol/aiden-remote/v1/fixtures/contract.json. Host-run tests now use allowlisted scheduled-task approval details, since the journal drops unrecognised kinds, and the retention-gap test turns delta folding off so each delta is its own event. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found in the merge integration.
Reviewed changes: Reviewed 1f1e819a since the previous run at e40c530d, focusing on merge resolutions and their integration with the previously reviewed revision 19 contract.
- Integrated upstream journal changes, preserving delta folding, bounded replay, winning prompt outcomes, and the shared runtime journal singleton.
- Updated host-run tests to use allowlisted approval details and disable folding where retention-gap recovery must be exercised.
- Preserved router and Git integration, retaining response negotiation and credential redaction alongside the host contract.
- Adopted the canonical Android fixture, with contract tests reading the shared resource instead of a duplicate copy.
Source review concentrated on merge resolutions and their callers because unchanged contract code was already reviewed; the complete Remote suite was rerun to check integration.
Validation: npm run type-check, npm run test:aiden-remote (627 passed, one skipped, plus 19 peer-host and seven LAN tests), the 29 focused journal tests, npm run test:ci-policy (55 tests), and all 24 focused Android Remote/Bot contract tests passed. iOS tests could not run on this Linux runner because xcodebuild is absent.
gpt-6.1-sol | 𝕏
…ost-contract Main's durable chat store (#324) replaced the operation tail with index locks. Keep the host feed's index observers and notify them once the in-memory index matches the committed file. A store test now covers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found in the merge integration.
Reviewed changes: Reviewed a837947e against the prior Pullfrog review at 1f1e819a, with the complete authoritative incremental and full PR diffs checked for context.
- Integrated durable chat-store locking, preserving main's per-chat and index locks alongside the host-feed observer API.
- Moved index-change notifications after durable installation and publication of the matching in-memory index and file stamp, while retaining best-effort listener isolation.
- Added observer behavior coverage, checking committed summary changes for creation, rename and deletion, plus unsubscribe behavior and callback-initiated summary reads.
Validation: npm run type-check, npm run test:aiden-remote (630 passed, one skipped, plus 19 peer-host and seven LAN tests), the 51-test chat-store suite, npm run test:ci-policy (55 tests), and all 24 focused Android Remote/Bot contract tests passed. The initial Android shell invocation hit the tool's 120-second deadline; one retry completed successfully. iOS tests could not run because this Linux runner has no xcodebuild.
gpt-6.1-sol | 𝕏
…tion tests Espresso.pressBack waits up to 10 s for the test window to hold focus, and CI emulators intermittently withhold it, so all three navigation tests failed with RootViewWithoutFocusException before reaching the host. Back now goes through the activity's OnBackPressedDispatcher, where the host's predictive handler and in-screen handlers are registered, so the tests still check handler priority and pop order without depending on focus. With the notification shade held open, the old tests fail 3/3 and the new ones pass 3/3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ost-contract Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/plans/README.md
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: Reviewed a837947e..5881e1e3 against the prior Pullfrog review, with the complete authoritative incremental and full PR diffs checked for context.
- Replaced Android navigation-test back injection with the activity's real back dispatcher, preserving assertions for handler priority, one-screen pops, and restored screen state without depending on window focus.
- Integrated the latest
mainchanges, retaining the PR 2 plan status and Remote test registrations alongside the merged sidebar suites; verified that renderer delta batching still leaves host journaling and remote delivery intact.
Validation: npm run type-check, npm run test:aiden-remote (630 passed, one skipped, plus 19 peer-host and seven LAN tests), npm run test:sidebar (59 tests), npm run test:ci-policy (55 tests), and the focused delta-coalescer/host-run suites (35 tests) passed. Android instrumentation sources compiled and all 24 focused Remote/Bot JVM tests passed. The first Gradle invocation reached the shell tool's 120-second deadline; one retry completed successfully. The three changed Android UI tests could not execute locally because no device or emulator is attached; their dispatcher behavior was checked against the host implementation and AndroidX source. Exact-head hosted CI was still running when inspected.
gpt-6.1-sol | 𝕏
PR #313 claims contract revision 19 for the host feed, run streams, run control and message paging, and it reaches main before this branch. The desktop pairing-request additions (pairing-requests-v1, the /pairing/requests* routes and their fixture section and match-code vectors) therefore move to revision 20, as the API doc planned. - Bump AIDEN_REMOTE_CONTRACT_REVISION, the shared fixture and its host health descriptor to 20, and gate the fixture's pairingRequests section on revision 20. - Mark the pairing-request routes and schema as revision 20 in OpenAPI and the API doc. The host descriptor, feed, run streams and run control stay attributed to revision 19. - A revision-19 host already carries pairingRequests in its descriptor but serves no /pairing/requests* route, so the docs now tell requesters to also require contractRevision 20 or newer. - Move the iOS and Android fixture revision assertions to 20 together. Neither client caps the revision it accepts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Summary
This PR moves the Aiden Remote contract to revision 19. With it, a paired desktop can follow one host's whole sidebar, observe and control any run on that host, and page through long transcripts. Phones behave exactly as they do today.
Host feed:
GET /host/eventshost:eventsgrant. Event ids look like<epoch>:<sequence>.snapshotcarrying{epoch, sequence, summaries, workspaces, bots}.chat.*,workspace.*andbot.*upsert and remove events, plusrun.state {chatId, runId, state, unread}, with a 15 s heartbeat.HostRunRegistry. It never scans transcripts.Run streams:
GET /runs/{runId}/eventsandGET /chats/{chatId}/runs/current/eventsruns:observegrant.Last-Event-IDor?after=. A gap produces a snapshot.run.startedandrun.ended. An unknown run gets404 run_gone.runs:control.Run control:
POST /runs/{runId}/cancel,/approvals/{id}/respond,/questions/{id}/respondand/inputsruns:controlplus anIdempotency-Key.409 approval_resolvedor409 question_already_resolvedcarrying the winning decision andresolvedAt.Paging:
GET /chats/{chatId}/messages?before=&limit=chat-messages-window-v1.hasOlderaccurately. An unknown anchor returns409 revision_conflict./health?detail=host: addsinstanceId,displayName,platform,contractRevisionandpairingRequests. None of these is secret. The plain/healthbody is unchanged.Repository identity: host-feed workspaces carry an optional
repository {canonicalKey, relativePath}. It is built from cached Git data, and credentials and local paths are stripped.Grants:
macandlinuxdevices: at pairing, when the device opts into the progress vocabulary, or later throughPOST /device/capabilities.Revocation: drains the revoked device's subscriptions and refuses its controls. It never cancels a run.
Revision 19 updated together in:
docs/aiden-remote-api-v1.md,openapi.json, the TS constant, both byte-identical fixtures, and the iOS and Android decoders and tests.The decisions taken where the plan left a choice open are recorded in
docs/plans/desktop-multi-host-pr2-host-contract.md(decisions 1 to 23). Points that matter for PR 3:run.endedrepeats the sequence of the terminal event it follows. Clients must not drop it as a duplicate./healthdescriptor is opt-in, because the strict iOS decoder rejects unknown keys.Stack note
This PR is stacked on #310, PR 1 of 9 (the run observer bus and persistence). Its base is #310's branch,
feat/multi-machine-control-plan, so the diff shows only PR 2. Please merge #310 first. When that branch is deleted on merge, GitHub retargets this PR tomain.Test plan
npm run type-checknpx eslinton every touched TypeScript filenpm run test:aiden-remote, including these new suites:aiden-remote-host-feed.test.tsaiden-remote-host-runs.test.tsrepository-identity.test.tsnpm run test:ci-policy, with the new suites registered inpackage.jsonandscripts/ci-test-registry.jsonAidenRemotePhase0TestsandAidenBotContractTestsFlaky test record
tests/e2e/chat-message-queue.spec.ts:372"Steer on a queued message adds it to the running response once" failed on its first attempt and passed on retry, so--fail-on-flaky-testsfailed Electron E2E (3/3) at head5881e1e3f: run 37233112895, job 111528326302. Symptom: after completions were released, the second queued row ("Stay queued for later") produced no provider request within the 10 s poll at line 406. The steered row was delivered. The Playwright artifact was empty. This PR does not change steering, the message queue or run completion; its run-path changes are to approval/question settlement and journal paging. The job was rerun once.🤖 Generated with Claude Code