Repository navigation
fix(relay): the press's fallback to the join stays on the sheet it was made on - #4540
Conversation
…s made on On a phone, Ask to join on a PC new in the account whose account sign-in the PC refused (auth_failed for a key it does not list, admission, not_listed, a PC without the way in) ended on the front page with no join sent. The fallback asked for the join by a link to the same sheet (joinPc's location.replace with the offer fragment). That fragment change fires popstate, and on a phone or touch screen the sheet holds a history entry (sheetHistory.ts), which takes any popstate off it for Back: AddPcSheet's close ran Cancel and the shell's onBack, toFront, which went to "/". The fallback now sends the join from the sheet the press was made on, with no navigation, so nothing a fragment change triggers can end it; a fallback with no such sheet up still goes through joinPc as before. A browser regression with a real PC, the hosted shell and the account service drives it from the PC's address, its row in My PCs and a launch, at 390 and 1440, for a device the PC does not list (the join reaches the PC's own window) and one it does (the press opens the PC through the account, with no join). Co-Authored-By: Claude Opus <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Merged through Follow-up to #4531, found by the device recheck (r14b): on a phone, the press's fallback never sent the join. The fallback changed the page's fragment, the phone sheet's history entry took that popstate for Back, the sheet closed and the page went to the front page before the join could be sent, so on an account whose devices the PC does not list yet nobody could open a new PC. Now, while the press's own sheet is up, the fallback sends the join from that sheet with no navigation. Every rule of #4531 holds (nothing opens without a press; one fallback per press; a removed device gets only the join). A new browser script reproduces it at phone width (three entries, eligible and not eligible keys, 390 and 1440) and runs in CI. Short independent review by an Opus reviewer agent (no Codex review: its usage limit lasts until 2026-11-28): no HIGH or MEDIUM; the in-sheet join cannot run for another PC or without a press. Not run on a device; the next preview's recheck covers it. |
…ed wait (#4547) ## What `scripts/conventions.test.ts` ("waits marked fixed") fails on main: #4540 added `scripts/relay-new-pc-press-regression.ts` with one marked fixed wait, and #4537 added the ratchet that allows none in a new file. The two merged side by side, so every PR that includes main now fails Fast checks. The quiet period before the press ("nothing reaches the PC until the sheet is pressed") is now a loop bounded by a deadline that fails on the first join or relay connection, instead of one 1.5 s wait followed by a single check. Same coverage, and a regression is reported sooner. ## Validation - `bun test --timeout 60000 scripts/conventions.test.ts`: 40 pass (it failed on main with `scripts/relay-new-pc-press-regression.ts: 1 marked fixed waits, baseline 0`). - Not run locally: `bun run check fast` and the browser script itself (CI's browser job runs it). Test-only change; no review requested. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.2 <[email protected]>
…wo unused modules (#4548) ## What Test cleanup, bundle B3 of the test-suite plan: tests that leaned on prose and docs, and two modules nothing uses. - **R1** `scripts/install-ovis-command.test.ts`: drop "does not promise that another ovis is never hidden". It only checked that CHANGELOG lacks a phrase and that the guide has a sentence; no code reads either. The guide's Uninstall command stays covered by running it (the test just above). - **R2** `src/lib/markdownHtml.test.ts`: the parser test read the real README, so a README edit (logo path, width, links) could break a parser test. It now parses a README-shaped HTML header written in the test (centered logo with a width, `<h1>`, badges, a language row with a `.md` file link, a website link). Every parser assertion stays. - **R3** `src/lib/textPreview.test.ts`: the "ordinary document of the load limit's size stays well under the Preview limit" check read the head of the real CHANGELOG, which changes every release. It now builds a changelog of the same size (release headings, wrapped list items with code and links). The first check (short list items past the limit) is unchanged. - **R5** remove `src/lib/koreanParticle.ts` (and its test) and `src/lib/account/deviceKey.ts`: nothing imports them (`registerSigningBytes` lives in `shared/account-records.ts`, which `src/lib/account/service.ts` uses). `src/lib/account/deviceKey.test.ts` stays: it tests the account service path, not that file. The stale `koreanParticle.test.ts` entry leaves `scripts/ci-test-timings.json`. No production behaviour or UI changes. ## Evidence: the rewritten tests still fail when the parser breaks Each mutation applied to the production file, the test file run, then the file restored byte for byte (`git status` clean afterwards). | Mutation | Result | |---|---| | M1 `shared/markdownHtml.ts:129` drops the image `width` | `reads a README's HTML header as centered markdown, never as tag text` fails (1 fail, 5 pass) | | M2 `shared/markdownHtml.ts:86` reads `.md` links as plain text | the README header test and `links only to safe addresses and files` fail (2 fail) | | M3 `src/lib/textPreview.ts` counts one element per character of text | `puts a file of the load limit's short list items past what a Preview draws` fails on the generated changelog (1 fail) | ## Validation - `bun test src/lib/markdownHtml.test.ts src/lib/textPreview.test.ts src/lib/account/deviceKey.test.ts scripts/install-ovis-command.test.ts scripts/ci-test-timings.test.ts`: 73 pass, 0 fail. - `bun run check fast` (P620, 256 s): workflow syntax, generated types/themes, typecheck, build ok; unit 24,884 pass, 160 skip, **1 fail**: `scripts/conventions.test.ts` "waits marked fixed" on `scripts/relay-new-pc-press-regression.ts:180`. That failure is on `origin/main` itself (1d71a71, #4537's new ratchet met #4540's marked wait) and is fixed by #4547; this PR does not touch that file. Once #4547 lands this branch takes main in. - Skipped: browser regressions (no UI or component change) and the integration lane (no server change).
… and answer its approvals as data (#4560) ## What A Codex that Ovis starts in a herdr-core pane now runs on **its own app server, with the real Codex TUI on it**, and Ovis answers its approvals **as data** instead of keys read off the screen. - **Launch** (`server/approvals/codex.ts`, `server/agent-launch.ts`, herdr-core adapter `program`): Ovis writes a launcher into a fresh `mkdtemp` folder (0700). The pane's shell runs it: `codex app-server --listen unix://<folder>/codex.sock`, then the real TUI `codex --remote unix://...`. No other account can reach the socket (0600, or on 0.171 a link Ovis checks into `/tmp/codex-daemon-<uid>/<sha256(path)>`, a 0700 folder), so no token is needed. The launcher stops the server and removes its folder when the TUI ends or the pane hangs up. The user's Codex settings and login are used as they are: nothing is written to them, only launch arguments. - **Approvals** (`server/approvals/hub.ts` `hold`): Ovis subscribes to each thread as it runs (`thread/resume`, no overrides; a request already waiting is replayed). A command, file change or permission approval becomes the card of the TUI's own dialog, with the command as the shell runs it (`/bin/bash -lc` taken off), the folder it runs in, a remote environment and any extra permissions. Yes sends `accept`, No sends what the TUI's No sends (`cancel`). Whoever answers first wins: `serverRequest/resolved` releases the card, and a later card answer is refused. Options other than Yes and No (don't ask again, a grant for the session or with strict auto review) go to the TUI's dialog as keys. MCP elicitation stays the TUI's (it draws it as a form of its own, with no dialog to bind a card to). - **Turn end** (`server/core/status.ts`): how a turn ended (answered or failed) comes from `turn/completed` instead of the rollout file. - **Fallbacks**: a Codex version not measured (only 0.169.x–0.171.x), arguments the launcher does not know, Windows, another machine of the core, herdr (not herdr-core), a server that does not come up within 8 s (the launcher then starts plain `codex`), or a connection that fails: Codex runs as before, with the screen reader. That is why the screen reader's approval part stays. ## Card change (do not merge before the maintainer has seen it) The card's body now comes from Codex's request instead of the screen: the reason, the folder, then the exact command. Before, a long command showed the pane's own line breaks and the `Environment:` / `Reason:` / `$` lines. Desktop 1280 and phone 390, light, Korean: | | before (screen) | after (data) | |---|---|---| | short, desktop |  |  | | long, desktop |  |  | | short, phone |  |  | | long, phone |  |  | Heredoc and quotes + Korean, after: `after-multi-*.png`, `after-quote-*.png` on the `qa-evidence/codex-app-server-tui` branch. ## Validation - Real Codex 0.171.0 through Ovis's own code (createServer, agentLaunch, `GET /api/pane/prompt`, `POST /api/pane/prompt/answer`) on an isolated herdr-core, model gpt-6.2-sol-fast. The executed command was taken from strace's `execve` of the app server: - allow 4/4 (short, longer than the pane, a heredoc over lines, quotes and Korean): card command == executed command, character for character; ran once; the TUI's dialog closed. - deny 3/3: nothing ran. - TUI answers first 3/3: ran once; Ovis's late answer to the same card was refused (409). - Results: `e2e-results.jsonl` on the evidence branch. - Recorded fixtures (`server/fixtures/codex-app-server-*.json`): card command == strace execve for the four commands, and each binds to its own TUI dialog and no other. - `bun run check fast` on the rebased head: typecheck, build and unit green except `scripts/conventions.test.ts`, which fails on origin/main itself (a marked fixed wait in `scripts/relay-new-pc-press-regression.ts` from #4540, checked on a clean origin/main checkout). The commit before the rebase passed `check fast` fully. - Reviews: a Codex adversarial review (gpt-6.2-sol-fast, xhigh) and a gate review (review-work). Their findings were fixed in the two `fix(codex)` commits: - the card shows the folder, environment, extra permissions and a move's destination; - a dialog that hides its command binds only to the one request of its kind; - only the one-turn grant is answered from a card; - backslash-newline is parsed as the shell does; - the launcher waits less than the start does; - no launcher is written in a folder another account may rename entries in. - Not run: Windows, macOS. Remaining follow-up (MEDIUM, not fixed here): if the terminal's No and a card's Yes cross, the browser gets `ok` before Ovis reads Codex's `resolved`; Codex ignores the late answer, so nothing runs.
What was wrong
This is a device recheck of main at 6b2d123 (#4531 merged as cf0b36f), on a fresh account where the phone's key is not on the PC's list. On the sheet of a PC new in the account, Ask to join (참여 요청) tried the account sign-in, and the PC answered
auth_failedas expected. Then the page went to the hosted root and showed My PCs, and the join request was never sent: no Allow card on the PC, andGET /api/relay/joinsstayed empty. So nobody could open such a PC from a phone.Reproduced in a real browser first
The new
scripts/relay-new-pc-press-regression.tsuses:dist-shell/, routed in forhttps://app.ovis.sh);createServer) behind a local Bun relay, with the page's relay sockets bridged to it;Each case has an account of its own, whose PC was added in one press, so it is inside
new_until. The device signs in through the provider flow, which registers its key, either as not eligible (the PC has no row for it) or as eligible. It reaches the PC's sheet one of three ways: from the PC's address, from its row in My PCs, or from the sign-in's launch. It runs at 390 (touch) and at 1440.Before the press, each case checks that the sheet waits and that nothing reached the PC: no join, and no relay connection once the sheet is up. After the press:
GET /api/relay/joins), and the page must show the number beside the PC's Allow, still on/s/<id>/.On main's shell, all three not-eligible cases at 390 fail; every other case passes, including the same three at 1440. After the press, the URL went
/s/<id>/→/s/<id>/#offer=…(the fallback's link) →/s/<id>/→https://app.ovis.sh/. The page ended on the empty front page, and no join reached the PC. An instrumented run logged apopstatewithstate=nullon that fragment change, before itshashchange.Cause (lines on main)
src/lib/relay/shell.tsx:700: when the pressed account sign-in is refused, the"pair"step offailed()asks for the join throughjoinPc(...). On the PC's own page, that doesreplace(link.pathname + link.hash)(shell.tsx:648), which is a fragment navigation,location.replace("/s/<id>/#offer=…").popstate(state null) beforehashchange.BACK_QUERY), the join sheet holds a history entry throughusePhoneSheetBack(src/components/AddPcSheet.tsx:99). The popstate listener insrc/lib/sheetHistory.ts(:528) takes any popstate off that entry for Back, and calls the sheet'sonBack(:469).close(AddPcSheet.tsx:95) then runsonCancelandonClose.onCloseis the shell'sonBack(src/components/RelayShell.tsx:389), which istoFront(shell.tsx:406-415):cancelAttempt(); navigate("/"), a full load of the hosted root with the front page chosen. Thehashchangehandler that would have sent the join (arrived()taking thekeepConfirmedPcmark) ran on a page that was already leaving.At 1440 without touch the sheet holds no history entry, so the same flow worked there. The unit tests of #4531 stood in for the browser with recorded navigations and a same-document fragment step, without the sheet's component or its history entry, so they never saw step 3.
The device pass also reported plain Chrome. If that was a desktop-width window, it is a second failure this script does not reproduce: at 1440 every case passes on main.
Fix
In
failed()'s"pair"step (src/lib/relay/shell.tsx:701), a pressed attempt whose sheet is the one up (entry.offerandsheetJoinboth name that PC) now sends its join from that sheet with no navigation:show(confirmOf(entry.offer)); pair(). ThekeepConfirmedPcmark is no longer used for it. Any other fallback (a load's refused account sign-in, where no sheet is up) still goes throughjoinPc, as before.The rules of #4531 still hold:
pair(); the removed-device test still sees exactly one account sign-in and one join over 30 minutes.Tests
Unit (
src/lib/relay/shellAccountOpen.test.tsx): the test page now has aphoneSheetmodel. As the phone's sheet does, a link the page takes while the join sheet is up runs the sheet's Cancel and Back. These cases now run under that model and expect the join with no navigation:not_listedtwice,admission,auth_failed, and a PC without the way in);auth_failedcase.All 6 fail against main's
shell.tsxand pass with the fix.Browser:
scripts/relay-new-pc-press-regression.ts, added toscripts/ci-browser.shafterrelay-second-device-join-regression.ts. All 12 cases pass with the fix; on main the three not-eligible cases at 390 fail.relay-second-device-join-regression.tsandrelay-shell-browser-qa.tspass.Validation
dori heavy newpc2 -- bun run check fast: green (typecheck, build, 24439 unit tests).herdr-ci-runner:local, throughdori heavy, from a git bundle of this branch,bun run build:shellthenbun run check run --build):relay-new-pc-press-regression.ts(12 of 12),relay-second-device-join-regression.tsandrelay-shell-browser-qa.tsall pass.Known limits
sheetHistory.tstakes any popstate off a sheet's entry for Back, including a fragment change the page makes itself. This PR keeps the shell from making one while the join sheet is up, rather than changing how sheets read history. Any other place that changes the fragment under an open phone sheet would close that sheet the same way.server/account/mailbox.ts,admitted). A second device asking the same PC within that time is refused (pair-unavailable) and asks again with Try again. That was so before, and the script gives each case a PC of its own.🤖 Generated with Claude Code