)
## Change
On the machine profile (a preview behind `OVIS_PREVIEW=fleet`, #3938), a
failed herdr call is now answered with the
profile's own code and sentence, in its HTTP answers and in its error,
submit and pending frames. Such an answer
carries `cache-control: no-store`. The two read routes of #3972,
`/api/session` and `GET /api/machines`, keep the
reason the profile's health gives.
What the profile answers for a failed call:
- the code: the one the bridge's own client made (`connect_failed`,
`timeout`, `closed`, ...), or one of the codes
out of herdr's reply that the app acts on, or else `herdr_error`. The
app acts on `pane_not_found` (nothing was
typed), `stale_content` (the find bar looks again), `agent_blocked` and
`agent_not_ready` (the draft stays),
`not_git_worktree` (that workspace is no checkout) and `invalid_request`
(the read falls back to recent rows);
- the message: "herdr did not answer this request";
- the status: the one every failed herdr call answers with.
A move's, swap's, zoom's or resize's answer keeps a reason the app acts
on (`same_pane`, `cross_tab`, `not_found`,
`no_neighbor`) or one the bridge gives itself (`zoomed_tab`,
`unchanged`); any other reason is `herdr_error`. An
error frame for a fault other than a herdr call keeps its code
(`snapshot_failed`, `command_failed`) and takes the
profile's sentence.
A pane herdr could not restore after it restarted keeps its
`restore_error`, which the app keys on, in one sentence
of the profile's own: in `/api/session`, `GET /api/machines`, the
snapshot frame and an attach's `pane_not_restored`
error. An empty or absent `restore_error` stays as it is.
A move herdr did not make that leaves a pane in a tab of its own, or
back in its tab, is answered `pane_not_moved`
with a sentence of the bridge's own saying where the pane is.
The no-store header covers the answers that carry the profile's words
inside a 200 or 409 body too: a create's
agent start and first message, a worktree create's or open's agent
start, the worktree inventory and a find refused
as stale.
`GET /api/plugin/action` returns a plugin run's state with what the
user's own plugin command printed when it
failed. On the profile it answers the local owner and a device that
drives the PC; a watching device is refused
(403 `read_only`).
How:
- The herdr client marks the error a call to herdr rejects with, at the
one place every such rejection passes
(`failedCall`, not enumerable, like `fromReply`). A refusal the bridge
words itself carries no mark.
- `machineFailure` in `server/machine-profile.ts` is the one function
that decides the profile's code and sentence.
The kept codes and layout reasons are two small sets beside it, each
entry with the app's use of it, and
`machineSnapshot` beside it words a pane's `restore_error`. Where the
bridge knows what came of a failed move, the
error carries that outcome (`outcome`, not enumerable), and
`machineFailure` says it instead of its sentence.
- The machine profile sets its view on the request
(`wordHerdrFailures`), so `errorResponse` words a marked error
by it. None of the existing `errorResponse` call sites changed. The
answers that carry a fault inside a 200 or
409 body (`requestFault`) and the layout answers read the same view, and
every worded answer takes its no-store
header from one place (`wordedHeaders`).
- The core is given the same view for its frames: `pendingFault` takes
it as a required argument, so a new call
that forgets it does not typecheck.
With `OVIS_PREVIEW` and `OVIS_PROFILE` unset, an ordinary server sets no
view and answers byte for byte as main
does.
## Validation
On this head (fourteen commits on `main` 00069b4; `main` has moved
since, and merges into this head cleanly):
- `bun test server/machine-profile.contract.test.ts
server/relay/service.contract.test.ts server/http.test.ts
server/herdr/client.test.ts server/agent-launch.test.ts
server/core/composer-framing.test.ts`, in one run:
245 pass, 1 skip (the Windows-only case), 0 fail.
- `bun run typecheck`: passed, at each commit.
- `bun run check fast`: passed (workflow syntax, generated types and
themes, typecheck, build; unit tests 17,848
pass, 0 fail, 54 skip).
- The walk (a launched profile, asked on its owner socket): every
`/api/...` route the shipped server code names,
by `GET`, `POST` and `PUT`, with one set of pane, tab and workspace ids,
against three stand-in herdrs: one that
refuses every call, one that answers its snapshot and panes and refuses
every other call (so a route's later
calls are the ones that fail), and none listening.
- Every answer to a failed call carries the profile's own code and
sentence; every `herdr_error` answer is
no-store.
- Against the refusing herdr, every route the profile does not refuse or
answer first reaches it, except a
short list of routes that need a request shape of their own, each named
with its reason. Any other route
fails the test by name, so a new route is walked; layout answers have
scripted cases of their own.
- An ordinary server on the same herdr answers as main does.
- New tests, from the outside: a move herdr did not make (no change, a
refused swap, a pane left outside its tab),
the layout reasons kept and replaced on swap, zoom and resize, a find
refused as stale, the WebSocket error
frames on the profile's socket and an ordinary server's port, a profile
and an ordinary server in one process
with interleaved requests, and the units for the mark, `errorResponse`,
`pendingFault` and the error frames.
- Side by side with `main` 00069b4, an ordinary server (both variables
unset), launched with its own home, with
herdr refusing every call, answering its snapshot and panes, scripting
moves and layout answers, or absent: every
walked route answers with identical statuses, headers and bodies, apart
from values made anew at each start.
- Read before it was opened by a reviewer that did not write it, three
times, with runs: the layout answers and
the frame cases in this change come from those reads.
- macOS arm64 (27.0.1), Bun 1.4.2, in a fresh clone of this pull
request's head (b1c0a1f): the six test files,
245 pass, 1 skip, 0 fail.
- Not run: Windows, a real relay device, the real entrypoint (the runs
are in-process servers).
Change
The app builds its PC list, and the terminal list in it, from
GET /api/machines, polled every 5 s. The machineprofile (a preview behind
OVIS_PREVIEW=fleet, #3938) refused every route under/api/machines. So a phone thatopened a machine through the relay kept its PC list loading under that refusal, and named the PC by its id
local.The profile now answers that one read, a
GETof the exact path/api/machines, with this machine alone, shaped asan ordinary server lists its own PC. A query string does not change which route it is; the one query value read is
verify_source_boot:idandkind:local;name: the machine's host name, as the pairing offer gives it;enabled:true;stateanderror:connected, orerrorwith the reason the profile's health gives while its herdr is down;snapshot: the snapshot/api/sessiongives, with hidden tokens left out the same way;source_boot_id: its boot id;server_id: its relay ID, once the relay has an identity;verified_source_boot: with exactly one?verify_source_boot=local, its own boot.Every other route under
/api/machines(other methods, the event stream, the routes of other PCs) is stillanswered 409
machine_profile: the profile manages no other PC. #3938's description lists/api/machinesamongthe refused routes: that is now all of it but its
GET. A herdr that started after the profile is looked for onthis request too, as on
/api/session.When a herdr read fails on
/api/sessionor on this list, the profile answers:herdr_errorwhen the code came out of herdr's reply;cache-control: no-store.A
HerdrErrorrecords whether its code came out of herdr's reply (fromReply, not enumerable).The app is not changed: the list follows its existing 5 s poll, and the profile still answers no live events. With
OVIS_PREVIEWandOVIS_PROFILEunset, an ordinary server answers exactly as main does.Validation
On this head (four commits on
main2f95460):bun test server/machine-profile.contract.test.ts server/relay/service.contract.test.ts scripts/plugin.test.ts, inone run: 254 pass, 1 skip (the Windows-only case), 0 fail. The plugin's tests are in the run because they start
a machine profile too.
bun run typecheck: passed, at each of the four commits.bun run check fast: passed (workflow syntax, generated types and themes, typecheck, build; unit tests 17,759pass, 0 fail, 54 skip; they include
server/herdr).files, 159 pass, 1 skip, 0 fail.
/api/machinesis answered 409;fetchMachinesget the machine and its workspace, and thelist leaves hidden tokens out;
connect_failed,herdr_errorfor a reply's own code, or theclient's
closed, each with no-store.main678d87f (one merge before this head's base; that merge does not touch these routes),an ordinary server (both variables unset), with herdr refusing the read with its own
error, closing before it answers, or absent:
/api/session,/api/machinesand/api/machines?verify_source_boot=localanswer with identical statuses, headers and bodies. AHerdrError'sJSON.stringify, keys, spread and printed fields are identical too.