Repository navigation
Routines and capability switches across linked computers - #3988
Merged
Merged
Conversation
…y switches The Routines page lists linked computers' routines with this computer's, each far row named after its computer, and every action (run, stop, on/off, edit, delete, restore, preview) goes to the routine's computer through new machine-only door routes, held in the outbox while it is away. The editor picks the computer of a new routine and offers that computer's agents and folders. Settings > Capabilities shows each linked computer's switches.
…computers # Conflicts: # apps/mobile/contract/generated/swift/Wire.swift # apps/mobile/contract/parity/ledger.json # packages/core/inbox-types.ts
…subpath A new core subpath needs a core release before the UI package publishes, so the UI package smoke test refused it.
…or not at all, away computers and held writes shown as they are A held Stop ends only the run it was pressed for. Run once now on a linked computer is sent at the press or not at all, and says so plainly when that computer is away. The merged read and the far Capabilities read lay the person's held writes on that computer's last-known rows and switches, from the outbox, so a reload keeps them; an away computer's routines claim no run going and no next run, and say since when it has been away.
useScheduledOn skipped its store hook once Routines were on here (value || useScheduled()), so turning them on changed the Inbox's hook order and broke the window. It now calls one hook every render: with Routines on here it only watches the store (no read the window did not make before), off it reads so a linked computer's routines can offer the page.
…es CI checks Merged main's routine re-reads (#3979: a run under way, a reconnect, the window shown again) into the store with this branch's linked-computer reads. Resolved by hand: packages/inbox/scheduled/store.ts, packages/core/inbox-types.ts, packages/server/inbox-machines.ts, packages/server/inbox.ts, tests/e2e/slice-rules.ts, tests/e2e/shard-times.json and apps/mobile/contract/parity/surface.json; the ledger and Wire.swift taken from main, then the mobile contract regenerated. - The routines-machines e2e gives each computer the fake claude on its launch PATH and the plugin in its agent home, as a sandboxed Inbox needs (as inbox-routine-row-run-ends.spec.ts): without them a Run there never started. The fake's turn holds, so the run stays Running. - The door table test fills a routine's id (sch_1), so the scheduled/:id routes are checked against their own entries. - The linked test expects the far switches read's own words (held, away, read_at). - rowRunEnds' stand-in answers the window's read with ?machines=1, as a server does. - A forward test: Run once now with that computer online goes there at the press, keyed, with the window's mark.
…cked at B's door Both Inboxes run in one test process and read one config.json (each is its own process on a real computer), so B's switch turned on read as A's too. A's switch is held off (options.scheduled), and that the turn went to B, not A's own settings, is checked in B's door command log. The merged read's computers carry read_at.
…ate; pin it lands once The run that Run now started on B is still going (the fake agent never ends), so B's row says running whether the routine is on or off. The turn off did land; the test waited for the row's state. It now waits for enabled false. The forward test pins that a held turn off is shown off and running while away, and is taken there once, with the window's mark, across a later reconnect.
…computers # Conflicts: # apps/mobile/contract/generated/swift/Wire.swift # apps/mobile/contract/parity/ledger.json
…computers # Conflicts: # apps/mobile/contract/parity/ledger.json # docs/agent-guides/server-and-storage.md # packages/server/inbox-machines.ts
…rst read of a linked computer's routines read again on the next list main's onLinkedMachines tells a change only, so the Routines store also hears each merged list (onLinkedMachinesListed) and reads again while nothing was read.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What a person sees
routines/capabilitiesmark) lists nothing and shows no error.Routes added
All the new door routes are
machineOnly, so phones and the relay never reach them. They validate the routine id (sch_[A-Za-z0-9_-]{1,80}).GET scheduled,GET scheduled/:idPOST scheduled,POST scheduled/preview,POST scheduled/:idPOST scheduled/:id/(on|off|run|stop|delete|restore)GET capabilities(new local routeGET /api/inbox/capabilities: the capability switches alone)POST capabilities→/api/inbox/settings, which takes only the switch keys. Any other field gets422, and the answer carries only the switch keys.GET /api/inbox/scheduled?machines=1, the merged read the window uses.A routine write that comes through the door is taken only for a press in a window on the linked computer:
startsAgentTherecarries the window's mark, and the routine routes check it asfarWindow. A bare call through the forward gets403 window_only, as it does locally. No existing check is weakened. Outbox kinds: a create and a run areappend, the preview isnow, and the rest areset.New visible words
· <computer>after a far routine's nameNot included, and why
machineOnly, so the app does not reach them. The app would need these routes on the phone allowlist and its own Routines and Capabilities screens. The phone-width web Inbox over the tailnet works (see the proof shots).capabilityaction and the changed agent text come in a follow-up PR stacked on this one, so this one stays reviewable.Tests
inbox-scheduled-machines.test.ts,inbox-outbox.test.ts,listFilter.test.ts, the mobile contract tests, and the DOM testsroutinesAcross,scheduledThread,scheduledEditor,scheduledActions,routineTabs,routineAutosave,scheduledRows,scheduledTable.inbox-scheduled-linked.test.ts(two real Inboxes: turning on, create, edit and run on B from A; a bare call refused; B asleep, then a held turn-off applied) and the e2e spec.e2e: inbox-routines-machines.spec.ts. Proof shots in the
inbox-window-proofartifact,routines-across-computers/: 01-settings-linked-capabilities, 02-editor-computer-choice, 03-routines-two-computers, 04-far-routine-running, 05-routines-phone.