You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(cli): ovis add takes a line as an answer only when it was typed after its request was shown - #3581
Follow-up of #3539 (ovis add / login / link, scripts/plugin-link.ts). It closes what the reviews of #3539 left open, and what the reviews of this branch then found:
An approval carries the request's digits. The terminal no longer asks y/N. The question shows the device's six digits and asks for them: {label} wants to join your account. Approve it only if its screen shows 123 456. Type 456 to approve, or press Enter to decline: . All six digits (with or without the space) or the last three approve; anything else declines, a bare Enter and y among them (y gets "Declined: only a request's digits approve it, not y."). pair --approve asks the same way.
A line answers a request only when it was typed after that request's question, with its six digits, was on the screen. A line typed ahead, while nothing is asked, or twice is dropped with a line saying so.
The first line the terminal hands over after a request left the screen unanswered answers nothing (what was typed at that request and not sent would otherwise arrive under the next one).
Input that is not a terminal (yes | ovis add, a pipe that writes later, a file, a closed stdin, ssh without -t) approves nothing, whenever its lines come, and the message names the way out.
pending.listing (a listing a renewal took away) is put back while the PC is enrolling too.
The run's last approval window and last listing no longer depend on the next look being as fast as the last one.
The multi-run timing tests have their own timeouts.
How
Three guards on an approval, each with tests that fail without it:
Digits (approves(line, digits), exported with approvalPrompt and declinedNote, used by link and by pair --approve in scripts/plugin.ts): whitespace is removed, then the line must equal the six digits or their last three. Digits that are not exactly six ASCII digits are approved by nothing, and the question then asks for none.
One-shot drop (held): when a request whose prompt was shown leaves the list unanswered (it ran out, was answered elsewhere, the server restarted), lines already handed over are dropped ("no request is waiting"), and then the next line handed over is dropped too, whenever it comes and whatever it says: "That line answered nothing: a request went away while it may have been typed. Answer again for the request shown now." The prompt is printed again and the line typed under that counts. The cost: the answer to a request that follows one that went away is typed twice.
Dwell (DWELL_MS, 1.5 s): a line that comes sooner after a prompt first showed is dropped ("too soon to have compared its digits"). It covers a key pressed twice and a second line typed right after an answer.
Unchanged from the earlier commits:
One read for the whole wait (typing()): lines are taken as they come and stamped with the request whose prompt was on the screen (under) and the time (at). Nothing is ever kept for a later request.
terminal option (LinkOptions.terminal, scripts/plugin.ts passes process.stdin.isTTY === true): anything else is never read; the command says "This is not run in a terminal, … (over ssh, run ssh -t)." once and declines every request as it shows. Unset counts as not a terminal.
End of input and read errors: a terminal whose input ends (Ctrl+D) is said to have, when it does, and declines from then on; a read that fails ends the run then. Ctrl+C sends no answer.
The read starts after the PC is listed and the "Signed in…" lines are out.
Last window: every look in the last 30 s in which a window may be opened (LAST_MS) asks for it, and the first of them lists the PC anew.
Test harness: keyboard() queues lines as a terminal does, the test clock passes time during a wait, answer() in prompting types after the next wait (2 s). prompting takes request: (id) => ({ label?, digits? }); by default every request shows 111 222, so a line begun for one would approve the next unless the drop or the dwell stops it.
Review
Review of 80eaa66 (two reviewers, both BLOCK): see the comment "Review of 80eaa66: findings and resolution". In short: the HIGH (a line begun at a request that went away approved the next one when its Enter came 1.5 s or more after the next prompt) is fixed by the one-shot drop and by the digits answer; both LOWs are fixed.
Medium: input that is not a terminal can still approve. Fixed with the terminal option.
Medium: a second line typed after an answer can approve the next request unseen. Fixed by the dwell (and now the digits).
Low: the taint never expires. The taint of the first commit is gone. The one-shot drop that came back for the HIGH above lasts for one line by design: a held line can come at any time.
Low: end of input while nothing is asked silently declines everything; a read error is held until the next prompt. Both are said or thrown when they happen.
Low (a): the read starts before the PC is listed. It starts after the "Signed in…" block. Low (b): one look longer than 30 s steps over the last margin. Accepted and stated (the LAST_MS comment and docs/relay.md).
Validation
bun test scripts/plugin-link.test.ts: 66 pass.
Mutations, each run against the test file: the one-shot drop removed (6 tests fail), DWELL_MS = 0 (2 fail), the terminal option ignored (2 fail, the one the review named among them), y approving again (1 fails), the six-digit check removed (1 fails), the flush before the drop removed (1 fails). The reviewers' case ("y" held at p1, Enter 2 s after p2's prompt) fails on 80eaa66's plugin-link.ts.
bun run check fast through dori heavy on the pushed head a01e278, which has origin/main4fb64e6 merged in: every line ok (workflow syntax, generated types, generated themes, typecheck, build, unit tests: 15035 pass, 0 fail, 51 skip in 887 files).
Not run: a real terminal (no pty run of ovis add or pair --approve; process.stdin.isTTY and the pair --approve prompt in scripts/plugin.ts are covered by no test of their own, only through the shared helpers), a real phone or account service, bun run check full, browser regressions, and GitHub-only jobs (Windows, macOS).
Needs a real review: it changes what ovis add and pair --approve take as approval of a device (authentication).
… and opens its last window whatever a look takes
Follow-up of #3539 (scripts/plugin-link.ts).
- The terminal is read all through the wait, one read after another, and each
line is marked with the request whose prompt was on the screen when it came.
Only such a line answers that request. A line typed during the sign-in, while
nothing was asked, before the prompt showed, a second line at one prompt, or
one begun under a request that went away is dropped with a notice and never
kept for a later request. Before, a terminal kept a line typed while no read
was open and handed it to the next request's read, which approved or declined
it unseen.
- Input that ended (a pipe, Ctrl+D) still declines each request shown; a piped
"y" no longer approves one.
- A listing a renewal took away is put back also while the PC is enrolling.
- The last window: every look of the last 30 seconds in which a window may be
opened asks for it, and the first lists the PC anew, instead of guessing the
last look from how long the previous one took.
- Tests: keyboard() keeps a line typed while nothing reads, as a terminal does;
the multi-run tests get their own timeout.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
… one that comes as a request shows
A line answers a request only when it came at least 1.5 s after the request's prompt first
showed: a second line typed right after an answer, or one begun for a request that went away,
no longer approves the next request. This replaces the never-expiring taint, so an answer typed
at a later prompt is taken the first time.
Input that is not a terminal is never read and declines every request, with a line saying so;
plugin.ts passes process.stdin.isTTY. The end of a terminal's input is said when it happens, and
a failed read ends the run then. The terminal is read only once the PC is listed.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Improved approval prompts for add, login, and link requests: answers now apply only to the request currently shown, and outdated, repeated, or too-early input is rejected with a renewed prompt.
Requests are declined when approval input is unavailable, such as in non-interactive use or after terminal input ends.
Approval windows and device listings now renew more reliably during longer approval sessions.
The add approval flow now ties terminal answers to displayed requests, declines requests when terminal input is unavailable or ends, and propagates input-read failures. It also changes approval-window reopening and PC account-list renewal timing.
Terminal input is associated with the request active when the line arrives. A line can answer after the prompt has been displayed for at least 1,500 ms. Non-terminal or ended input declines requests, and read failures stop the flow. Tests cover stale, early, repeated, piped, ended, and failed input.
Approval windows and account listing scripts/plugin-link.ts, scripts/plugin-link.test.ts, changelog.d/cli-add-answers.md
The flow can reopen approval windows throughout the final 30 seconds and renew the PC’s account listing during that period. Tests cover variable call latency and rejected renewals.
The change ties terminal approval answers to the request shown and adds a 1.5 second dwell. No concrete merge-blocking risk was found. Real-terminal behavior was not tested by the author.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly identifies the main change: ovis add accepts an answer only when it was typed after the request appeared.
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description explains the problem and resulting behavior under “What” and “How.” “Validation” lists checks, results, and skipped work. It does not use the template’s exact “Change” heading, but it …
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 3 files. (2 skipped: 2 unsupported.)
Full details: Description check
Explanation
The description explains the problem and resulting behavior under “What” and “How.” “Validation” lists checks, results, and skipped work. It does not use the template’s exact “Change” heading, but it provides the required information.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 03481c8 and 80eaa66.
Files selected for processing: 5
changelog.d/cli-add-answers.md
docs/relay.md
scripts/plugin-link.test.ts
scripts/plugin-link.ts
scripts/plugin.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
…t a request that went away is dropped
Review of 80eaa66 (both reviewers, HIGH): a terminal in canonical mode hands a line over
when Enter is pressed, and the line is stamped then. A "y" typed at request A's prompt and
not sent, A going away, and a bare Enter 1.5 s or more after B's prompt approved B. main
dropped that line as stale; the dwell that replaced the stale drop covers only 1.5 s.
- One-shot drop: when a shown request leaves the screen unanswered (it ran out, was answered
elsewhere, the server restarted), the next line the terminal hands over answers nothing,
whenever it comes and whatever it says. It is said, and the question shown is asked again.
Lines handed over before the request went are dropped first, so they do not use it up.
- An approval carries the request's digits: all six (with or without the space) or the last
three. Anything else declines, a bare Enter and "y" among them; a "y" is told that the
digits approve. A request whose digits are not six digits is approved by nothing. The
prompt says what to type. `pair --approve` asks the same way (shared helpers).
- The dwell stays for a key pressed twice and a second line typed right after an answer.
- The not-a-terminal message names the way out (ssh -t), and its test now fails when the
option is ignored (the input must never be read).
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Review of 80eaa66: findings and resolution (head a01e278)
HIGH (both reviewers): an unfinished answer to a request that went away approved the next request when Enter came 1.5 s or more after its prompt. Real, and a regression from main. Fixed twice over:
One-shot drop, back. When a request whose prompt was shown leaves the list unanswered (ran out, answered elsewhere, server restarted), the next line the terminal hands over answers nothing, whenever it comes and whatever it says: "That line answered nothing: a request went away while it may have been typed. Answer again for the request shown now.", and the prompt is printed again. Lines handed over before the request went are dropped first, so they do not use the drop up. It is set also when a too-soon Enter had come at that request (stricter than "no line since its prompt": more can be typed after such an Enter). A request re-asked after a lost answer does not set it: its answer line was handed over, so the terminal holds nothing from before it.
An approval carries the request's digits.y no longer approves. The prompt reads … Approve it only if its screen shows 123 456. Type 456 to approve, or press Enter to decline: ; the six digits (with or without the space) or the last three approve, anything else declines. y/yes decline with "Declined: only a request's digits approve it, not y." Digits that are not six ASCII digits are approved by nothing. pair --approve uses the same prompt and rule.
The dwell stays (a key pressed twice, a second line right after an answer).
Tests (all fail on 80eaa66): the reviewers' case with the Enter 2 s after the next prompt, for a held y, 222, 111 222 and a bare Enter, with the next request in the same look and two looks later; the held line's Enter while nothing is asked; a too-soon Enter first; a line handed over as the request went; the accepted and declined answers; another request's digits and the same device asking twice (same label, other digits); malformed digits.
LOW: without a terminal (ssh pc ovis add) the message named no way out. Fixed: "… Run this in a terminal to approve one (over ssh, run ssh -t)."
LOW: the test at :882 passed with the terminal option ignored. Fixed: it now counts reads of the input (none may happen) and checks the message; with the option ignored it fails.
Also changed: docs/relay.md, docs/guide.md, docs/account.md and the fragment describe the digits answer and the drop.
Checks: bun run check fast on a01e278 (main 4fb64e6 merged in), every line ok. Mutation runs are listed in the PR body. Not run: a real pty, check full, GitHub-only jobs.
Known cost: the answer to a request that follows one that went away unanswered has to be typed twice.
Merged head 3e486cf94bab as 64344a52aa17 on GitHub's checks, with no unresolved review threads.
Reviewer
Verdict
Note
codex
CLEAR (reported BLOCK)
Codex's scenario needs the request's own last three digits typed before the PC printed them, i.e. read from the device's screen; the PC then checks them against its own digits, which is the comparison the prompt exists for, so nothing unverified is approved. The 1-in-1000 coincidence with an earlier request's digits is known and goes into the session's security follow-up (ask for all six then). The merge itself changed no code of this PR: both reviewers were CLEAR at a01e278.
One reviewer: merge-only head over a head both reviewers cleared (owner's rule 2026-11-10).
Two review rounds (Claude Opus 5.5 and Codex Terra), both CLEAR at a01e278; this head only merges main in (one docs conflict), re-checked by Codex Terra, whose finding was cleared with a reason (it needs the request's own digits typed, which the PC then checks). The answer is now the request's digits, not y; a line held when a request went away answers nothing.
For the session's security follow-up PR: ask for all six digits when two requests share their last three; arm the drop after a lost answer; a wrong non-empty line asks again instead of declining for good; NFKC; pair --approve's loop gets the same dwell and drop.
)
## Change
Follow-ups to #3173 (queued follow-ups recovered as held after a
disconnect), from the two reviews of its last head. Each is a way the
bridge alone could let a held message be typed twice or offered for the
wrong pane; in one browser whose storage works, the page's own re-read
before a press already stops the double sends.
**The claim comes before the dispatch.** A **Send now** of a saved copy
removed the held receipt, typed the text, and only then recorded `sent`
under the pane ID it started with. A turn is its pane ID's, so when
herdr moved the pane while the text was on its way, the outcome landed
under the old ID and a second tab's copy under the new one was typed
again (a resend there with another generation typed at the same time).
The handler now puts a `sending` claim among the receipts before
anything is typed. The move carries it, every resend of that ID under
any pane ID answers `pending_busy` while it stands, and the send's end
is recorded under the ID the pane has then: `sent`, the "not confirmed"
note, or the held receipt back in place when nothing was typed.
**The "not confirmed" note outlives its owner's record.** When a Send
now ended without an answer inside the first minute after the reload,
the closed owner's record aged out as `dismissed` 60 s after the close,
and that removal erased the note. Only the record's own disposition was
left, and past 1,024 later dispositions the other tab's copy was typed
again. A `dismissed` removal now ends only a held receipt.
**A pane that ended leaves no held receipt.** herdr may give its ID to
another pane, and the same browser attaching there was told the old
pane's copy was held, with **Send now**, for a terminal it was never
written for. The pane's held receipts now go when it ends, and a
follow-up the bridge still holds for it gets none when its connection
closes later (the same failure with the pane ending first). What was
sent, or may have been, stays and only refuses.
**The page's proof no longer stretches when the device's clock is set
back.** The bridge ends its receipt on a forward-only clock; the page
ended its proof on the wall clock. What is left of a proof now runs on a
clock that steps forward by the larger of what the wall clock and
`performance.now()` moved since it was last read, so a wall clock set
back takes nothing from the time that passed and a sleep
`performance.now()` did not count is still counted.
## Validation
All on commit `5f414757d`.
- `bun run check fast`: passed (unit: 15255 pass, 0 fail, 51 skip;
typecheck, build, generated types and themes, workflow syntax).
- CI runner image (`herdr-ci-runner:local`, a clone of this commit, each
through `bun run check run`), all passed: the contract tests
`server/pending-input.contract.test.ts` and
`server/submit.contract.test.ts` (228 pass, 0 fail), and the browser
regressions `pending-pane-switch-regression.ts`,
`composer-fit-demo-regression.ts`, `held-rows-demo-regression.ts`,
`restored-draft-demo-regression.ts`,
`composer-draft-demo-regression.ts`,
`chat-local-send-follow-demo-regression.ts`.
- New tests, each failing on main's code and passing here:
- `server/core/pending.test.ts`: a pane moved while a Send now is on its
way, for each end of the send (sent, not confirmed, nothing typed): the
other tab's resend under the new ID with another generation is answered
`pending_busy` during the flight (on main it typed at the same time),
and afterwards the outcome is known under the new ID. The harness's
turns are now per pane ID, as in the bridge.
- `server/core/pending.test.ts`: a Send now that ends without an answer
inside the owner's first minute, then the record's expiry and 1,100
other dispositions: the other tab's resend is still `pending_uncertain`
(on main it typed).
- `server/core/pending.test.ts`: a pane that ended with one held receipt
and one message still held on a live connection that closes afterwards:
a browser attaching under the reused ID is told neither as held; a
follow-up taken for the new pane is held and told as before.
- `src/lib/pendingMessages.test.ts`: a proof ends after the time that
passed with the device clock set back an hour, and after a sleep the
forward-only clock did not count. The file's clock tests now move both
clocks together.
- Not run: `bun run check full`; the full browser sequence of a pane
move during a send (the tests drive the bridge and the store directly).
The branch is based on main as of #3581 and merges with today's main
without conflicts.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Fable 5.2 <[email protected]>
Since #3581 anything but a request's digits declined it. A decline ends the
request for good (the device has to ask again), so a y typed out of habit, a
mistyped digit or the other half of the digits turned into a refusal the
person did not mean, and y, which approved before, was the likeliest of them.
Such a line now answers nothing: one line says that only the digits shown
approve and only Enter by itself declines, and the question is asked again.
Enter by itself still declines, and nothing new approves. The same holds for
pair --approve, which asks through the same loop.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
… cannot tell
The answer rules of ovis add and pair --approve as they are now: Enter by
itself declines, any other line that is not the digits is asked again,
full-width digits count, a shared last three asks for all six, the terminal's
input is discarded as a question first shows, and the line after a lost answer
answers nothing. The limit that remains with a terminal read a line at a time
is stated. The changelog fragment of #3581 no longer says that anything but
the digits declines.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
## What
After the terminal sign-in, `ovis add` (also `login`, `link`) now ends
in one QR code with a code to type. A device signed in to the same Ovis
account that scans it is paired, links itself, lists the PC and enrolls
it: no Add to press, no digits to compare, nothing to answer in the
terminal. `ovis add --approve` keeps the approve-here path as #3581
leaves it (the request is approved by typing its digits, not `y`);
`--code` is untouched.
This is the plan's decision D1, which the owner approved on 2026-11-10:
a code the PC shows may put the PC in the scanning signed-in device's
account with no Approve press on the PC. The code is a key to the PC, so
every guard the plan names is built:
- **Made only by an explicit act on the PC**: only by running the
command on a loopback server, after the sign-in. The variant that skips
the sign-in is not built.
- **Only on a real terminal**: where the output is not a TTY the command
stops before the sign-in with "The QR code is a key to this PC. Run this
in a terminal, or pass --print to write it anyway."
- **Cleared**: drawn on the terminal's alternate screen, which is left
when a device paired, when the run stops, on Ctrl+C and on any error. A
terminal without such a screen, or a recording of the session, keeps the
drawing of a code that no longer works.
- **Taken back**: `POST /api/devices/pair/cancel` when the run ends,
before anything is written to a terminal that may be gone: on success,
Ctrl+C, SIGTERM, SIGHUP, an output that takes no more writes, an error
and the 30 minutes. Only a killed process leaves its code to run out.
- **Short-lived**: three codes at most, about 30 minutes, then the
command stops. No code is made once a device got in, nor while that
cannot be told.
- **Says what it let in**: success only once the PC is in the account
that signed in and enrollment finished, naming the account and the
device of that account that added it.
- **Another account**: a PC that ended in another account than the one
that signed in was put there by a device the code let in. Every device
that came since the first code is removed without a question, that
account's members among them, and the command fails, naming both ids and
what went. The relay pass is never named under the other account.
- **A device nobody vouched for** (not a member of the account that
signed in) is named and asked about: `Keep that device? Type keep to
keep it, or press Enter to remove it:`. Only the word keep keeps it.
Anything else, no answer, an input that is not a terminal, and a run
that ends before an answer (Ctrl+C, SIGTERM, SIGHUP, an error, the 30
minutes) remove it.
## How
- `scripts/plugin-link.ts`: `addByQr` is the new default tail of
`linkToAccount`. Each round looks at `/api/account/status` and
`/api/devices`, and only after an answered look that found no new device
and no account is a code made or renewed (`POST /api/relay/code`, then
`POST /api/relay/offer`). Where the relay takes no typed code, a pairing
pending from elsewhere is ended first, so the QR code carries digits of
its own.
- Every device that is not in the list read before the first code got in
with the code, through the relay or with the six digits at the PC's own
address. Only a row that says it is a member of the account that signed
in (`account` on `GET /api/devices`) is vouched for. Any other is asked
about: a relay device after 15 s (a signed-in one links itself within
seconds), a direct one at once.
- Removals carry `x-ovis-unless-account` with the account that signed
in. `server/devices.ts` then answers `409 account_member` for a device
that became a member since the list was read, in one step with the
revoke, so the owner's own slow phone is not removed by a removal
already on its way.
- The device named as the adder is the member that linked itself
(`account` and no `added_by`): the one that came since the command
started, else the one paired before. None is named when that is not one
device.
- As a run ends, the code is taken back and the devices are removed
before the screen is left and before anything is said.
`scripts/plugin.ts` hears a failed write on stdout and stops the run as
a signal would.
- The keep question uses the same typing rules as #3581: read only on a
terminal, only a line typed 1.5 s or more after the question showed
answers it. The first line handed over after a shown question left the
screen unanswered answers nothing; lines already handed over when the
question goes are drained first and do not use that drop up.
- `--approve` runs #3581's loop unchanged, and its "another account"
message is main's.
- Docs: `docs/relay.md` ("A PC with no screen"), `docs/account.md` ("Who
may admit a device", "PC API"), `docs/guide.md`; changelog fragment
`changelog.d/cli-add-qr.md`.
## Review
- **First review** (seven findings, resolved in the second commit): the
adder must be a member; a device that typed the digits at the PC's own
address counts as let in; a code is renewed only after an answered look;
a silent server is waited for; the abort is checked after a look's
awaits; negative tests; the changelog's count of codes.
- **Merge pass review of e3a7646** (Opus: BLOCK, Codex: CLEAR): one
HIGH, three MEDIUM, five LOW, all resolved in 2a66067 and f1c283b.
Each finding, its resolution and what the real-signal runs showed are in
[this
comment](#3586 (comment)).
It replaces two statements of the first review: Ctrl+C at the question
now removes the device, and so does Ctrl+C during a look.
Not changed: someone who enters the sign-in code first makes their
account the one that signed in. That belongs to the sign-in step, which
`--approve` shares.
## Validation
- Ran: `TMPDIR=$HOME/.cache/ovis-tmp/cliqr bun run check fast` on
7a9ce2a, every step ok (15425 pass, 0 fail).
- Ran: `bun test ./scripts/plugin-link.test.ts ./scripts/plugin.test.ts
./server/devices.test.ts`, 203 pass (fake PC API, fake account service,
injected clock, temp state dirs, port 0).
- Failing first: 16 link tests fail on e3a7646's `plugin-link.ts`; the
write-order test, the stdout test and the server test each fail without
their fix.
- Ran by hand, not committed: the real `bun scripts/plugin.ts add` in a
pty against fakes, ended by closing the terminal (SIGHUP), SIGTERM and
Ctrl+C after a signed-out device paired. e3a7646 leaves the device
paired in all three; 7a9ce2a takes the code back and removes it.
- Not run: `bun run check full`, a real phone, relay or account service,
the browser regressions (no UI change), and the GitHub-only jobs (Native
Windows install, macOS). This PR touches `scripts/plugin*` and
`server/`, so it waits for GitHub's checks.
Needs a real review: it changes who admits a device (a code shown in the
PC's terminal admits its holder with no approval on the PC, decision
D1), and it adds a header to `DELETE /api/devices/{id}`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.2 <[email protected]>
…d without the owner meaning it (#3609)
## What
Eleven follow-up findings, in two groups: five across the onboarding
surfaces (items 1 to 5), and six about how a terminal reads a person's
answer to a request (items 6 to 11, following #3581).
### Items 1 to 5
Five follow-up findings from the reviews of pull requests that are now
in main. Each is a way a device could be approved, or a PC or device
added under an account, without the owner meaning it.
1. **Follows #3542 (`install.sh --add`).** Lines typed while the
installer worked, or pasted after the install command, were still in the
terminal's input when the add step began to read from it. A `y` and
Enter typed ahead could approve the next device that asked.
2. **Follows #3570 (the PC's approval prompt).** Shift+Tab from another
dialog's first stop landed on the prompt's last button, so two
Shift+Tabs and an Enter typed for the dialog pressed Approve. The guards
(keys for 1 s, clicks for 500 ms after the prompt arrives, moves or is
handed the focus) were measured against the time the handler ran, so on
a busy page a key or click made before the guard ran out, and heard
late, could approve.
3. **Follows #3555 (the hosted app's shell).** The confirm records the
sign-in it was drawn for, but only in the page's memory. When the hosted
app reloaded itself for a newer build between the confirm and the
enrollment, the reloaded page enrolled the PC as whoever was signed in
by then: another tab signing in as someone else in between added the PC
under that account.
4. **Follows #3584 (Add this PC).** A relisting that was given up for
getting no answer still had its request for the window on its way; when
it reached the PC after Stop waiting, nothing closed the window again.
And Stop waiting's close (`POST /api/relay/link/close`), arriving late,
could shut the window of a new wait begun meanwhile.
5. **Follows #3544 (Add this PC, resumed).** A resumed wait opened a
ten-minute approve-here window before it compared which PC had answered,
and believed "added" of whichever PC answered. A page that now answers
for a different PC got a window opened on it, and a PC already in the
account was said to be the one that was added.
### Items 6 to 11: the answer typed in a terminal (follows #3581)
`ovis add` / `login` / `link` and `pair --approve` ask in the PC's
terminal about a device that wants in, and an approval lets it into the
PC. #3581 (in main, 64344a5) made an approval need the request's
digits and dropped lines typed ahead. Its last two reviews left these
six:
6. **Three digits that two requests share.** The last three digits
approve, and two requests end in the same three once in a thousand
pairs: a line typed for one approved the other.
7. **A line typed while an answer was lost.** When the POST that carries
an answer got no reply, the request was asked about again, and a line
typed meanwhile answered it.
8. **A typo declined for good.** Any line that was not the digits
declined, so a `y` out of habit or a mistyped digit ended the request.
9. **Full-width digits.** Digits typed with an input method in its wide
mode (222) did not match.
10. **A line begun before a run's first prompt.** The terminal hands a
line over only at Enter, so what was typed and not sent before the first
question came as part of the line sent at it.
11. **`pair --approve` took buffered answers.** It read one line per
request with no dwell and no drop, so a second line sent behind an
answer answered the next request, and piped input approved.
## How
1. `install.sh`: `discard_typed` empties the terminal's input right
before the add step, after the terminal and foreground checks and under
the INT trap: with perl's `tcflush`, as the star question does, else
with `stty -icanon min 0 time 0` and `dd`. Where neither can, the add
step does not run and the closing lines name the command. **What the add
step does itself:** what is typed after the add step has started is that
step's own to tell from an answer: #3581 (in main, 64344a5) takes a
line as an answer only when it was typed after its request was shown,
and items 6 to 11 below go further in `scripts/plugin-link.ts` (the add
step now also empties the terminal's input itself as each question first
shows). The installer's discard stays: it runs before the sign-in, where
the add step reads nothing yet. **Only on a release with that reader:**
the installer is served from main but installs the latest release, and
up to v0.5.2 that release's `link` asks `[y/N]` and takes the next line.
So `add_pc` runs the add step only when the release that runs has
`export function answerOf` in `scripts/plugin-link.ts`; otherwise it
says to update and prints the command.
2. `useFocusTrap.ts`: `overlayEntry` makes a prompt's button reachable
by Tab only from inside that prompt; from outside, in either direction,
the prompt itself is entered first. `RelayPairingPrompt.tsx`: the key
guard starts again whenever the focus comes into a prompt from outside
it, and both guards count to the event's own `timeStamp` (and to the
keydown or pointerdown a click comes of, when earlier), capped at five
seconds.
3. `shellState.ts`, `shell.tsx`, `accountController.ts`: the sign-in's
id and the PC's id (no token) cross the shell-update reload in the tab's
session storage. The next load reads them and leaves them there until
the app opens, another confirm is acted on, or the PC is forgotten, so a
second reload on the way finds them too (the same now holds for main's
"a key of its own" marker). The reloaded page goes on under that sign-in
only when it is still the one stored; with another, or none, the PC
opens with the key this page holds and the enrollment does not run.
4. `addThisPc.ts`, `AccountSection.tsx`: every close from the page goes
through `closeAddWindow`, and a window is asked for only once every
close sent before was answered (a minute at most). The late close is
tied to the listing itself as well as to the attempt's end, once per
attempt. A listing whose wait was stopped ends at once
(`AddPcWaitOver("ended")`): before the window is asked for, and right
after it opened.
5. `addThisPc.ts` (`pcAnswers`), `AccountSection.tsx`: the wait reads
`web_ui.server_id` from `GET /api/health`, which opens nothing, before
every reopen, before a relisting asks for the window (`listThisPc` for a
wait) and before it believes the PC has joined. Where the health does
not tell the id, the hosted app's page names the PC; with neither, no
window is opened and nothing is said. The check of the link's own id
stays, for an address that changes between the two requests; the window
that reopen opened on the other PC is then closed again.
Items 6 to 11 are in `scripts/plugin-link.ts` (one implementation,
`asking`, used by `ovis add` and by `pair --approve` through
`approveWaiting`), `scripts/plugin.ts`, their tests, `docs/relay.md` and
`docs/guide.md`:
6. A request asks for all six digits, and says why, when its last three
are also those of a request asked about earlier in the run or waiting
now; only all six approve it then. A request already asked about with
three is asked about again with all six as soon as such a request waits
beside it (`beside`, at every look), and `ovis add` reads the waiting
requests once more before it sends an approval typed as three digits.
`pair --approve` does the same before a three-digit approval
(`ApproveOptions.list`).
7. `lost()` arms the one-shot drop when an answer's POST fails with no
reply: the next line handed over answers nothing, whichever request is
asked about by then.
8. `answerOf` returns no answer for a line that is neither the digits
nor empty. One line says what approves and what declines, and the
question is asked again. Enter by itself still declines. Three or six
digits that are not the request's get a line of their own: they are not
this request's digits, the request may be another device's, and Enter by
itself declines it.
9. The line is NFKC-normalised before it is matched.
10. `discardTyped` empties the terminal's input queue with the system's
`tcflush` (through `bun:ffi`: libc on Linux, libSystem on macOS) as a
request's question first shows. Where that cannot be done (Windows, no C
library found) the first line after each question answers nothing and
the question is asked again.
11. `pair --approve` asks through the same loop: the 1.5 s dwell, one
line per request, the drops above, and input that is not a terminal
answers nothing: the command says so and exits 1 without sending a
decline, so the requests keep waiting (`ovis add --approve` still
declines what shows in the window its own run opened). An answer the
server does not take is asked for again instead of ending the command.
### Trade-offs, where the guard wins
- **Item 10's limit.** The terminal is read a line at a time, so when a
line was begun is never seen. Keys pressed in the moment after a
question showed, before it was read, are part of the line sent at it;
such a line approves only if it is that request's own digits (after the
dwell) and declines only if it is empty.
- **Item 10 costs an answer typed too early.** Digits typed before a
question showed stay on the screen in front of it but were discarded, so
Enter pressed at it is an empty line and declines; the device has to ask
again. Not changed (a decline is the safe side, and making the first
Enter answer nothing would take two Enters for every decline);
`docs/relay.md` and the changelog fragment say so.
- **Item 6:** between two looks (two seconds at most) a request that
shares the three digits can come to wait unseen; the extra read before a
three-digit approval is sent closes that, at the price of one more local
request per such approval. A request that starts waiting after that read
and before the POST is not seen.
- **Item 10 on Windows** takes two lines for every answer, a decline
included.
- **Item 5 needs herdr to answer.** `GET /api/health` without a scope
answers only after herdr's ping. While Ovis is up and herdr is stopped,
a wait's window is not reopened or relisted, and **"This PC is in your
account" is withheld too**: the screen keeps saying "Waiting" until
herdr answers, or the wait expires. The press itself needs no health. A
follow-up outside this surface could name `web_ui.server_id` in the
`?scope=bridge` answer.
- **Item 2's age cap cuts both ways, and the refusal is silent.** In a
browser whose `event.timeStamp` runs behind `performance.now()` (clock
drift after the PC slept), every key or click counts as five seconds
old, so Approve does nothing for about 5.5 s (pointer) or 6 s (key)
after a prompt arrives, with no sign why. And a key made inside the
guard but heard more than five seconds later on a frozen page counts as
five seconds old and can approve.
- **Item 1:** a perl whose `tcflush` fails does not fall back to `stty`
and `dd`; the add step is skipped and the command printed.
## Review
### Items 1 to 5
An independent reviewer read the branch (verdict: fix, then ship). Its
findings and what became of each:
- **Medium, item 4: a close that main guaranteed was gone.** The branch
closed late only when the listing promise settled, and `listThisPc` did
not ask `wait.running()` after the window opened, so with the account
directory's read hanging the window reopened after Stop waiting was
never closed; a relisting still reading health at Stop went on to open a
window. **Fixed** (62ee8aa): `listThisPc` throws
`AddPcWaitOver("ended")` for a stopped wait right after `pcAnswers` and
right after the window opens, and the attempt-end close is back beside
the listing's own, once per attempt. Tests: `addThisPc.test.ts` "a
listing for a wait that was stopped opens no window, and reads nothing
once a window on its way has opened" and
`AccountSection.addThisPc.test.tsx` "Stop waiting while a listing asks
for the window closes the window it opens late, also when the account's
directory never answers"; both failed before the fix. The component test
passes with either of the two changes alone, so it does not hold the
attempt-end close by itself; the lib test holds the other.
- **Low, item 5: "added" is withheld while herdr is down.** Real; not
changed, the guard wins. Said above.
- **Low, item 2: the age cap.** Real; not changed. Said above.
- **Low: focus-trap browser regressions and where they ran.** See
Validation.
- **Info, not fixed here by agreement** (outside the five): a late close
from Add this PC can shut a window opened by Settings' pairing link
(`RelayPanel.tsx` calls `requestRelayLink` outside the new ordering),
and a close from another tab is not ordered; `starts` is per copy, so
one copy's late close can shut the window of a listing another copy
began (as on main); item 3 binds only signed-in confirms, so a pairing
made with no consent still acts as whoever is signed in after the
reload; Codex's second #3555 finding (enrollment can end the terminal's
session after the app opened) is untouched; a failed `stty` restore
would leave the terminal in non-canonical mode.
### Items 6 to 11
An independent reviewer read the six terminal commits at f78ccbe
(verdict: fix, then ship). Its findings and what became of each:
- **Medium, item 6: half closed in `ovis add`.** Whether a request needs
all six was decided once, when it was first asked about; a request with
the same last three that came to wait afterwards left the "Type 456"
prompt standing, and `456` read off the other device approved the
request on the screen. **Fixed** (710920b): `beside` compares the
waiting requests at every look and once more before a three-digit
approval is sent, and asks again for all six with a line saying why.
Tests in `scripts/plugin-link.test.ts`, "a request whose last three
digits another request shares": "asks again for all six once another
request with the same last three starts waiting beside it" and "looks
once more before it sends an approval typed as three digits"; both
failed before the fix. A third holds that all six, or a decline, already
typed still stand.
- **Low, item 10: digits typed ahead, then Enter, decline.** Real; not
changed, the guard wins. Now said in `docs/relay.md`, the fragment and
above.
- **Low, item 10: `discardTyped` had no test, and its macOS branch had
never run.** **Fixed** (7473352, df602ec): `scripts/plugin.test.ts`
"discards what was typed at a real terminal before the question showed"
runs `pair --approve` on a real pty (`script`), types the request's
digits before the question and Enter after the dwell, and expects a
decline. With the wrong queue selector in `discardTyped` it fails with
"Approved." on Linux and on macOS (both tried). It is skipped on Windows
and where `script` is not installed.
### After the reviews at df602ec
Both reviewers were clear at df602ec (Opus with four lows, Codex with
two mediums). `origin/main` with #3586 (`ovis add` ends in one QR code)
was merged in, keeping its QR path and this PR's answer rules for
`--approve`; the QR path's keep question now discards the terminal's
input as it first shows and reads the word NFKC-normalised. Then, each
with a test that fails without it: the wording for digits of another
value (Opus low 1), the second read in `pair --approve` (low 2), no
decline from a non-terminal `pair --approve` (low 4), the installer's
add step only on a release with the new reader (low 3 and CodeRabbit's
thread at install.sh:558, answered and resolved), and Codex's two
mediums, both reproduced: the consent kept over a second reload, and the
window opened on another PC closed. Details in the PR comment of the
same name.
## Validation
On this head (65ca063), which has `origin/main` at 35b00a8 merged
in, unless a line names an earlier head.
- `bun run check fast` through the queue: every line ok (workflow
syntax, generated types, generated themes, typecheck, build, unit tests:
15533 pass, 0 fail, 51 skip in 894 files).
- The tests added after the reviews at df602ec were watched failing
without their fixes (the shell and Add this PC ones by running them on
the unfixed code; the others assert behaviour or words the unfixed code
does not have). The macOS hand run of the pty test below was at
df602ec and not repeated.
- Items 6 to 11: each has tests with an injected clock and a fake
keyboard. The tests added for the review's findings were watched failing
before their fixes at this head; those of the six original commits were
written before their fixes by the session that made them and were not
watched failing again here. One real terminal was used, a pty made by
`script` for the test above: on this Linux PC inside `bun run check
fast`, and on macOS 27.0.1 (the test MacBook Air, a fresh clone of main
in `/tmp` with this PR's diff applied, deleted afterwards), where it
passed three times and failed with the wrong queue selector. GitHub's
macOS job does not run `scripts/plugin.test.ts`, so macOS has that one
hand run and nothing automated. Whether the CI runner image has `script`
was not checked: without it the pty test is skipped there.
- Items 6 to 11, not run: no real `ovis add` against a real server,
account service or second device; no person at a keyboard; Windows (the
path where the input cannot be discarded) only through the fake
keyboard; musl only by the library name in the code.
- Items 1 to 5: each new or changed test was watched failing without its
fix. The independent reviewer also overlaid the tests of the first five
commits on a throwaway copy of `origin/main` and saw them fail there.
- Browser scripts (items 1 to 5), run at the earlier head ff6bddf and
not again since: three merges of `main` came in after that run, and
65ca063 changes `AccountSection.tsx` (one branch of the reopen) and
`shell.tsx`. Each with `bun run check run` on the isolated test session,
**on this PC's host, not in the CI runner image**:
`scripts/relay-pairing-prompt-regression.ts` (item 2, with `--build`),
`scripts/ui-regression.ts` (items 4 and 5, with `--build`), and for the
shared focus trap `scripts/settings-pages-demo-regression.ts` and
`scripts/drawer-modal-regression.ts`. All passed. The other scripts that
go through `useFocusTrap` (Files, the file viewer, ConfirmDialog rounds
and the rest of the browser set) were not run by hand; they run in the
runner image in this PR's "Integration and browser" job.
- `scripts/relay-pairing-prompt-regression.ts` presses at the 1000 ms
and 500 ms boundaries with 250 ms of slack, so only the unit tests
(injected clocks) hold the exact boundaries.
Items 1 to 5, not run: no real terminal and no real install
(`install.sh` ran only in its tests, under a throwaway HOME, with
stand-ins for perl, stty and dd); no real account service, relay or
second device; no real browser clock drift for item 2's cap.
`install.sh` on macOS and Windows is left to GitHub's macOS and Windows
jobs.
Needs a real review: approval and consent paths (pairing prompt,
enrollment, add-this-PC, the installer's add step, the terminal's answer
loop of `ovis add` and `pair --approve`)
The merge pass agreed on these eleven (the five, then the six from
#3581's last reviews), and only these, as the one follow-up PR before
the release; everything else from those reviews waits.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.2 <[email protected]>
Release PR for 0.5.3 (docs/development.md#releasing). Built on `main`
b4c5b38, whose CI run 43050339698 is green (attempt 2; attempt 1
failed only on a timing failure in `server/copilot.contract.test.ts`).
## What it does
- `package.json` and `herdr-plugin.toml`: 0.5.2 → 0.5.3.
- `CHANGELOG.md`: `bun scripts/changelog-fold.ts 0.5.3 2026-11-12` moved
89 fragments under `## [0.5.3] - 2026-11-12` and deleted them; `by
@login` added for #3281, #3289, #3472, #3540, #3596, #3597, #3626, #3633
and #3678 (the other outside contributors were already credited in their
fragments).
- `release-summaries.json`: 0.5.3 in en, ko, ja and zh, five lines each
under new, improved and fixed.
- `shared/machines.ts`: `REMOTE_BUNDLE_VERSION` 45 → 46, as the release
guards asked (the remote bundle's inputs changed since `remote-v45`).
- Hand corrections from the owner-check list: the notes of #3581 and
#3609 say `ovis add --approve` where they describe the six-digit
question (plain `ovis add` ends in a QR code since #3586); #3582's entry
keeps its hand links to #3558-#3560 and gets #3582's own.
- `scripts/install-ovis-command.test.ts` read
`changelog.d/install-ovis-command.md`, which the fold deletes: it reads
`CHANGELOG.md` now.
The telemetry Worker needs no deploy: `telemetry/worker.ts` and
`shared/telemetry.ts` are unchanged since `telemetry/deployed.json`.
## Not in this release
- #3665 (GJC input box draft) is parked until after the release.
## After the merge (merge pass, on the owner's word)
1. Push the tag `remote-v46` on the merged commit and wait for **Remote
PC bundles** to publish it.
2. Merge nothing that touches `server/`, `shared/`, `bun.lock` or
`patches/` until the Release run is done.
3. `gh workflow run release.yml --ref main -f version=0.5.3`.
## Validation
- `bun scripts/release-guards.ts --base origin/main`: "Release 0.5.3:
remote bundle, telemetry Worker and release metadata are in order."
- `bun run check fast`: pass (unit 16142 pass, 0 fail, 54 skip).
- Skipped: `bun run check full`, browser regressions (this PR's CI and
the Release run cover them).
* fix(ipad): hardware-keyboard flash, landscape shell fit, field sizes and window controls on an iPad (supersedes #3338-#3341) (#3583)
Supersedes #3338, #3339, #3340 and #3341, four iPad fixes by @Noobear
that all change `src/lib/viewport.ts` and
`scripts/keyboard-viewport-regression.ts` and conflict pairwise. This
branch carries their commits unchanged (same author), in the order
#3341, #3340, #3339, #3338, resolves the conflicts, and fixes what
review found on each. The four PRs name no issue to close; this one
closes #3483, which #3339 and #3561 together fix.
Thank you, @Noobear: the four fixes, their regression cases and the
measurements from your own iPad are all here, and nothing more is needed
from you.
Closes #3483
## What changes for a user
- **Hardware keyboard on an iPad home-screen app (#3341):** a visual
viewport that shrinks for one frame on each key is no longer taken for
an on-screen keyboard, so the page does not flash.
- **iPad home-screen app in landscape (#3340):** the shell fits the area
under the status bar, so a tap into a field no longer slides the screen
up and back.
- **Fields (#3339):** text fields and selects follow the interface font
size like the labels beside them. On an iPhone or iPad a field that is
pressed or takes the focus is at least 16px while it has the focus, so
Safari does not zoom the page into it. Find in diff does the same on an
iPad (#3483).
- **Windowed iPad home-screen app, iPadOS 26 and later (#3338):** the
header's first button stays clear of the window's close, minimize and
full-screen controls.
## Commits
Author's commits, cherry-picked in order (the only conflict resolution:
one `PASS` line holding every suffix, and one `const ios` instead of
two):
| From | Commit |
|---|---|
| #3341 | fix(mobile): apply a shrinking visual viewport only once it
lasted a moment |
| #3340 | fix(mobile): fit an iPad home-screen app's landscape shell to
the visual viewport |
| #3339 | fix(settings): fields follow the interface font size; iOS arms
a pressed field to 16px |
| #3339 | fix(settings): arm a field from its label's press; disarm on a
cancelled press |
| #3339 | fix(settings): an armed field keeps an interface size over
16px instead of shrinking to it (maintainer, already on the PR) |
| #3339 | fix(settings): arm a field a handler focuses, not only a
pressed one (maintainer, already on the PR) |
| #3338 | fix(ipad): keep the header's first button clear of a windowed
app's controls (iPadOS 26) |
Then seven commits of this PR: the four fixes below (each
`Co-authored-by` the author, whose code they rework), the #3483
regression case, the changelog credit, and one for the review of this PR
itself (second table below).
## Findings and how each was resolved
Each MEDIUM was reproduced first as a failing case in
`scripts/keyboard-viewport-regression.ts` on the unfixed code, then
fixed; the case stays as the regression.
| # | Finding | Reproduced | Resolution |
|---|---|---|---|
| 1 | **#3341 MEDIUM** Every viewport event restarted the 40 ms wait, so
a keyboard opening under a stream of events was applied only 40 ms after
the last one. | Yes: twelve frames with an event each, `a keyboard
opening under a stream of viewport events counts while it opens` failed
(`data-keyboard` still off at 192 ms). | The first shrinking event
starts the wait; later ones leave it running. |
| 2 | **#3340 × #3341** timing contradiction: "shrinking" meant shorter
than `100lvh`, which is the steady state of an iPad home-screen app
under its status bar (and of a Safari tab with its toolbars), so every
sync waited there and #3340's own check read no height after the load. |
Yes: with both PRs in, `iPad landscape: the shell fits the visual
viewport` failed (`published: ''`, 820 instead of 796). | Shrinking is
measured against the state applied last, so a steady state and the first
sync of a page never wait. (The first version of this fix also said
Chrome shrinks all three viewports together; that was wrong, see finding
12.) |
| 3 | The one-frame check raced a real clock: an installed Playwright
clock keeps running, so a slow runner could let the 40 ms run out
between two steps. | Yes (probe: a 40 ms timer fired by itself after
`clock.install()`). | The scenario pauses the page clock; only `runFor`
moves it. |
| 4 | **#3340 MEDIUM** The iPad test read the layout (744px on its short
side); an enlarged page zoom (125% lays an 820-point side out at 656px)
or a narrow window turned the fit off. | Yes: `iPad landscape at 125%
page zoom: the shell fits the visual viewport` failed (656 instead of
637). | The screen's own short side is read. The cases now use the
layout a page zoom really produces (85%: 1388×965; 125%: 944×656) and
add a 600px window. |
| 5 | **#3339 LOW** An iOS press could leave the agent picker (a button
drawn as a select) at 16px for good; so could a field whose press ended
without the focus, and a disabled field pressed through its label. |
Yes: `a pressed picker button keeps the interface size` failed, and with
that one skipped `a picker button keeps the interface size after its
press` (16px instead of 14px). | Only a text field, a textarea or a
native select that can take the focus is armed. A press that ends in a
click without the focus is disarmed once the click's default is done; a
press that never ends in a click is cleared by the next press. |
| 6 | **#3338 MEDIUM** Every home-screen app narrower than its screen
got the 68px room, also iPadOS 16-18 Split View, Slide Over and Stage
Manager, which draw nothing in that corner. | Yes: `Split View on iPadOS
18: the window's controls are not there` failed. | A probe for iPadOS 26
and later: `CSS.supports("anchor-name: --a")` (CSS anchor positioning
arrived with Safari 26; a home-screen app's user agent on an iPad names
no system version). Where the controls are not drawn, nothing is marked,
measured or listened for. |
| 7 | **#3338 LOW** The one-point margin was smaller than what page zoom
rounds away (iPad mini at 300%: 377px × 3 = 1131 of 1133; at 115% in
portrait: 742.9 of 744). | Yes, with the whole-number widths of the
review: `full screen at 300% page zoom: the window's controls are not
there` failed. Whether WebKit reports whole numbers there was not
checked on a device. | The margin is the scale plus one point. |
| 8 | **#3338 LOW** No test of the default wide layout, where the room
goes on `.header-side`, nor of a window going full screen. | n/a
(coverage) | The cases build the app's zoned header with the sidebar's
top row: from 769px the room is on that row and the header adds none,
with the sidebar collapsed or under 769px it is on the header, never
both; a resize to full screen clears the mark and back sets it. |
| 9 | **#3338 LOW** No reference design named. | n/a | See "Reference
design". |
| 10 | Maintainer note on #3338: the mark only follows `resize`. | Not a
defect: every way in or out of a window changes its width. | Left as is,
said in a comment. An `orientationchange` listener would read the new
orientation against the old width for a moment. |
| 11 | Known limit from #3338, unchanged: a window as wide as the screen
but shorter is not detected. | n/a | Not in this PR. |
### Second round: the review of this PR (head `3cb28a6ed`)
Both reviewers and CodeRabbit found the shrink wait reaching further
than the bug it is for. Each row was reproduced first as a failing check
of `scripts/keyboard-viewport-regression.ts` on `3cb28a6ed`, with the
script reading each state in the event that set it.
| # | Finding | Reproduced | Resolution |
|---|---|---|---|
| 12 | **MEDIUM** The 40 ms wait had no platform gate and also held a
shrink while a keyboard was up: an iPhone's and Android's keyboard were
counted 40 ms late, a keyboard that grew kept a stale taller shell, and
so did a rotation. The comment and this body claimed Chrome shrinks all
three viewports together; `src/lib/viewport.test.ts` records 477 / 477 /
lvh 533. | Yes: the phone's keyboard (472px), a keyboard that grows
(400px), Chrome's measured numbers (477, 477, 533), a rotation with the
keyboard up, split view, the virtual keyboard and both home-screen phone
scenarios all failed `keyboard flag follows occlusion, not focus alone`
when read in their event. | The wait is for the reported case only: an
iPad (the platform an iPad reports and an iPad's screen, at least 744
points on its short side), no keyboard counted yet, and a visual
viewport shorter than the one applied last. Everything else is applied
in its event, in `main`'s order. |
| 13 | **LOW** The regression ran the clock 50 ms before every read and
its resizes-content case set lvh equal to the visual viewport, so no
case could see a delay. | Yes: with the read moved into the event, the
existing keyboard-up checks of every phone scenario failed on
`3cb28a6ed`. | The clock is paused and a state is read in its event;
only a case that must wait runs the clock. The one-frame and stream
cases moved to an iPad home-screen scenario; the phone gained a keyboard
that grows and `geometry(page, 477, 477, 533)`. |
| 14 | **MEDIUM** (Codex) A field that lost the focus while the shrink
waited was gone when the wait ended, so the keyboard was not counted and
covered the shell. | Yes: on the iPad scenario, blur during the wait:
`keyboard flag follows occlusion, not focus alone` failed after the
wait. | The focus a dip began with is kept until its wait ends. |
| 15 | **Minor** (CodeRabbit) An iPad window made smaller kept its old
shell height for 40 ms. | Yes: a smaller window (676 under 700) and a
rotation back to landscape both failed `height override follows keyboard
or measured standalone inset` in their event. | A dip leaves the window
as it was: the wait needs the same width and the same large viewport, so
a resized window and a rotation are applied in their event. |
| 16 | **LOW** A field disabled while it had the focus kept `data-armed`
(16px at rest) after the focus left. | Yes: `the blur of a field
disabled while focused disarms it` and `the next press disarms a field
that lost the focus without a blur` failed. | The blur disarms whatever
it leaves, and a press or a focus elsewhere clears anything left armed
without the focus. |
| 17 | **LOW** A pressed Settings select widened before the tap ended,
which can wrap its row's label and move the select from under the
finger. | Yes for the cause: `.select: a press leaves the size` failed
(16px at `pointerdown`), and an armed select is wider than at rest
(asserted). The tap missing on a device was not reproduced. | A native
select is armed only as it takes the focus; a text field, whose box does
not follow its text, is still armed by the press. |
### #3339's three review threads
All three are settled on this branch (they were raised on the PR's first
commit and answered by the author's second):
- *Changelog wording*: the fragment says the field "grows to at least
16px and keeps it while it has the focus".
- *Arm the field when its label is pressed*: done in the author's second
commit, with a regression case (`16px from a press on its label`).
- *Clear the armed state after an unsuccessful press*: a cancelled press
was handled in the author's second commit; finding 5 adds the press that
ends without the focus and the one that never ends in a click, each with
a case.
## #3483: Find in diff on an iPad
`scripts/diff-find-demo-regression.ts` gains the case #3561 left for
after #3339: on the demo, with the platform and touch points iPadOS
reports, at 1180 and at 820, the query a tap on Find focuses and the
query a tap focuses read 16px, 14px again once the focus leaves; a 20px
interface keeps 20px.
## Reference design
- **Window controls (#3338):** the answer of desktop apps that draw
their own title bar, the Claude and Codex desktop apps and Zed on macOS
among them: the top bar's first control starts to the right of the
window's controls, the bar keeps its height and nothing else moves. Ovis
already does this for Chrome's `window-controls-overlay` mode from
`titlebar-area-x`; iPadOS reports no such value, so the room is a
measured constant (68pt) converted through the page zoom.
- **Fields (#3339):** a field's text at the size of the labels around
it, as those apps draw their settings. The 16px while focused differs
from them on purpose: Safari zooms a web page into a field under 16px on
an iPhone, which an app with its own window does not face.
- **#3340 and #3341** change no design: they keep the shell where it
already was.
- These are named from how the apps are known to behave; none was opened
for this PR.
## Screenshots
Not uploaded here. Before/after shots were taken on the static demo and
handed to the maintainer: Settings → Appearance (selects and text
fields) and the New workspace dialog (Directory, the agent picker), as
an iPhone at 390px and an iPad at 1180px, at the default and a 20px
interface size, at rest and with a text field focused by a tap (32
shots, 16 side-by-side pairs). The computed sizes they show:
| | before: rest / focused | after: rest / focused |
|---|---|---|
| iPhone 390px, default (14px body) | 16px / 16px | 14px / 16px |
| iPhone 390px, 20px interface | 16px / 16px | 20px / 20px |
| iPad 1180px, default | 13px / 13px | 13px / 16px |
| iPad 1180px, 20px interface | 18.6px / 18.6px | 18.6px / 18.6px |
The agent picker (a button) follows the same resting sizes and is never
enlarged. A native select follows them too and is enlarged only once it
has the focus, not by the press. The shots were taken on the first head;
the second round changed none of the sizes in this table.
## Validation
All on head `1171f74d9` (the branch rebased onto `main` 68f1fa9fb, plus
the second round's commit) unless said otherwise.
- `bun run check fast`: passed (workflow syntax, generated types and
themes, typecheck, build; unit tests 14770 pass, 0 fail, 51 skip).
- In the CI runner image (`herdr-ci-runner:local`, as its own user, in a
checkout of its own at this head, through
`scripts/ci-browser-parallel.ts`), no retries:
- `scripts/ui-regression.ts`, `scripts/ui-contexts-regression.ts`,
`scripts/ui-contexts-layout-regression.ts`: 3/3 passed. They also run
the checks they import, among them `mobile-viewport`, `keybar-focus`,
`mobile-tabs`, `terminal-pinch`, `terminal-input-spacing`, `pane-find`,
`settings-tabs`, `header-lens-switch`, `split-view`, `tab-menu` and
`secret-input`.
- 54 scripts that name the header, the sidebar, fields, the composer or
the viewport: 54/54 passed, `keyboard-viewport-regression` and
`diff-find-demo-regression` among them.
<details><summary>The 54 scripts</summary>
`agent-helpers-fold-demo-regression`, `chat-greeting-demo-regression`,
`cliproxy-settings-regression`, `composer-draft-demo-regression`,
`composer-fit-demo-regression`, `composer-send-demo-regression`,
`context-menu-inputs-demo-regression`, `deep-link-demo-regression`,
`diff-find-demo-regression`, `drawer-modal-regression`,
`droplet-demo-regression`, `file-text-size-demo-regression`,
`file-viewer-mobile-regression`, `files-prompt-regression`,
`header-context-demo-regression`, `interface-font-demo-regression`,
`keyboard-viewport-regression`, `machine-dialog-regression`,
`mirror-fold-demo-regression`, `new-session-skills-browser-qa`,
`pane-input-focus-demo-regression`,
`phone-glass-header-demo-regression`, `phone-safe-area-demo-regression`,
`prompt-dock-demo-regression`, `push-health-demo-regression`,
`pwa-update-browser-qa`, `recent-folders-regression`,
`reconnect-header-demo-regression`, `repo-diff-browser-qa`,
`settings-pages-demo-regression`,
`settings-palette-search-demo-regression`,
`settings-rows-demo-regression`, `sidebar-activity-demo-regression`,
`sidebar-agent-tree-demo-regression`,
`sidebar-background-workspaces-demo-regression`,
`sidebar-branch-line-demo-regression`,
`sidebar-context-ring-demo-regression`,
`sidebar-declutter-demo-regression`, `sidebar-filter-demo-regression`,
`sidebar-heads-demo-regression`,
`sidebar-machine-layout-demo-regression`,
`sidebar-machine-removal-demo-regression`,
`sidebar-peek-demo-regression`,
`sidebar-selection-contrast-demo-regression`,
`sidebar-spacing-demo-regression`,
`sidebar-split-access-demo-regression`, `sidebar-split-demo-regression`,
`sidebar-tokens-demo-regression`, `tap-targets-demo-regression`,
`terminal-keyboard-demo-regression`, `terminal-served-font-regression`,
`terminal-viewport-regression`, `unconfirmed-input-demo-regression`,
`workspace-rows-regression`
</details>
- Each reproduction above: `scripts/keyboard-viewport-regression.ts` on
the host's Chromium, failing before its fix and passing after. For the
second round the script was also run once with its assertions collecting
instead of stopping, on `3cb28a6ed`'s code, to list every check that
fails there.
- The first head (`3cb28a6ed`) passed the same checks before the rebase
(fast checks, 3/3 and 50/50 in the image). Its GitHub run failed one
script this PR does not touch,
`background-agent-states-desktop-demo-regression` (a disabled row
button, `background-agent-detail-demo-run.ts:201`); its sibling failed
the same way on another PR's run (42808284998), and it passes here on
the rebased branch.
- Skipped: `bun run check full`, the integration suite, the Windows and
macOS jobs, and every script not listed above.
### iOS Simulator (the test Mac; iPhone 18 Pro and iPad Air 11-inch,
iOS/iPadOS 27.0, Safari 27.0)
Static demo only. Real touches; a probe logged sizes, `visualViewport`
and the marks. First round: `main` f88576037 against the branch at
`484e67f3e`. Second round, after the review: `main` 68f1fa9fb against
this head, with the probe timing each mark against its viewport event.
- **Safari's zoom (#3339), iPhone:** a control page proves this Safari
zooms: a 12px field goes to scale 1.33 when tapped and when a button's
handler focuses it; a 16px one stays at 1. On this branch, at the
default and at a 12px interface, the sidebar filter, a Settings select,
Find in diff (through its button and tapped) and Rename tab rest at the
interface size, read 16px while focused, return on blur, and the page
stays at scale 1 at the focus and 300 ms and 1200 ms after it. A field
focused by a handler is armed inside the focus event, and no zoom
followed. This was the open question on #3339.
- **Safari's zoom, iPad:** Safari on the iPad never zoomed into a field,
on `main` either: the 12px control stays at scale 1 in landscape and
portrait, and with the mobile site in landscape. So the zoom #3483
describes did not reproduce on an iPad. The sizes are as intended
(filter and select 13px → 16px → 13px, Find in diff 14px → 16px → 14px,
at 1180 and 820), but on this iPad they only change how a focused field
looks: it grows by 3px, and a select that keeps the focus after its menu
closes stays that size until the focus moves. See "A decision left to
the maintainer".
- **Window controls (#3338):** the home-screen app could be installed
and put in a window (641×583). On this branch it is marked, the room is
68px and the header's first button starts at x=68, clear of the
controls, which end about 61pt from the window's left edge. On `main`
the button sits at x=12, under them. In a Safari tab and in the
full-screen app nothing is marked. `CSS.supports("anchor-name: --a")` is
true on iPadOS 27.
- **Page zoom (#3338, #3340):** at 85%, 100%, 115% and 125% in a Safari
tab, `screen` stays 820×1180 while the layout and `visualViewport.scale`
follow the zoom (125% in landscape lays out 944px wide at scale 1.25),
which is what both fixes assume.
- **Landscape shell (#3340):** in the full-screen home-screen app the
visual viewport is 788 under a 820 `100lvh`, and this branch publishes
`--app-height: 788px`. iPadOS 27 already draws `100dvh` at 788 there, so
at rest nothing differs from `main` and the slide on focus did not show
on `main`. A difference did show with a hardware key pressed and the
keyboard reduced to its floating bar (viewport 719.5): this branch fits
the shell to 720px and the composer stays clear of the bar; on `main`
the shell stays 788 and the bar covers the composer's bottom row.
- **Shrink wait (#3341):** keys sent as HID events caused no one-frame
shrink on either build, so the flash was neither reproduced nor refuted.
- **The phone's keyboard (second round):** on the iPhone, this head sets
and clears `data-keyboard` and `--app-height` in the same task as the
viewport event, as `main` does: 0 to 7 ms on both builds over four opens
and four closes each, and no 40 ms gap in 16 more keyboard changes. A
rotation with the keyboard up is the same on both.
- **The iPad's keyboard (second round):** only the iPad waits, and only
on a shrink: the keyboard counts 41 to 43 ms after the viewport event
(Safari tab and the windowed home-screen app), where `main` counts it in
the event; it is cleared in the event on both. One case beyond a plain
open waits too: rotating back to landscape with the keyboard up, where
the window's resize first un-counts the keyboard and the viewport's
shrink 0.8 s later is then held 41 ms.
- **A pressed select (second round, iPhone):** at `pointerdown` and in
the next frame a Settings select keeps its size, has no `data-armed` and
the same box (115×44 at 14px, 106×44 at 12px); with the focus it is 16px
and 125×44; the picker opened on 8 of 8 taps. Text fields: no zoom, as
in the first round.
### Could not be checked
- A real iPad, and a Magic Keyboard: the two home-screen bugs as
reported (#3340's slide, #3341's flash) were not reproduced on `main`
here.
- iPadOS 16 to 18 and iPadOS 26: only the 27.0 runtime is installed, so
the probe's false side (Split View, Slide Over on iPadOS 18) ran in the
regression only, with the probe faked.
- A windowed app 769px or wider on a device (the `.header-side` rule):
the Simulator's window would not resize further. The regression covers
the rule.
- Page zoom inside the home-screen app, a pinch, and an iPhone
home-screen app.
- Whether WebKit reports whole-number widths under page zoom (finding
7).
- On a device: a field losing the focus during the iPad's wait (finding
14), a keyboard that changes height while up on the iPad (the emoji
views did not change the viewport), and the tap that finding 17 says
could miss (the press no longer changes the select, so it was not
provoked).
## A decision left to the maintainer
Arming on an iPad follows #3483 and #3561, and the new regression pins
16px there. The Simulator says Safari on an iPad does not zoom into a
small field at all, so on an iPad the arming is only a visible 3px
growth while a field has the focus. Limiting the arming to the iPhone
would be a small change (and #3483 would close as not reproducing); it
is not made here because iPadOS 16 to 26 could not be checked.
## Not in this PR
- A field with a size of its own (Rename tab uses `--fs-sm`) grows to
the generic field size when armed at a large interface size (noted on
#3339).
- The native iPad app (Capacitor, `app/ios`): not covered,
`display-mode: standalone` was not checked there.
- A window as wide as the screen but shorter (finding 11).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Noobear <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: sisyphus-dev-ai <[email protected]>
* fix(terminal): a key-bar tap no longer hides the soft keyboard that is up (#3597)
<!-- See CONTRIBUTING.md for checks, translations, contract tests and
the changelog (a file in changelog.d/, never CHANGELOG.md). -->
## Change
**Problem.** On Android (seen on a Galaxy S26 Ultra), with the soft
keyboard up in a terminal pane,
tapping any key-bar key (Esc, Ctrl, Tab, an arrow, More keys) hides the
keyboard. The tap's focus is
already kept (`keepFocus` cancels pointerdown and mousedown), so focus
is not what moves.
The cause is `holdKeyboardForTap()` from #3297. For every touch press of
a key it sets
`inputmode="none"` on the focused field until the click is handled. That
is right for the case #3297
fixed (#3274: Back put the keyboard away but left the field focused, and
the next key tap raised it
again). But with the keyboard **up**, switching a focused field to
`inputmode="none"` makes Blink send
the new input type to the IME, and the IME hides the keyboard that is
showing. The comment there said
it "also leaves a keyboard that is up where it is"; on this device it
does not.
**Behavior after this PR.** `holdKeyboardForTap()` returns early when
`keyboardUp()` is true (the
`data-keyboard` attribute `lib/viewport.ts` sets). With the keyboard up,
a key tap leaves `inputmode`
alone and the keyboard stays up. With the keyboard down (Back put it
away), the hold works exactly as
in #3297, so #3274 stays fixed.
This follows T3 Code's mobile terminal, whose key row over the keyboard
(arrows, esc, sticky
ctrl/alt, tab) leaves the keyboard up on every key and puts it away only
through its own explicit
dismiss button
(`apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx`).
- `src/components/KeyBar.tsx`: the early return and the corrected
comment.
- `scripts/keybar-focus-regression.ts`: a keyboard-up case. It sets
`data-keyboard`, taps Escape and
More keys, and asserts the field keeps focus and a `MutationObserver`
sees no `inputmode` change
during the taps. The keyboard-down case is unchanged.
- `changelog.d/keybar-tap-keeps-keyboard-up.md`.
Risk: the fix relies on `data-keyboard` being current at the moment of
the tap. If it lagged behind a
keyboard that was just put away, the tap would skip the hold and #3274's
re-raise could come back for
that one tap.
Note on coverage: `scripts/keybar-focus-regression.ts` is not listed in
`scripts/ci-browser.sh` and
has no line in docs/development.md. Its check still runs in CI through
`ui-contexts-checks.ts` (`checkKeyBarKeepsKeyboardDown`, run by
`ui-contexts-regression`), and the new
keyboard-up case is inside that exported check, so CI covers it. Only
the standalone script is
unlisted. `scripts/android-ime-regression.ts`, the one test that asks a
real IME whether the keyboard
is shown, needs `ANDROID_IME_SERIAL` (an emulator) and did not run here.
## Validation
- `bun run check fast` on this branch: typecheck, build and unit tests
ok (14795 pass; the one
failure, `server/copilot.test.ts` "keeps a logged binding when only the
log's timestamps change",
fails the same way on main and passed on later runs).
- After the doc-comment commit (084ad83b, comments only), `bun run check
fast` again: typecheck and build
ok; unit tests failed on the same copilot test (fails on main too), two
`pi-questionnaire-route`
timeouts and `scripts/plugin.test.ts` "stop > returns only once the
server's process group is gone".
Rerun by file, the questionnaire tests pass, and the plugin test passes
2 of 2 on this branch and on main.
- In the self-hosted runner image built from
`scripts/self-hosted-runner/Dockerfile`, as its own
user, through `bun run check run`:
- pass: `keybar-focus-regression`, `ui-contexts-regression`,
`key-bar-hold-repeat-regression`,
`key-bar-customization-demo-regression`,
`terminal-keyboard-demo-regression`,
`sticky-modifiers-regression`, `keyboard-viewport-regression`,
`terminal-input-regression`.
- skipped: `android-ime-regression` (needs an emulator; refuses physical
devices).
- On a device, by hand: Galaxy S26 Ultra, Chrome. On the 0.5.2 release
(which has #3297), a key-bar
tap with the keyboard up hid the keyboard; on this branch the keyboard
stays up through key,
modifier and arrow taps. #3274's case still holds: after Back puts the
keyboard away, a key-bar tap
leaves it down.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
* fix(agents): grok lookups by session, Agy locks read last, and 503 for a Letta scan cut short (#3598)
Follow-ups to the low-severity findings the merge pass left on #3572,
#3573 and #3575, as one PR, plus what the review of this branch found on
the way. Cut from `925872654`; it merges cleanly into `origin/main` at
`c94f52572`.
## The five findings
### 1. A grok pane herdr names no session for keeps what it holds
(#3572)
`server/agent-tasks.ts`. A grok pane reported with no `agent_session`
for one snapshot lost its background count, and the hold of a turn that
ended on a task, for about ten seconds. The missing id was read as
another session, so the pane was looked up as reported. A grok session
is found by its id, so that lookup could only fail, and a failed lookup
of "another session" lets the state go at once.
herdr naming no session is not another session. A grok pane reported
without one is now asked for by the session known for it:
- Nothing is looked up while that lookup is recent.
- Once it is old, the lookup is a real one of the known id. One that
fails is a first miss as any: the count stands, the poll asks again ten
seconds on by that id, and two in a row let the pane go.
- A pane nothing is known of is asked for as herdr reports it.
- The session known is used only when it is grok's own: another agent's
id is never what a grok pane is asked for by, nor the key its miss is
remembered under.
### 2. A failed lookup is remembered with the session it was of (#3572)
`server/agent-tasks.ts`. The memory of a failed lookup was kept per pane
and agent. For grok, a miss of one session id held off the snapshot
lookup of a newly named other session for the retry interval, and could
count as the first of its two misses.
The pane's misses are now kept by session, for the agent they were of
(grok only: an agy session is found by the pane's process, so its miss
still holds whichever id herdr names). Both gates read the same entry:
the retry spacing, and the "second miss in a row" that lets a pane go.
Each session's miss stays beside the others', so herdr naming a session,
then none or another, then the first again asks for each only every ten
seconds while none of them is found.
**Known limit, left as it is.** A lookup that finds a session drops
every miss of the pane. Where herdr names in turn a session that is
found and one that is not, every snapshot looks one up and the count is
told and let go in turn: ten lookups in ten seconds, where main makes
two (and leaves the count at 0). Nothing shows herdr naming two ids in
turn for one pane; the observed case (an id, then none) is covered by
item 1. The comment on `failed` states the limit and a test pins it.
Spacing it would mean keeping the other sessions' misses through a
lookup that finds one and reading them for a pane whose session is
known, which would also hold a snapshot's lookup of a session the pane
really went back to.
### 3. Agy: herdr is asked the second time before the locks are read
(#3573)
`server/agy-store.ts`, `resolveAgyStore` and `agyFreshSession`. The
order was identity, locks, second ask, identity. It is now identity,
second ask, locks, identity, so the lock read is the last evidence
gathered and still lies inside the start-identity bracket. A second
answer that names another process ends the lookup before any lock is
read.
**What the new order costs.** The second ask is made before it is known
what the locks show:
| Case | Asks before | Asks now |
|---|---|---|
| A lookup that answers | 2 | 2 |
| A lookup that finds no single conversation lock | 1 | 2 |
| A greeting refused because a lock is held | 1 | 2 |
| A pane herdr names no single Agy for | 1 | 1 |
| An Agy whose start identity cannot be read | 1 | 1 |
| A greeting refused by its start arguments | 1 | 1 |
`docs/agy-chat.md` describes the new order and these costs, and the
unreleased fragment of #3573 (`changelog.d/agy-pane-process-recheck.md`)
is reworded to it.
### 4. Letta: no output when the pane moved during the last resolution
(#3575)
`server/conversation.ts`, the Letta branch of `toolOutput`. After the
awaited scan the pane is resolved once more, and that resolution was
only compared by its own answer. One begun before a `/new` in the pane
still names the conversation the output was read from, so when another
read saw the pane on the new conversation meanwhile, the old
conversation's output was answered. The final check now also refuses
when the binding moved since the lookup resolved it (`|| rebound(paneId,
transcript)`).
### 5. Letta: a scan cut by its time limit answers "try again" (#3575)
`server/letta.ts`, `server/file-tasks.ts`. A transcript scan stopped by
its own 10 s limit answered as "no such call" (404 `output_not_found`),
though the call may lie past where it stopped.
- `lettaToolOutput` throws `LettaScanCut` when it runs out of time with
some of what the transcript held as the scan began still unread. It
answers null as before at the end of the file, when all of that was
read, and at its 256 MiB cap.
- The file thread answers a cut scan as `{ cut: true }` (an error
crosses a thread as its message alone), and `lettaToolOutputOffThread`
rejects with `FileBusyError` for it.
- The route gains no new answer: it is the 503 `file_busy` with
`Retry-After` it already gives when no file thread is free. Only which
cases get it changes.
- The `letta-output` file task takes an optional `budgetMs`, as the
documents task does, so a test can run a scan with no time on a real
file thread.
## Beyond the five findings
**OmO has the window item 4 closes for Letta.** The OmO branch of
`toolOutput` resolved the pane a last time and compared only that answer
(older code, #3359). The review of this branch reproduced it: the held
last resolution answered the old session's output after another read had
seen the pane on a new session. The same `|| rebound(paneId,
transcript)` is added there, with a test and a changelog fragment of its
own. Please treat it as an addition to the five; it is one commit
(`7fcbbe6a2`) and can be dropped on its own.
## Tests
- `server/agent-tasks.test.ts`: a session-less grok pane keeps its count
and is asked for by the session known; a pane known as another agent's,
or let go meanwhile, is asked for as reported; a miss holds no lookup of
another session off; each session's miss is kept beside the others'; the
known limit above.
- `server/agy-store.test.ts`: the ask counts of the table above; a
stand-in Agy that moves its lock while herdr answers the second time; on
Linux the order of the reads (ask, identity, ask, locks, identity), and
that the start identity read after the locks is what refuses a pid taken
between the second answer and the lock read; a greeting with an
unreadable start identity asks once. The order test is Linux only:
elsewhere the identity is read through `ps` or a Windows handle.
- `server/letta.test.ts`: the pane moved during the last resolution; a
scan with no time answers `{ cut: true }` on the file thread and
`FileBusyError` on the pane's route, for a call the transcript holds and
for one it does not; read to the end, the answers are the output and
"not found".
- `server/conversation.test.ts`: the OmO pane moved during the last
resolution ("old session" before the fix, no output now).
## Changelog
`changelog.d/grok-unnamed-session-keeps-count.md`,
`letta-tool-output-try-again.md` and `omo-tool-output-pane-moved.md` are
new; `agy-pane-process-recheck.md` (#3573, unreleased) is reworded to
the new order.
## Validation
Run at head `aa59268f9`, with `HERDR_TEST_MODE=unit` and a `TMPDIR` of
its own:
- `bun test server/agent-tasks.test.ts`: 23 pass
- `bun test server/agy-store.test.ts`: 24 pass
- `bun test server/conversation.test.ts`: 253 pass
- `bun test server/letta.test.ts`: 81 pass
- `bun test server/file-pool.test.ts`: 21 pass
- `bun test server/core/status.test.ts`: 82 pass
- `bun test server/conventions.test.ts`: 14 pass
- `bun test scripts/changelog-fold.test.ts`: 12 pass
- `bun run typecheck`: clean
`bun run check fast` at `aa59268f9`: green (unit 14797 pass, 0 fail;
typecheck, build, generated files).
Reviewed before opening by an independent agent reviewer in three rounds
(one medium and several low findings, all fixed or listed above; the
last round: ship).
Not run: `bun run check full` and the browser regressions (no `src/`
change). Nothing was run on macOS or Windows; the Agy path on macOS is
untested natively, as `docs/agy-chat.md` already says.
`server/agy-store.ts` is imported by `server/windows-native.test.ts`, so
this waits for GitHub's Native Windows job.
## Notes for the merge pass
- Item 5 changes which cases of `GET /api/pane/conversation/tool-output`
answer 503 instead of 404, so this PR touches an HTTP answer and waits
for a real review.
- The message of `8c44a2908` gives a wrong reason for the `known?.agent
=== agent` clause (a saved herdr call). `resolveGrokStore` refuses a
session that is not grok's before it asks herdr anything; the clause
only keeps another agent's id out of what a grok pane is asked for by
and remembered under. `aa59268f9`'s message corrects it; a squash
message should not carry the old line.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.2 <[email protected]>
* fix(connect): no socket row for a named session beside an older Ovis; a refusal notice reads the global relay's own refusal (#3599)
## Change
Follow-ups to the low findings the merge pass listed on #3576 and #3579,
one commit each. No HTTP/WS contract change and no new strings.
**1. Adding a PC over SSH: herdr's own socket is offered beside an older
Ovis only when no session is named (#3576)** — `server/machines.ts`
Adding a PC over SSH that runs an older Ovis, with no runtime of this
app there, offers herdr's own socket as a session row built from the
socket file. With a session typed in the dialog, that row was the named
session's socket. Chosen, the PC was saved with the socket (only the
default session's socket is saved as herdr to start), so after that PC
restarted its bridge said the session was no longer running instead of
starting it by its name.
The row is now built only when the dialog names no session (`!session &&
answered && !listedHere`). A named session connects as it did before the
card existed: the approval of what the setup installs, then a bridge
started for the session by its name.
`server/machine-core-choice.test.ts` ("older peer, no bundle") adds the
named session: it reaches the approval with no card, and the bridge is
started with the session and no chosen socket. The unreleased changelog
entry of #3576 (`changelog.d/ssh-add-pc-default-session-restart.md`) now
says the offer is for a dialog that names no session.
**2. Before the announced date, a refusal notice needs the global link's
own pass refusal (#3579)** — `src/lib/relayNotice.ts`
Before the date, the notice over the pane read a refusal from the
refused flag beside the global link in error. A regional relay's refusal
sets that flag too, and a global link that dropped for the network is in
error as well (`relay_unreachable`), so a regional refusal plus a
network error showed "add this PC", "PC limit" or "needs an account" for
as long as the global link was down.
Before the date a refusal is now the global link's own: the flag, the
link in error, and an error code that names the pass (`pass_*`). A
server from before the codes names none and is read as before. Past the
date, and with no date, nothing changes: the flag beside any error still
reads as a refusal there.
**3. A dismissed not-listed or PC-limit notice stays dismissed while the
PC asks the relay again (#3579)** — `src/lib/relayNotice.ts`
Before the date, a PC the relay closed for its pass looks again every 30
minutes and whenever a pass comes, and each attempt reads `connecting`.
The not-listed and PC-limit notices read "no notice needed" for that
window, which `useRelayNotice` takes as the state being over: it removed
the stored dismissal, and the notice the user had dismissed showed again
after the next refusal.
While the refused flag stands and the global link has neither let the PC
in nor refused it for its pass (it is connecting, or in error for
another reason such as `relay_unreachable` between attempts), the
reading is now "not known" (`undefined`) where nothing else shows: no
notice, and stored dismissals are kept, as before a first answer. No
refusal is read from it, so a regional relay's refusal during a global
reconnect still shows none. The link online, with the flag set or
cleared, still ends the dismissal, and the sign-in reminder that names
the date still shows meanwhile.
`src/components/RelayNotice.test.tsx` covers 2 and 3: the flag beside
`relay_unreachable`, `server_key_refused` and `start_failed` before the
date; every `pass_*` code; the flag beside a network error past the
date; and `useRelayNotice` driven through a refusal, its retry and the
next refusal for both notices, including a page load that lands in the
retry.
No changelog fragment for 2 and 3: they correct the before-the-date
reading that #3579 added, which is not released, and its fragment
(`changelog.d/relay-notice-open-visitor-refusal.md`) still reads true.
Nothing visible is designed anew (the notice, its wording and its
dismissal are as #3579 left them), so no reference app is named.
### Not in this PR
Two low findings from the review of this branch. Both are confirmed,
both are older than this branch and #3579, and both are outside the
three items above, so they are left for a follow-up.
- **A dismissed refusal notice can still come back in two other ways.**
(a) "Needs an account" (a PC with no account): after the link's
30-minute look-again reads `connecting`, the reading is the sign-in
reminder or nothing, the stored dismissal is removed, and the next
refusal shows the notice again. (b) Not-listed and PC-limit: when the
account service request made on a refusal fails, `pass.state` reads
`unavailable`, the reading is "no notice needed", and the dismissal is
removed. Both happen on v0.5.2 with no date. Reproduced with real
`RelayService` statuses against an enforcing relay, through
`useRelayNotice`. The fix belongs in the hook: keep a refusal's
dismissal while the status still carries the refused flag and the link
is not online. That changes what a dismissal means in released
behaviour, so it gets its own PR and changelog entry.
- **The relay status line in Settings (`statusText`,
`src/components/RelayPanel.tsx`) still reads the refused flag beside any
error as a refusal.** With a regional relay's refusal and the global
link down for the network before the date, it says "Add this PC to your
Ovis account…" while the notice over the pane now says nothing. Before
this PR both said it. `RelayPanel.tsx` is unchanged since v0.5.2. The
follow-up has to share the notice's date rule with `statusText`: the
code rule alone would make the two disagree past the date instead.
## Validation
At `c8c0d0656`, with `TMPDIR=$HOME/.cache/ovis-tmp/fu-b
HERDR_TEST_MODE=unit`:
- `bun test src/components/RelayNotice.test.tsx`: 26 pass
- `bun test src/components/RelayPanel.test.ts`: 1 pass
- `bun test server/machine-core-choice.test.ts`: 44 pass
- `bun test scripts/changelog-fold.test.ts`: 12 pass
- `bun test src/conventions.test.ts`: 10 pass
- `bun test server/conventions.test.ts`: 14 pass
- `bun run typecheck`: exit 0
`bun run check fast` at `c8c0d0656`: green (unit 14796 pass, 0 fail;
typecheck, build, generated files).
Browser, on the host (not in the CI runner image; this PR's CI runs it
there): `scripts/relay-direct-demo-regression.ts` passed (6 checks, the
grace and data-limit notices included).
Reviewed before opening by an independent agent reviewer: ship, with the
two low findings listed under "Not in this PR".
Not run: `bun run check full`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.2 <[email protected]>
* fix(chat): a visualization card draws for any mode, names its file on its button and copies as two lines (#3589)
## Change
Follow-ups from the review of #3450 (the Codex visualization reference
card), four small items:
- **Any mode draws the card.** A reference whose `mode` was not `"wide"`
stayed raw reference text, and `wide` was never used. `mode` is no
longer read, so every mode draws the same card, also one this app has
never seen. `wide` is gone from `VisualizationReference`.
- **Each button names its file.** Several cards carry the same words,
"Open preview". Each button is now described by its own card's file name
(`aria-describedby`).
- **A copied selection of a card is two lines.** Measured in Chrome on
`main`: the plain text of a selection took the button's words ("…\nOpen
preview"), and the chat's rich copy ran the name and the title together,
since `lib/markdownClipboard.ts` keeps no line for a span. The button is
now `user-select: none`, and a `<br hidden>` between the two keeps them
apart in the rich copy. The page draws nothing new.
- **Wording.** DESIGN.md and the component comment said a press always
lands in a dialog that holds the focus. With **Show beside the pane**
the viewer is a panel beside the pane, where the rest of the app stays
in reach. Both say so now.
No server change.
## Validation
- `bun run check fast` passed at 13141467f: 14797 pass, 0 fail.
- `bun scripts/chat-visualization-browser-qa.ts` passed three times on
fresh builds. New in it: the button's description is the file's name,
the button is not selectable, the chat's copy of a card is `name\ntitle`
as plain text and `name<br>title` as rich text, and a reference with
`mode: "split"` draws its card.
- `shared/visualization.test.ts`: every mode, a known one, an unknown
one and a non-string, gives the same reference and block. It fails on
`main`, where an unknown mode is no reference.
- `src/components/Visualization.test.tsx`: the button's
`aria-describedby` points at the name alone, and the hidden break sits
between the name and the title. It fails on `main`.
- Not run: the integration suite and the other browser regressions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Fable 5.2 <[email protected]>
* fix(runner): the build cache keeps each build under the run that built it (needs owner OK) (#3585)
## Why
Follow-up to #3567, from the merge pass's review of it (its third note).
On the self-hosted runner the jobs of one CI run share the client build:
the first job to build hands `dist/` to the launcher under a key, and
the launcher takes it into the cache when GitHub confirms that the slot
runs a job of a trusted run (a push to `main`, or a pull request the
writer login opened, at its head). It never checked that the **key** was
that run's. The key is a hash the job computes itself; it is only the
job's word for what it built.
So a trusted pull request's run (agents open PRs as the maintainer
account, and CI runs before review) could hand in a build under the key
of a new commit of `main` before main's own run builds it. Main's
Integration and Browser jobs would then restore and test that `dist/`.
Since #3567 a release can be validated by main's run, so that build
could stand behind a release too.
## What
**An entry belongs to the run that wrote it.**
- The launcher's promoter
(`scripts/self-hosted-runner/build-cache-promote.sh`) files an admitted
build as `entries/<run id>/<key>`, under the run GitHub confirmed for
the slot. The run's directory is made by the promoter, must be a real
directory of its own user, and is never followed through a link.
- A job (`scripts/build-cache.ts`) reads, waits and checks "stored" only
under `<cache>/<GITHUB_RUN_ID>/`. With no usable run id it builds
without the cache.
- The lock carries the run too (`.lock-<key>-<run id>`): another run of
the same commit reads other entries, so waiting for its build gains
nothing. A waiting job waits for one job's build, not for a chain of
them.
- Eviction walks the runs' directories, keeps the most recently used
entries of all runs within the limit, and removes a run's directory once
it is empty.
- What a launcher from before filed by the key alone (`entries/<key>`)
is removed in the new launcher's first pass: a job of a commit from
before would still read it there, whichever run had filed it.
- A cache of one's own (no outbox) is unchanged.
Sharing between runs was never the purpose: the jobs of one run are. A
rerun keeps its run id.
## The launcher is an installed copy
`build-cache.ts` comes with the commit a run checks out; the promoter is
the copy installed on each runner host, updated by hand. While the two
differ, both directions end in "no hit, every job builds", measured with
the real scripts of each side (4 jobs of one run, a 2 s build, 0.3 s per
GitHub answer):
| Jobs | Launcher | Seconds per job | Builds | |
|---|---|---|---|---|
| new | new | 3.3 / 3.3 / 3.3 / 3.2 | 1 | the cache hits |
| new | old | 3.3 / 6.5 / 6.5 / 6.5 | 4 | from this merge until the
installed copy is updated |
| old | new | 3.4 / 6.6 / 9.8 / 12.7 | 4 | reruns of runs from before,
runs in flight at the update |
No wait runs out, nothing fails, and nothing wrong is restored. Main's
runs are safe from the merge on, whichever launcher is installed: a job
of the new code never reads where the old launcher files.
**After the merge the owner updates the installed launcher** on every
host whose launcher runs with `--build-cache`: copy
`scripts/self-hosted-runner/` over `~/.local/share/ovis-ci-runner` by
rename (`rsync -a` does; the promoter is started from that directory
every second) and restart the unit, as the README says. Merge first,
then update: the other order makes the jobs of every run in flight build
one after another. Until then every job builds (about one build later
than with no cache) and the job log says `was not filed under this run
but by its key alone`; this PR's own CI run will show that line. I did
not touch the installed copy or the running runners.
## Proof
- **The attack is a test** (`scripts/build-cache.test.ts`, "never
restores, in main's run, a build that a pull request's run handed in
under the key of main's commit"): run 200, a trusted pull request's,
hands in a build under the key main's run 100 then looks for; main's job
does not restore it and builds its own. Against `main`'s two scripts
that test fails: main's job restores the pull request's build without
building (13 of the 48 tests fail there).
- An independent review agent tried to break it: 16 spellings of main's
run id in a claim from a pull request's slot (`0100`, `+100`, `0x64`,
`1e2`, `100/../100`, twenty digits, ...) against a stand-in GitHub that
reads run ids leniently filed nothing under main's run; FIFOs, links and
directories as claim, tar and marker wrote nothing outside `entries/`.
Its verdict was ready, with three notes, all in this head: the removal
of the old flat entries, the log line that blamed an old launcher (true
only with one now), and "every runner host" in the docs.
- 19 mutations, each caught: the reader looking by the key alone again;
the promoter filing by the key alone; a run directory trusted through a
link; eviction following a linked run directory or leaving empty ones;
any string accepted as a run; the lock without the run; "already there"
or "stored" tested by the key alone; the old flat entries left in place;
and others.
## Validation
- `bun run check fast`: pass on this head (14784 unit tests pass, 0
fail).
- `bun test scripts/build-cache.test.ts
scripts/self-hosted-runner.test.ts`: 48 and 53 pass. `bash -n` on both
shell scripts; shellcheck is not installed here.
- Both transition directions run end to end with `main`'s scripts
against these.
- **Not run:** real GitHub answers, Docker mounts, the installed
launcher and live runners (not to be touched). The first CI run after
the launcher is updated is that proof: its jobs log `hit <key>` after
the first one's `stored`.
- Skipped: integration and browser suites.
## Not in this PR
- The slot is tied to the run by the runner's name, as before. In 1,114
self-hosted jobs sampled, no two runs' jobs overlapped on one runner
name; each registration also has its own `runner_id` should a tighter
check be wanted.
- The other two notes of that review are #3580.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.2 <[email protected]>
* fix(pending): recover disconnected untyped queued follow-ups as held (#3173)
## Change
When an interactive socket disconnects or reloads while a queued
follow-up message is still waiting (`state: "queued"` and
`!item.inFlight`, or an in-flight attempt fails before typing),
`PendingInputs.hold` transitions the server's record to `"held"`
(`reason: "owner_disconnected"`). However:
1. On connection close (`end(client, "closed")`), `state.closing = true`
is already set before `pending.close(client)` runs, so the owner socket
never receives that `"held"` transition frame.
2. On the client (`PendingMessageStore`), `suspend()` and `restored()`
conservatively convert any `"queued"` or `"sending"` row to
`"uncertain"` (`serverOwned: false`) because the browser alone cannot
know whether the server began typing before the socket dropped.
As a result, when a mobile or desktop browser loses its WebSocket
connection while a follow-up is sitting in the queue (`Will send when
ready`), reconnecting leaves the saved copy stuck in `"uncertain"`
(`"Not confirmed. Check the terminal before sending again."`) with no
**Send now** button, even though the server knows nothing was ever
typed.
This change extends the existing resumable follow-up receipt mechanism
(`#2421`, bounded to 10 minutes / 1024 entries / matching `deviceId` +
`receipt_resume_id`) with `outcome: "held"`:
- When a follow-up with a `resumeKey` transitions to `"held"`,
`keepReceipts` records `{ outcome: "held", resumed: true }` in
`completed` (and pushes it to any already-attached successor with the
same `resumeKey`).
- If the held copy later leaves `"held"` (`"sending"`, `"uncertain"`) or
is settled (`"sent"`, `"discarded"`, `"dismissed"`), including via
`resend_id` after the 60s closed-owner retention window expires, the
`"held"` receipt is superseded or removed so a later reconnect cannot
overwrite a newer state.
- On the client (`PendingMessageStore`), receiving `{ id, outcome:
"held", resumed: true }` (either after snapshot lifetime proof or before
it via `earlyResumedReceipts`) transitions a non-authoritative saved
copy (`!serverOwned`, unproved, `!piReceipt`, `!resendInFlight`,
`!unconfirmed`) from `"uncertain"` to `"held"` and persists `state:
"held"` to storage, restoring **Held message — review and send** and
**`↑ Send now`**.
## Validation
- `bun scripts/typecheck.ts` — passed
- `bun run build` — passed
- `bun test src/lib/pendingMessages.test.ts` — passed (43/43, including
new unit test for recovering a disconnected queued message as `"held"`
without rearming an in-flight resend or unconfirmed copy)
- `bun test src/lib/machineSession.test.ts` — passed (30/30, including
early resumed `"held"` receipt settlement after snapshot lifetime proof)
- `bun test server/core/pending.test.ts` — passed (59/59, including
11-case parameterized suite covering `held on close`, `overlapping
reload`, `held after reattach`, `wrong browser`, `wrong device`,
`read-only`, `revoked`, `owner revoked`, `expired`, `resent after
closed-owner expiry`, and `ambiguous resend after closed-owner expiry`)
- `bun test server/pending-input.contract.test.ts` — passed (115/115,
including contract test verifying end-to-end WebSocket replay of a
`"held"` receipt on reconnect without typing again)
---
## Maintainer update (behaviour change, accepted by the maintainer)
This PR now follows a stricter rule for held messages than v0.5.1:
- A held copy offers **Send now** only on live proof: its own live
connection, or the bridge's held receipt for this browser within the
receipt's ten-minute window. It is never sent automatically.
- A **saved** held copy (after a reload, in another tab, after the
connection that held it ended, or one an older release saved) shows as
uncertain ("Not confirmed. Check the terminal before sending again.",
Copy and Discard only) until such a receipt proves it again.
- Consequence, deliberate: a held copy on a remote PC (its relay strips
the resume ID), after an Ovis server restart or update, past the ten
minutes, or one held for another reason (for example
`pending_turn_unconfirmed`) once its connection is gone, no longer
offers Send now. DESIGN.md says so.
- Wire: held receipt frames carry `held` (IDs), `held_ms` (time the
bridge still keeps each, 0 < ms <= 600000) and `held_until` (its end on
the PC's clock); the `features` frame carries `server_time`. All are
optional, and clients that predate them ignore them. The page holds a
copy until the sooner of arrival + `held_ms` and `held_until` on its own
clock.
- A resend checks and claims its receipt inside the pane's serialized
turn by the original ID, for its own pane and browser, so concurrent
resends type once.
## Validation (maintainer, head 3c361ab0)
- `bun run check fast`, plus `server/core/pending.test.ts`,
`server/pending-input.test.ts`, `src/lib/pendingMessages.test.ts`,
`src/lib/machineSession.test.ts` and
`server/pending-input.contract.test.ts`.
- In the CI runner image (`herdr-ci-runner:local`), on a freshly
installed and built clone:
- pass: pending-pane-switch-regression (proven lost connection and
reload; unproven other browser, expired receipt, ambiguous send, proven
on another page, page left open past the window),
chat-local-send-follow-demo-regression, chat-size-regression,
composer-fit-demo-regression, restored-draft-demo-regression,
terminal-autoswitch-demo-regression,
terminal-paste-insert-demo-regression, new-session-skills-browser-qa;
- ui-regression: passes its pending step, then stops locally at the New
workspace folder browser, which fails the same way on v0.5.1 in that
image;
- machines-browser-qa: not run, it needs an SSH fixture and is not part
of CI.
---
## Maintainer update 2 (owner's call, head b2799bf05)
A hold the person made on purpose is exempt from the rule above:
- **Exempt:** a message held at its sender's request (`delivery:
"hold"`: Alt+Enter, #3463, or a follow-up with automatic sending off).
It stays held, with Send now, through a lost connection, a reload,
another tab and a restart or update of the server, as on `main`, and
takes no receipt's ten-minute end. Only a Send now that may have typed
it makes it uncertain.
- **Still under the rule:** an untyped queued follow-up held as its
connection closed, and a copy the bridge held for a reason of its own.
Saved, these are uncertain until the bridge's held receipt proves them
again.
- **How the page tells them apart:** the bridge holds a requested hold
with no reason and names a reason for every hold of its own. The page
keeps that as a mark on the saved copy. There is no wire change.
Validation at b2799bf05: `bun run check fast` (14736 pass, 0 fail) and
`composer-fit-demo-regression`; at 274ceb81c, before `main` was merged
in again: `server/pending-input.contract.test.ts` (123 pass),
`pending-pane-switch-regression` and `restored-draft-demo-regression`.
Not run locally: `chat-size-regression`, `ui-regression` and the rest of
the browser lane.
## Maintainer update 3 (head 3922dcb45)
- A receipt's proof ends with the connection that brought it, and only
that one: on a page that shows several PCs, one PC's disconnect no
longer takes Send now from another PC's held copy.
- A tab still on an older bundle, which saves the list without the
request mark, no longer turns a requested hold uncertain in an updated
tab.
- A connection that may not resume when it closes (read-only, revoked)
still leaves the `sent` receipt of a send that ends after the close.
- The changelog has a `### Changed` entry for the deliberate change
described in the first maintainer update.
Validation at 3922dcb45: `bun run check fast` (14758 pass, 0 fail),
`server/pending-input.contract.test.ts` (123 pass),
`pending-pane-switch-regression` and `composer-fit-demo-regression`. Not
run locally: `chat-size-regression`, `restored-draft-demo-regression`,
`ui-regression` and the rest of the browser lane.
## Maintainer update 4 (head bcdfdfab9)
- A `sent` receipt is never dropped before its ten minutes, however many
other receipts follow: a copy another tab still holds on a held receipt
is not typed again.
- Corrections to the text above: the ten minutes run from when the
bridge held the copy as its connection closed; a remote PC on this
version does replay the held receipt for a controlling browser (the
relay scopes the resume ID, it does not strip it); a reload or another
tab of the same browser inside the window shows the copy held. What
loses Send now is the end of the ten minutes, a restart or update of
this server or the PC's, a remote PC on an older version, and a
watch-only attach.
Validation at bcdfdfab9: `bun run check fast` (14838 pass, 0 fail) and
`server/pending-input.contract.test.ts` (123 pass). The browser
regressions were not run locally this round.
---------
Co-authored-by: Jimbb <[email protected]>
Co-authored-by: devswha <[email protected]>
Co-authored-by: devswha <[email protected]>
Co-authored-by: Claude Fable 5.2 <[email protected]>
* fix(cli): ovis add takes a line as an answer only when it was typed after its request was shown (#3581)
## What
Follow-up of #3539 (`ovis add` / `login` / `link`,
`scripts/plugin-link.ts`). It closes what the reviews of #3539 left
open, and what the reviews of this branch then found:
- **An approval carries the request's digits.** The terminal no longer
asks y/N. The question shows the device's six digits and asks for them:
`{label} wants to join your account. Approve it only if its screen shows
123 456. Type 456 to approve, or press Enter to decline: `. All six
digits (with or without the space) or the last three approve; anything
else declines, a bare Enter and `y` among them (`y` gets "Declined: only
a request's digits approve it, not y."). `pair --approve` asks the same
way.
- A line answers a request only when it was typed after that request's
question, with its six digits, was on the screen. A line typed ahead,
while nothing is asked, or twice is dropped with a line saying so.
- The first line the terminal hands over after a request left the screen
unanswered answers nothing (what was typed at that request and not sent
would otherwise arrive under the next one).
- Input that is not a terminal (`yes | ovis add`, a pipe that writes
later, a file, a closed stdin, `ssh` without `-t`) approves nothing,
whenever its lines come, and the message names the way out.
- `pending.listing` (a listing a renewal took away) is put back while
the PC is enrolling too.
- The run's last approval window and last listing no longer depend on
the next look being as fast as the last one.
- The multi-run timing tests have their own timeouts.
## How
Three guards on an approval, each with tests that fail without it:
- **Digits** (`approves(line, digits)`, exported with `approvalPrompt`
and `declinedNote`, used by `link` and by `pair --approve` in
`scripts/plugin.ts`): whitespace is removed, then the line must equal
the six digits or their last three. Digits that are not exactly six
ASCII digits are approved by nothing, and the question then asks for
none.
- **One-shot drop** (`held`): when a request whose prompt was shown
leaves the list unanswered (it ran out, was answered elsewhere, the
server restarted), lines already handed over are dropped ("no request is
waiting"), and then the next line handed over is dropped too, whenever
it comes and whatever it says: "That line answered nothing: a request
went away while it may have been typed. Answer again for the request
shown now." The prompt is printed again and the line typed under that
counts. The cost: the answer to a request that follows one that went
away is typed twice.
- **Dwell** (`DWELL_MS`, 1.5 s): a line that comes sooner after a prompt
first showed is dropped ("too soon to have compared its digits"). It
covers a key pressed twice and a second line typed right after an
answer.
Unchanged from the earlier commits:
- **One read for the whole wait** (`typing()`): lines are taken as they
come and stamped with the request whose prompt was on the screen
(`under`) and the time (`at`). Nothing is ever kept for a later request.
- **`terminal` option** (`LinkOptions.terminal`, `scripts/plugin.ts`
passes `process.stdin.isTTY === true`): anything else is never read; the
command says "This is not run in a terminal, … (over ssh, run ssh -t)."
once and declines every request as it shows. Unset counts as not a
terminal.
- **End of input and read errors**: a terminal whose input ends (Ctrl+D)
is said to have, when it does, and declines from then on; a read that
fails ends the run then. Ctrl+C sends no answer.
- **The read starts after the PC is listed** and the "Signed in…" lines
are out.
- **Last window**: every look in the last 30 s in which a window may be
opened (`LAST_MS`) asks for it, and the first of them lists the PC anew.
- Test harness: `keyboard()` queues lines as a terminal does, the test
clock passes time during a wait, `answer()` in `prompting` typ…
What
Follow-up of #3539 (
ovis add/login/link,scripts/plugin-link.ts). It closes what the reviews of #3539 left open, and what the reviews of this branch then found:{label} wants to join your account. Approve it only if its screen shows 123 456. Type 456 to approve, or press Enter to decline:. All six digits (with or without the space) or the last three approve; anything else declines, a bare Enter andyamong them (ygets "Declined: only a request's digits approve it, not y.").pair --approveasks the same way.yes | ovis add, a pipe that writes later, a file, a closed stdin,sshwithout-t) approves nothing, whenever its lines come, and the message names the way out.pending.listing(a listing a renewal took away) is put back while the PC is enrolling too.How
Three guards on an approval, each with tests that fail without it:
approves(line, digits), exported withapprovalPromptanddeclinedNote, used bylinkand bypair --approveinscripts/plugin.ts): whitespace is removed, then the line must equal the six digits or their last three. Digits that are not exactly six ASCII digits are approved by nothing, and the question then asks for none.held): when a request whose prompt was shown leaves the list unanswered (it ran out, was answered elsewhere, the server restarted), lines already handed over are dropped ("no request is waiting"), and then the next line handed over is dropped too, whenever it comes and whatever it says: "That line answered nothing: a request went away while it may have been typed. Answer again for the request shown now." The prompt is printed again and the line typed under that counts. The cost: the answer to a request that follows one that went away is typed twice.DWELL_MS, 1.5 s): a line that comes sooner after a prompt first showed is dropped ("too soon to have compared its digits"). It covers a key pressed twice and a second line typed right after an answer.Unchanged from the earlier commits:
typing()): lines are taken as they come and stamped with the request whose prompt was on the screen (under) and the time (at). Nothing is ever kept for a later request.terminaloption (LinkOptions.terminal,scripts/plugin.tspassesprocess.stdin.isTTY === true): anything else is never read; the command says "This is not run in a terminal, … (over ssh, run ssh -t)." once and declines every request as it shows. Unset counts as not a terminal.LAST_MS) asks for it, and the first of them lists the PC anew.keyboard()queues lines as a terminal does, the test clock passes time during a wait,answer()inpromptingtypes after the next wait (2 s).promptingtakesrequest: (id) => ({ label?, digits? }); by default every request shows 111 222, so a line begun for one would approve the next unless the drop or the dwell stops it.Review
Review of 80eaa66 (two reviewers, both BLOCK): see the comment "Review of 80eaa66: findings and resolution". In short: the HIGH (a line begun at a request that went away approved the next one when its Enter came 1.5 s or more after the next prompt) is fixed by the one-shot drop and by the digits answer; both LOWs are fixed.
Review of 9c8aa71:
terminaloption.Low (b): one look longer than 30 s steps over the last margin. Accepted and stated (the
LAST_MScomment and docs/relay.md).Validation
bun test scripts/plugin-link.test.ts: 66 pass.DWELL_MS = 0(2 fail), theterminaloption ignored (2 fail, the one the review named among them),yapproving again (1 fails), the six-digit check removed (1 fails), the flush before the drop removed (1 fails). The reviewers' case ("y" held at p1, Enter 2 s after p2's prompt) fails on 80eaa66'splugin-link.ts.bun run check fastthroughdori heavyon the pushed head a01e278, which hasorigin/main4fb64e6 merged in: every line ok (workflow syntax, generated types, generated themes, typecheck, build, unit tests: 15035 pass, 0 fail, 51 skip in 887 files).ovis addorpair --approve;process.stdin.isTTYand thepair --approveprompt inscripts/plugin.tsare covered by no test of their own, only through the shared helpers), a real phone or account service,bun run check full, browser regressions, and GitHub-only jobs (Windows, macOS).Needs a real review: it changes what
ovis addandpair --approvetake as approval of a device (authentication).🤖 Generated with Claude Code