Repository navigation
Observe mode, held-input draft, and status push for every pane - #1
Merged
Merged
Conversation
…very pane
A connection starts as interact; role {mode:"observe"} demotes it server-side:
input/keys/resize answer read_only errors and attaching never resizes the
shared pty - the observer receives pane-geometry and adopts the pty's grid,
so a watching phone can never change the operator's screen size.
server/collector.ts replaces the dead per-pane status subscription (its
frame.data.pane parser never matched herdr's flat status frames): one
collector subscribes pane.agent_status_changed for EVERY pane in the
snapshot (reconciled on pane.created/closed + a 60s backstop) plus global
pane lifecycle events, and pane-status/pane-exited/session-changed now
broadcast to every connected client, attached or not.
The role pill (top-left) flips the connection between interactive and view only; the server's role-ack applies it: stdin gate, pane-geometry adoption, and a force refit + resize when returning to interact. The key bar hides while observing. Terminal input typed while disconnected is never queued (ws.ts drops it): printable characters wait in a draft banner the user reviews and sends or discards after reconnect - nothing fires unannounced. App merges pushed pane-status into the snapshot instantly (badge updates in ~300ms instead of the 5s poll), debounces a refetch for derived rollups, and the header bell wires Web Notifications for blocked/done transitions and pane ends on hidden tabs (secure contexts only).
README features, how-it-works, phone section, test inventory and the WS frame list; DESIGN.md documents the role pill, the observe/draft banners and the bell button variant.
…atch herdr answers a subscription batch referencing a vanished pane with pane_not_found and closes the connection. The old heal waited on the structure-event debounce and, when the follow-up snapshot failed, sat idle until the 60s backstop - so pane-status could stop flowing for a minute. Now the close triggers an immediate reconcile, a failed snapshot retries in 5s, and the contract test retries its status report (alternating states) until the frame proves the subscription is live.
From the visual review passes: the banners now stack in one top-right column (the draft review and observe banners previously shared an anchor collided) and the column passes pointer events through to the pty except on the review banner itself. Observe surfaces layer the accent tint over the opaque elevated base so live pty glyphs no longer bleed through; the role pill is --control-h on fine pointers so it stops covering two terminal rows; its label names the state instead of aria-pressed. The held-input text caps at 32ch, the review banner takes --radius-md for its buttons, the granted bell is disabled, the conn label collapses under 480px, the observe banner wraps on phones instead of running under the pill, and the reduced-motion convention covers the new controls. DESIGN.md re-synced.
Two independent visual passes converged on the same finding: a control that floats over the pty canvas occludes live terminal output (~11 columns on a phone). The role is a connection property, so the pill now lives in the header-meta cluster beside the connection indicator: App owns the state, PaneTerminal sends changes and reports the server's role-ack back, and the observe banner is the confirmed-state surface. Also from the reviews: every banner wraps at <=480px instead of just the observe note (a held-input echo was ellipsized into nothing), wrapping banners take --radius-md with vertical padding, disabled controls share one affordance (opacity 0.7, no hover, cursor default) and the granted bell uses it, the draft buttons gain transitions and :active, and the reduced-motion convention covers the new controls. DESIGN.md re-synced: banner column, header role pill, radii, breakpoints and the conn-text collapse.
The final visual round caught two blockers: (1) the role frame was only sent on reconnect when it was non-default, so flipping to interactive while disconnected left no role frame to send - no ack ever arrived and the terminal stayed read-only while the header pill claimed interactive. The role frame now goes out on every connect, before the attach replay, and the ack converges the UI. (2) The pill's 76px pushed the header past 320px with the context collapsed to noise at every phone width: at <=480 the brand word and the workspace half of the context are hidden (the 22px mark keeps identity, the drawer names the workspace), so 320px fits and the pane title gets real room. DESIGN.md re-synced.
…e observer's Gate review caught the hole in the role model: ensureAttachment ran with the attaching client's geometry before the role check, so an observe connection that opened a pane first (the normal phone flow) spawned the shared pty at the phone's viewport. The spawn now comes from the pane's layout rect (the grid the operator's layout holds; 80x24 fallback), and the observer receives exactly that as its pane-geometry. A new contract test pins it: observer-first attach at 40x20 must answer the pane's rect, and herdr's layout must stay untouched. Also from the review: drop the dead statusSubscriptionSpecs extraction and its tests, and disable the draft Send while observing (the server would answer read_only).
devswha
added a commit
to nahwan-kim/herdr-web-ui
that referenced
this pull request
Sep 29, 2026
Review fixes (CodeRabbit, and an adversarial review with Codex): - gh auth status asks only github.com, so enabling usage no longer contacts Enterprise hosts with their credentials or waits on them. - A GH_TOKEN/GITHUB_TOKEN sign-in is read with the plain token lookup; the per-user lookup has no stored token for it. - Copilot tokens of no known login are separate sign-ins, so one that answers first no longer hides the others. - A place that now holds another account's failing sign-in no longer shows the previous account's name, plan and numbers. - A 429 waits per account (or per private token fingerprint), so a sign-in moved or copied elsewhere does not ask again early. - Sign-ins of one provider that name no account are numbered (devswha#1, devswha#2), and a fallback key hashes where the sign-in was found instead of sending its path to the browser. Co-Authored-By: Claude Opus 5.5 <[email protected]>
devswha
added a commit
that referenced
this pull request
Oct 29, 2026
…tate directory writes (#2408) Found by the reviewer bench (claim #1 in its report). It was there before #2392, at 73d1826; #2392's usage counts added another writer that can trigger it. To fix before 0.4.21. ## Bug Every telemetry write in `server/telemetry.ts` reads all of `telemetry.json` (`refresh()`) and later writes all of it back (`persist()`). Two Ovis servers can share one state directory, for example an installed app and a source checkout. If one of them reads the switch as on just before the user turns it off in the other, its next visit or count writes `enabled: true` back. The opt-out is undone and the next daily message goes out. ## Change - **"Off" in its own file:** a switch turned off now also lives in `telemetry-off`, beside `telemetry.json`. Only the switch writes or removes it, and no visit or count touches it. - The counts are on only when `telemetry-off` is absent and `telemetry.json` says on. - Off writes the mark before writing `telemetry.json` and again after it, so an on from another server between the two writes can't leave off unmarked. - On removes the mark only after `telemetry.json` says on. - **Older builds:** an `enabled: false` written by an older build is copied into the mark whenever `telemetry.json` is read. A read that can't write it still reads off and tries again next time. - **Fails closed:** the mark is read by `offMarked`. Only a name that is not there, in a state directory this process can read, counts as no mark. A dangling link, `EACCES`, `ENOTDIR` or any other error reads off, so nothing is sent. A first run makes its state directory before looking, so a fresh install still starts on. A state directory that cannot be made now also reads off in Settings; before, it sent nothing but showed on. - **Sends in progress:** - Off stops this server's own sends before it reads or writes anything. - The mark is checked last, right before each send, with nothing in between: after the daily message's own state write, and in `report()` before the install or update event. Days still waiting stop once another server turns the counts off. - `report()` clears its in-flight send after the send is stored, as the daily-message path does, so an event held back by that last check is sent once the counts are on again. - **Untouched:** `shared/telemetry.ts` and the Worker are unchanged, so nothing needs deploying. ## Tests (fail first) Five new tests in `server/telemetry.test.ts` ("another server on the same state directory") fail on main and pass here. The first two run a real second server process: it reads the state, then pauses on its `now` clock, which Telemetry calls between reading and writing. The two processes hand off over stdin and stdout, with no sleeps or polling. - An off while the other server is midway through a count, or through a visit, stays off. The other server's late write lands, nothing is sent, and a fresh reader also sees off. - An off that overlaps an on from another server, and finishes last, stays off against a later stale write. - An older build's off stays off against a late write saying on. If it couldn't be marked at start, the next read marks it. - Days still to send stop once another server turns the counts off. A sixth test checks that turning the counts on from either server turns them on. ## Known limits - **A message already leaving:** the mark is checked immediately before each send, with no code in between. Only a send that has already started when another server turns the counts off can still land; nothing changes the switch afterwards. - **An on can be undone, never an off:** a server that read off a moment before another server turned the counts on can mark them off again. This is the safe direction. - **Servers from before this fix:** they ignore the mark, so they can still turn themselves back on. The changelog says the fix holds between servers of this version or later. ## Reviews - **omo-native-code-reviewer on 9913b08:** APPROVE, LOWs only. - Fixed in c8f8c74: an overlapping off/on could leave off unmarked; the changelog said "always"; an unwritable mark left this server's sends going. - Not fixed: a start-up that marks off can undo a concurrent on (safe direction), and another server's send already in flight (see Known limits). - **Codex Terra 6.1 fast xhigh, three rounds:** - **Round 1:** three HIGHs and a MEDIUM, each reproduced by Terra's probes. - Fixed: the overlapping off/on, and the older-build off left unmarked after a failed write. - Declined: the synchronous gap before a send, and an on undone by a stale off (see Known limits). - **Round 2:** two MEDIUMs, both fixed. A read could write the mark before this server's sends were stopped, and the test helper's buffered output could hold back its handshake. - **Round 3:** APPROVE with no findings. Terra's sandbox refuses to let the parent write to the child's stdin (`EPERM`, reproduced there without any telemetry code), so it could not run the two-process tests; they run here and in check fast. - **Merge pass @ c8f8c74:** BLOCK on a reproduced HIGH: the mark failed open (an inaccessible state directory or a dangling link read as no mark, and `report()` sent before a write failed). There was also a MEDIUM: move the check right before each send. Both are fixed in d7d3ea3. - **Codex Terra on d7d3ea3:** a LOW (an event held back by the last check stayed stuck until restart), fixed; then APPROVE with no findings. Its probes: modes `000`, `100`, `400` and `ENOTDIR` read off; `500`, `700` and a first run read on; dangling and self-referencing links read off. ## Validation - `bun run check fast` on d7d3ea3: ok (8794 pass, 0 fail, 35 skip; typecheck and build ok). - `bun test server/telemetry.test.ts`: 60 pass, 0 fail. `server/api.contract.test.ts -t telemetry`: 4 pass. `server/conventions.test.ts` and `scripts/changelog-fold.test.ts`: pass. - Fail-first logs: all five new tests fail on main's `server/telemetry.ts`, and the two round-2 tests fail on 9913b08. - Not run: browser, Windows and integration suites (CI). No real receiver, Worker or D1 was used.
devswha
added a commit
that referenced
this pull request
Oct 30, 2026
…ion's (#2426) Closes #2423. A plain Codex pane's chat could show **another session's conversation** on main (reproduced on `f7fcec52` during the review of #2420; this fixes the shared binding code #2420 builds on, so it can rebase onto it). The project rule this follows: bind a pane only from what herdr and Codex report about *this* pane and what its screen shows as answers; when ownership cannot be proven, show the terminal instead of guessing. ## What changes (`server/codex.ts`) 1. **Short answers count only below the prompt they answered.** `matchShortCodexAnswers` (#283) matched the newest short answers on screen without looking at the prompts above them, so the same short answers given to *other* prompts bound the wrong thread (whatever herdr's process reads returned: live, absent, or absent between two live reads). Each matched short answer now needs the nearest prompt shown above it to be the one it answered; with that prompt past the top of the read, nothing is matched. 2. **Prompts and queued messages are never answers.** `codexScreenParts` cuts a screen at what was typed: `›` prompts (sent, or the input box) and indented `↳` messages queued to be sent, with the lines they wrap onto. They are left out of the long-answer match (`matchCodexTranscript`) and the short one, so a long answer quoted in a prompt, the input box or a queued message no longer binds the conversation it came from. 3. **herdr's reported thread is a hint, not proof.** The `agent_session` herdr has for a Codex pane comes from Codex's SessionStart hook, which since Codex 0.157 runs in the shared app-server daemon with the environment of the TUI that started it, and a report outlives the Codex that made it. It was returned at once (path) or whenever the screen said nothing (id), also by the background reader `codexOpenRollout`. It is now a screen-match candidate like the folder's other threads, and is taken on its own only as the pane's **brand-new conversation** (`freshReportedThread`): an interactive thread of the pane's folder, begun after this pane's Codex certainly started (upper bound of the process start), with no newer thread of the folder since, not bound to another pane, and no other Codex pane of the session (any folder) running when it began (in a store of whole seconds, compared with the last millisecond of that second). A stale report and one routed here by the shared daemon each fail one of these. ## Before / after: a new Codex tab from Ovis (real browser, real CLI) Asked by Dori before the PR, since the binding contract now shows the terminal for a pane that only has an old report. Real Codex CLI 0.163 (`gpt-6-luna` through the local proxy), real Chrome, an isolated Ovis server and isolated test herdr, a throwaway `CODEX_HOME` with herdr's Codex hook. Flow: New tab → Codex, stay in Chat, send the first message from the Chat composer (`Run the shell command ls -la in this folder, then reply with exactly the word: pong`), then read `/api/pane/conversation` every 300 ms. | Case | main `f7fcec52` | this branch | | --- | --- | --- | | This pane's Codex starts the app-server daemon (herdr's hook reports to it) | Chat throughout; message at +0.8 s, `pong` at +4.0 s | Chat throughout; message at +0.8 s, `pong` at +4.9 s (screens identical) | | A daemon another pane started is already running (the report goes to that pane) | Terminal fallback from +0.9 s, no answer in Chat | Terminal fallback from +0.8 s, no answer in Chat (unchanged, pre-existing) | The comparison was run twice more and discarded: the first branch run hit Codex's own "Update available" prompt, and a script check bug misreported main's first answer. Evidence (logs, screenshots, script) stays on the lane's machine. ## Changed expectations - `server/codex-binding.contract.test.ts`: a pane whose only link to a thread is an old herdr id now shows the terminal until its answer is on screen (it then reads the reported thread); the short-answer pane shows its typed prompt above its answers, as Codex does, instead of answers alone (pasted answers are no one's). - `server/codex.test.ts`: the short-answer helpers record one prompt and show it above the answers; each test's own subject and expectations are unchanged. - `server/chat-read-timeout.test.ts`, `server/prompt.test.ts`: their fixtures bound the pane through the report alone; they now show the conversation's earlier answer on screen. Their subjects (HTTP timeouts, the collapsed-queue card) are unchanged. ## Known limits (fallback to the terminal, never another conversation) - A short-answer conversation whose prompt Codex shows abbreviated (`[Pasted Content …]`, `[Image #1]`, a `/prompts:` command) or whose prompt is above the 400 lines read shows the terminal until a long answer is on screen. - Codex's collapsed question queue gets its card only once the pane's conversation is proven (an answer on screen, a fresh report, a binding). - A Codex outside this herdr session in the same folder is not seen as a peer (as on main). - On Windows, where a process start time is not available, a new Codex pane shows the terminal until a long answer is on screen. - A line of an answer that itself starts with an indented `↳` is read as a queued message and left out of the match, the rule the answers-only reader (`shownAnswers`) already applies. ## Reviews - omo-native-code-reviewer and Codex Terra 6.1 (fast, xhigh), adversarial, on `18358a52`: four HIGHs from Terra (queued input as answers, lower start bound, peer in another folder, cropped prompt) and one from omo (whole-second store against a peer's start), all reproduced and fixed in `6fd394e0` with regression cases that fail on `18358a52`; omo's MEDIUMs are the known limits above. Round 2 on `6fd394e0`: Terra confirmed every round-1 fix and raised two MEDIUMs, both fallbacks: a fresh thread inside the start bound's uncertainty (on macOS the shared upper bound adds a second; the fresh rule now uses macOS's exact kernel start + 1 ms, Linux keeps its ~10 ms bound) and the `↳` line above (documented). omo: APPROVE (all six round-1 findings closed); its one MEDIUM is the same macOS fresh-thread case, fixed in `59fc5294`; its LOWs are the `↳` limit, older Codex panes of any folder turning the fresh rule off (by design: the shared daemon then reports to them), and whole-second stores of older Codex. The macOS change is not run on a Mac: the test Mac has no Codex CLI; it only narrows a comparison to the kernel's own start, which `server/process-start.ts` documents as exact to the millisecond. ## Validation - Fail-first: the new cases in `server/codex-processes.test.ts` / `server/codex.test.ts` fail on main `f7fcec52` (6 of the first 7) and the round-2 ones on `18358a52`. - `bun run check fast` passed on `59fc5294` (also on `18358a52` and `6fd394e0`). - Contract tests `server/codex-binding.contract.test.ts`, `server/codex.contract.test.ts`, `server/gjc.contract.test.ts`, `server/prompt.contract.test.ts` on the isolated test herdr: 39/39 on `6fd394e0` (and on `18358a52`); `59fc5294` changes only the macOS branch of the fresh rule, so they were not re-run. - Unit: `server/codex.test.ts` + `server/codex-processes.test.ts` 196/196; every other unit file that touches a reported Codex session or the background reader (17 files, 970 tests) on `18358a52`. - Real browser QA as above (Linux, `18358a52` vs `f7fcec52`). Not run: macOS and Windows, the browser and integration lanes (CI runs them). - `REMOTE_BUNDLE_VERSION` is not raised: per docs/development.md that is the release PR's step.
devswha
pushed a commit
that referenced
this pull request
Nov 1, 2026
…2545) <!-- See CONTRIBUTING.md for checks, translations, contract tests and the changelog (a file in changelog.d/, never CHANGELOG.md). --> ## Change Fixes #2544. Chat drew turns again that it already showed, in three cases. Each fix is in the place where the turns are drawn or read: - **A notice while Claude Code works** (`src/lib/chatRows.ts`, `ChatView` `showAnswer`). The server puts a notice or a subagent's result before the turn at work. The chat only added row slots at the end. So the notice took the running turn's slot, and the running turn mounted again with nothing open. Now `showAnswer` compares the turns shown with the new page by `chatTurnAnchor` (`insertedTurns`). A turn written between turns already shown gets a new slot at its place (`insertChatRowSlots`). The turns after it keep their slots. Turns after the last one shown are appended as before. - **A long chat opened again** (`src/lib/api.ts` `fetchPaneConversation`). Once the newest page moves, the chat reads with `from`, and the answer went under that cache key only. The peek on mount read the plain key, which stayed at the first move. Now a held read that answers 200 is also stored under the plain key. The server's ETag names the `from` cursor, so the mount read still gets the plain page whole. - **/clear in a long chat** (`ChatView` read, the 409 branch only). The held read gets `409 history_changed`. The branch emptied the chat and set it to loading before it read again, so "Loading conversation…" showed for one round trip. Now it reads the newest page first, then drops the old turns in the same commit that draws the new conversation. If that read fails, the old turns still go, as before. This PR changes `showAnswer` and the 409 branch of `read` in `ChatView.tsx`. It changes the cache store at the end of `fetchPaneConversation` in `api.ts`, and adds `insertedTurns` in `chatRows.ts`. It does not change `ChatTimeline.tsx`, the mount effect or `peekPaneConversation`. The behavior follows the Claude app. A message that arrives goes in at its place, and the turns around it stay as they are. A conversation opened again shows its last state at once. A new conversation replaces the old one in one step. ## Validation - `scripts/chat-history-browser-qa.ts`, two new checks (red and green on `main` at dac7c6d): - A notice written before the last turn: the turn keeps its element, and its opened work block and tool row stay open. On `main` it fails: `a notice before the last turn keeps that turn mounted` (actual `false`). - A held cursor's 409: no commit shows an empty or loading chat before the new history. With this fix except the 409 change, it fails: `actual: [ "Loading conversation…" ]`. - With the fix, all 12 checks pass. - `src/lib/conversationFetch.test.ts`, new test: the peek hands back the newest turns a held read brought. It fails on `main` and passes with the fix. - `src/lib/chatRows.test.ts`, new tests for `insertedTurns`: a notice before the running turn, two results before it, turns appended after the last one, a turn rewritten in place. - `bun test` on `src/lib/chatRows`, `conversationFetch`, `chatReadDeadline`, `chatScrollMemory`, `chatMinimap`, `chatTimestamp`, `followScroll`, `followFocus`, `api`, `src/components/ChatTurn`, `ChatFallback`, `ChatMarkdownImages` and `SentWaiting`: 133 pass. - `bun test src`: 3233 pass, 6 fail. The same 6 `recordSettings` tests fail on `main` in this one-process run (3230 pass there). `src/lib/settingsHistory.test.ts` alone passes (38). - `scripts/conventions.test.ts`, `src/conventions.test.ts`, `server/conventions.test.ts`, `scripts/changelog-fold.test.ts`: 51 pass. - `bun run typecheck`: passes. - Not run: `bun run check fast`, as `server/usage-login-private` hangs on this Mac. These files also fail on `main` here: `scripts/check`, `scripts/self-hosted-runner`, `scripts/install-star`, `scripts/ci-browser`, `scripts/ci-browser-parallel`, `server/codex`, `server/codex-processes`, `server/session-history`, `server/letta`, `server/remote-entry`, `server/core/composer-framing`, `server/usage-login-private`, and sometimes `server/bridge`. - Demo scripts (the real `ChatView` with agent `claude` over a fake bridge, headless Chromium), run on `main` at a88b750 and on this branch before the rebase: - Notice: on `main` the running turn goes from element #1, key `[..,3,3]`, to element #6, key `[..,3,4]`, and the opened `Read src/app.ts` row closes. With the fix: the same element and key, and the row stays open. - Reopen with a 400 ms bridge: on `main` the chat shows an old page (last row ANSWER-25) for 10 frames, 291 ms, then jumps to ANSWER-31 (17 rows to 21, a 6 px gap frame). It needs a second request to join the gap. With the fix, every frame shows ANSWER-31, and no gap request goes out. - /clear with a 250 ms bridge: on `main` 19 rows, then 0 rows with "Loading conversation…" for 318 ms, then "No conversation yet". With the fix, 19 rows, then "No conversation yet". - Browser regressions, one at a time, each on `main` and on this branch, with the same result: - `scripts/chat-browser-qa.ts` through `bun run check run --build` (an isolated herdr): 9 pass. - `scripts/rewind-browser-qa.ts`: 12 pass. `scripts/chat-fallback-browser-qa.ts` and `scripts/chat-outcome-note-browser-qa.ts`: pass. - `scripts/chat-virtual-browser-qa.ts`: 3 pass, then it fails at `grow-above` on both. `scripts/chat-gjc-streaming-browser-qa.ts` prints its OK line, then exits 1 on both. These two launch Playwright's own headless shell, which this Mac does not have, so I ran a copy that names the local Chromium. - `scripts/chat-history-browser-qa.ts`: the existing step that waits for `.chat-new-messages` is flaky on this Mac. It fails in 4 of 6 runs of the unchanged script on `main`, and in some runs on this branch. With the fix, the full script passed in 2 of 3 runs, and the third failed at that step. - Changelog fragment: `changelog.d/chat-rows-drawn-again.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HabHntUPvy5yA9iU3G1m5y --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 3, 2026
devswha
added a commit
that referenced
this pull request
Nov 5, 2026
Part of #1212 ## What Claude Code's AskUserQuestion can give each option a `preview` (a mockup, a code sketch). The terminal draws it in a box beside the menu for the option under the cursor; the Chat card showed nothing of it. Now the card shows that box's text under that option, and follows the cursor when it moves in the terminal. - **Server** (`server/dialogs/claude.ts`): the preview box the parser already cut away is now also read. Only a box that opens on the first option's row counts, and only the text between its two edges is read: its rows as drawn, and the count from Claude's `├─── ✂ ─── 31 lines hidden ───┤` row. It goes out as `option_preview: { option_index, text, hidden_lines? }` on the prompt and stays out of the card's id, like `screen_words`, so moving the cursor never remounts the card. - **Client**: `PromptCard` shows it in a mono box under its option, in line with the label, scrolling both ways (8 lines at most) so a mockup's columns never re-wrap, plus "Claude left out N more lines" when Claude cut it (its terminal shows only that count too). A multiple choice shows it the same way. `polledPrompt` takes a new preview for the same card in place. - No setting and no change to the composer: the card only shows what the terminal already shows. ## Why only the cursor's option (facts, not guesses) Measured live on Claude Code 2.1.312 in an isolated herdr session: - The session file has no copy of the pending AskUserQuestion call while the question is open (the same as 2.1.286/2.1.311), so the screen is the only source. - Claude draws only the focused option's preview. Long lines are wrapped at the box's width, and a long preview is cut to its first rows (14 at 119 columns, 12 at 67). - At about 40 columns the box is 4 columns wide and the preview comes out in unreadable pieces (`+-`, `-+`). A box under 20 columns gives no preview, and the card looks as it does today. The card never moves Claude's cursor to show other options' previews. That would be a new answer action on `POST /api/pane/prompt/answer`, so it is left for a follow-up. ## Not in this PR: notes (`n`) The issue also asks for Claude's per-option notes. Measured on 2.1.312: `n` opens a Notes field for the option under the cursor, the typed text goes into it, and Enter picks that option with the note (the tool result reads `"Which layout?"="Grid" ... notes: keep it compact`). Supporting this needs a new `note` field on the answer contract, so it is a separate slice. ## Design reference This follows Claude Code's own terminal, which shows the preview beside the option it belongs to. The card puts it under that option, because the card is a single column on a phone. DESIGN.md has the entry. ## Screenshots These come from a live Claude Code 2.1.312 question in an isolated herdr session, not the owner's session. | Desktop 1280, dark (cursor on Grid) | Desktop 1280, dark (cursor moved to Tall, cut preview) | |---|---| |  |  | | Desktop 1280, light | Phone 390, light (long line, scrolls sideways) | Phone 390, dark | |---|---|---| |  | <img src="https://raw.githubusercontent.com/devswha/ovis/9c61410431b2bdf3dec9d25cb9551703ed1243ce/wide-390-light.png" width="260"> | <img src="https://raw.githubusercontent.com/devswha/ovis/9c61410431b2bdf3dec9d25cb9551703ed1243ce/wide-390-dark.png" width="260"> | Clicking **Grid** on the card while the terminal cursor was on Wide answered Grid (`[prompt/answer] outcome=ok`, and Claude replied "You selected Grid"). ## Validation - Failing first: the 5 new parser tests (`server/dialogs/claude.test.ts`, recorded 2.1.312 screens at 119/67/40 columns), the `polledPrompt` test and the `PromptCard` test all failed before the change. The narrow-box test also fails with the 20-column floor set to 0. - `bun test server/dialogs/claude.test.ts server/prompt.test.ts`: 502 pass. - `bun test src/lib/promptText.test.ts src/components/PromptCard.test.tsx src/lib/i18n.test.ts` plus every `conventions.test.ts`: 110 pass. - `bun run typecheck`: pass. - Browser: `scripts/prompt-card-lifetime-browser-qa.ts` and `scripts/prompt-dock-demo-regression.ts`: all PASS. - `bun run check fast`: pass on both heads (12325 unit tests at the fix head, typecheck, build, generated types/themes, workflow syntax). - After the fix: `bun test server/dialogs/claude.test.ts server/prompt.test.ts src/lib/promptText.test.ts src/components/PromptCard.test.tsx`: 534 pass. - Not run: `check full` and native app builds (no native code touched). ## Reviews (one fix round) - **Codex Terra (xhigh)**: CLEAR, with 3 reproduced MEDIUMs, all fixed in the second commit with failing-first tests: 1. A box drawn above the question at the same column was read as the option's preview. Fixed: the box must open on the first option's row. 2. Text right of the box's edge was kept in the preview. Fixed: only the columns between the edges are read, and a row without the right edge ends the read. 3. A multiple choice card dropped the preview. Fixed: it shows the preview under that option too. - **omo**: BLOCK on the same item as Codex #1 (fixed as above). LOW: the cut note said the lines were "in the terminal", but Claude's terminal shows only the count. Reworded to "Claude left out N more lines". - Codex re-review at the fix head: CLEAR. Its one MEDIUM is the pre-existing item below. - Not changed here (also on main, noted by omo and Codex): `withoutPreview` cuts option rows at the column of the first box it finds above the menu, so an earlier box at another column can garble the option labels. main does the same thing. This is a candidate follow-up.
devswha
added a commit
that referenced
this pull request
Nov 12, 2026
…3737) Related to #3563. Thanks to the reporter of #3563 and to #3698 for finding this and for the direction taken here: withhold Send anyway while Claude Code's box hides folded lines. This PR rebuilds that behaviour from the description, with its own code and tests. ## Cause When a chat send to Claude Code is refused with `input_draft` and the box holds no single clearable draft, the refusal carries the box (`InputDraftError.box`, `claudeInputBoxContent`) and the composer offers **Send anyway**. Claude Code folds a long paste or an image into one placeholder line (`[Pasted text #1 +12 lines]`, `[Image #1]`), and the lines it stands for are not on the screen. The refusal still offered Send anyway over such a box, and confirming it pasted the new message behind the hidden text, so Claude got both as one prompt: lines the user was never shown. Reproduced live with Claude Code 2.1.321 in an isolated herdr session: 14 pasted lines folded into `[Pasted text #1 +13 lines]`, a chat send was refused with Send anyway offered, and after Send anyway Claude received `hidden line 1 … hidden line 14: HIDDEN-PASTE-MARKER안녕`. ## Change - `foldedPlaceholder` (`server/claude-input.ts`): one check for a `[Pasted text #N` or `[Image #N` placeholder, reading any run of spaces or row breaks as one space, since Claude wraps its box at the pane's width, also inside a placeholder. The four places that looked for one use it. - `claudeSendAnywayBox`: the box a refusal may offer to send anyway over, and a send anyway may go over. It is `claudeInputBoxContent`, or null when the box holds such a placeholder. - `server/core/composer.ts` uses it wherever a refusal records its box (`freeClaudeBox`, the scrolled-viewport refusal in `claudeBoxReads`, the immediate send's refusal) and where a send anyway is checked against the box at confirmation. So over a folded placeholder no Send anyway is offered (immediate or queued), and a Send anyway confirmed after a placeholder came into the box is refused, with nothing typed, and offers none again. - A plain visible box (bash mode, several rows of typed text) keeps Send anyway as before. Nothing else in Claude's draft handling changes: "Clear it and send", the clearing of the chat's own restored message, and the refusal itself are as they were. - Not in this PR: the other half of #3563, the refusal itself when the placeholder is the chat's own cancelled message. That one needs a way to tie Claude Code's placeholder to the paste, and stays open in #3563. No layout change: the refusal shows the composer's existing note without its button. ## Validation - `server/submit.contract.test.ts` (new cases): a refusal over `❯ [Pasted text #1 +12 lines]`, over typed words around `[Pasted text #2 +40 lines]`, and over `❯ [Image #1]`, and over a placeholder wrapped across two rows (`look at this [Pasted text` / `#2 +40 lines] and fix it`) carries no box (no Send anyway), and a send anyway after it is refused (`pending_target_changed`) with nothing typed; a Send anyway confirmed after a folded paste came into a box first shown as `! ls` is refused with no box, and a second one too. All of them fail on `main`, and the wrapped one on the previous head bc9151f. The existing Send anyway cases (`! ls`, a changed box, a clipped box, a replaced session) pass unchanged; the file passes in full (110 pass). - `server/core/claude-draft-send.test.ts`, `server/prompt.test.ts`: 471 pass. - Live, owner's signed-in Claude Code 2.1.321 (`DISABLE_AUTOUPDATER=1`, an already trusted scratch folder), isolated herdr session, two Ovis servers on it at 390 px: on `main` the folded box offered Send anyway and sending sent the hidden lines; on this branch the same box was refused with no Send anyway, and a box with two visible typed rows still offered it. - `bun run check fast` at this head: workflow syntax, generated types and themes, typecheck, build ok; unit tests 16188 pass, 1 fail: `server/codex-processes.test.ts` "compares the selected and actual databases through different Codex homes", a 10 s timeout with this PC's load average at about 220. That file passes alone (275 pass, 0 fail) and this PR touches nothing it covers. - Not run: the browser regressions (no component changed; the composer already shows a refusal without Send anyway when the server sends no box).
devswha
added a commit
that referenced
this pull request
Nov 12, 2026
Closes #3769. Also the review notes left on #3737 (#3563's Send anyway half). ## Cause Leftovers from the reviews of #3752 and #3737, each reproduced on a recorded or synthetic screen: - pi: a draft with one row starting `> ` and another starting `→ ` was taken for pi's select dialog and not refused. - Qwen Code: a draft whose second row starts with `> ` (a quoted line) hid the box, since the recognizer stopped at the bottom-most `> ` row. - GJC: a draft wrapped onto more than one row was not read. - Claude Code: a placeholder wrapped inside a word (`[Pasted te` / `xt #1 +12 lines]`, a box narrower than the word) still offered Send anyway; a typed `[Image #1` took the button away; the refusal over a folded paste said nothing about why no Send anyway was offered. - Tests: the Claude-labelled OmO case had lost its assertion that Claude Code's own box check does not run there, and the queued OpenCode-skill tests stubbed GJC's box check, so that path was untested. ## Change - `shared/input-row.ts`: - pi, for the draft check: rows are a dialog's only where a search field (`> `) sits over a select cursor (`→ `) drawn in colour, as pi draws it; typed text takes the terminal's own colour. - The draft-check boxes (Muse, Qwen, cline, dsh-tui) go on looking upward past a row that starts with the box's mark but has no border above it, so a draft row starting with `> ` is read as part of Qwen's box. - GJC, for the draft check only: the `│ … │` rows a draft wraps onto, down to the bottom border (at most 8), and empty only when all of them are (a draft may start with a blank line). The peek reads GJC's box as before. - `server/claude-input.ts` `foldedPlaceholder`: the box text is read with every space and row break taken out, against patterns with none, so a placeholder wrapped any number of times, inside words or between them, is found. The draft checks still take a placeholder's start as content; Send anyway is withheld only over a whole placeholder (`[Pasted text #N +K lines]`, `[Pasted text #N]`, `[Image #N]`), so typed `[Image #1` keeps it. - A refusal over Claude Code's box holding a folded paste carries its own message (`CLAUDE_FOLDED_DRAFT_MESSAGE`, `shared/submit-outcome.ts`), kept when the immediate and the queued sends rethrow it, and the composer shows its own note: "Not sent: Claude Code's input box in the terminal holds a paste or image it folded, whose lines are not shown here, so it cannot be sent over. Send or clear it there, then send this message." (ko, ja, zh added). No new control; no other refusal changes. ## Validation - `src/lib/inputRow.test.ts`: a pi draft of a quoted row and an arrow row in the terminal's colour is a draft, while a dialog's search field over its coloured cursor is not; a Qwen draft with `> quoted line` as its second row is a draft; a GJC draft wrapped onto a second row is a draft, also one whose first row is blank. These fail on `main` (the blank-first-row one on 640c4b9 too). - `server/submit.contract.test.ts`: a folded paste wrapped inside a word, and one wrapped over three rows (inside a word and between two), offers no box, and a send anyway is refused (both fail on `main`, the three-row one on 640c4b9 too); `! echo [Image #1` offers its box and sends anyway (fails on `main`); the folded refusals carry `CLAUDE_FOLDED_DRAFT_MESSAGE`; a scrolled send whose history end keeps moving over a folded paste is refused with no box and that message, and its send anyway is refused. - `server/pending-input.contract.test.ts`: a queued message over a folded paste in Claude's box is refused with that message and no box, nothing typed. - `server/core/omo-pane-send.test.ts`: the Claude-labelled OmO send reads only OmO's box (the viewport, then the live screen), not Claude Code's. - `server/core/pending-birth-guard.test.ts`: a queued message with an OpenCode skill to GJC over its recorded draft is held with `input_draft`, nothing written (GJC's check no longer stubbed for it). - `src/lib/compose.test.ts`: the folded refusal's note differs from Claude Code's general one. - `bun run check fast` at this head (through this PC's heavy-run queue): workflow syntax, generated types and themes, typecheck, build ok; unit tests 16481 pass, 0 fail. - `server/submit.contract.test.ts` and `server/pending-input.contract.test.ts` in full: 241 pass, 0 fail. - Not run: the browser regressions (no component changed) and a live Claude run (the refusal paths are the ones #3737 ran live; the new cases are a narrower box and typed text).
devswha
added a commit
that referenced
this pull request
Nov 12, 2026
…e's, Gemini's or Kilo's box (#3775) Follow-up to #3732, #3752 and #3773: the same draft check for five more agents the agent lab runs. A chat send is refused with `input_draft` only when typed-looking text is seen inside the agent's recorded box; anything the bridge cannot make out sends as before. ## Cause The agent lab's live re-run saw a chat send joined to a draft in Letta Code's, Gemini CLI's and Kilo's own box, and the audit found the same in code for maki and Kimi Code: none of them had a recorded box, so nothing was read before the paste. ## Change - `shared/input-row.ts`, draft-check boxes (the terminal peek does not read them): - Letta Code (`› ` between full-width rules), maki (`❯ ` between full-width rules), Kimi Code (herdr's `kimi`, `│ > ` in a rounded box), Gemini CLI (`> ` between a `▄` row and a `▀` row), Kilo (the `┃` rows over its `╹▀` row, home screen and session alike, the last of them its agent and model line). - `TYPED_COLOURS`: maki, Gemini and Kilo draw typed text in a colour of their own, listed as recorded with the default theme; Letta and Kimi Code use the terminal's. - A character that draws nothing is no typed text: Letta pads its empty box with zero-width characters after its cursor, which read as typed before. - `server/core/composer.ts` `freeAgentInput`: the viewport's colours count when its rows are the live screen's last ones. Gemini's live read holds a row more at its top than its viewport, so the two never matched and the box was never judged. At most two extra rows above are accepted, never different rows at the bottom. - `server/claude-input.ts`: Claude Code's `[...Truncated text #N +M lines...]` placeholder (a paste it cut short) also withholds Send anyway, as `[Pasted text …]` does (from #3773's review). - `src/lib/compose.ts`: a comment moved back above the branch it describes (from #3773's review). - Not covered, and in the changelog: a slash command Kimi Code or Gemini CLI draws in its command colour, and typed text in a theme colour that was not recorded. omp, Devin and Grok are not here: they need the owner's own sign-ins. ## Validation - Recorded in the agent lab (its own HOME, pinned installs, update checks off) inside an isolated herdr session at 119×40: Letta Code 0.34.23, maki 0.7.1, Kimi Code 2.5.3 and Kilo 7.8.27 on the lab's QA backend (`run --qa`), Gemini CLI 0.68.0 on the team proxy (it speaks only the Gemini API); empty, `leftover draft` typed, `/mo` typed; Kilo also under its first answer (`src/lib/fixtures-input-rows/<agent>/draft-*-119.ansi`, README updated). Kilo's saved model was restored after its QA run, as the lab's README asks. - Live, same session, through `createSubmitText` against the real herdr socket: for all five, a send over `leftover draft` was refused with `input_draft`, the draft stayed in the box and nothing was appended; with the box cleared, the next send went through. Before the zero-width and row-offset fixes, Letta's empty box was refused and Gemini's draft was sent over: both seen live, both fixed and re-run. - `src/lib/inputRow.test.ts`: per agent, typed is a draft, empty is not, the `/mo` screen as stated; Kilo's session box reads as its home screen's; zero-width padding after Letta's cursor is no typed text. All fail on `main`. - `server/core/agent-input-send.test.ts`: an immediate send over each new agent's recorded draft is refused with nothing typed, and over its empty box goes through (the refusals fail on `main`); a live read holding a row more above the viewport is still judged and refused (fails on `main`); an agent with no recorded box gets no viewport read. - `server/submit.contract.test.ts`: a box holding `[...Truncated text #1 +40 lines...]` offers no Send anyway, and a send anyway is refused (fails on `main`). - `bun run check fast` (through this PC's heavy-run queue): workflow syntax, generated types and themes, typecheck, build ok; unit tests 16609 pass, 0 fail. - `server/submit.contract.test.ts` and `server/pending-input.contract.test.ts` in full: 242 pass, 0 fail. - Not run: the browser regressions (no component changed; the peek's recognizers are untouched).
devswha
added a commit
that referenced
this pull request
Nov 22, 2026
…st screen, always-QR and About update check (#4435) ## 0.5.10 relay/app integration (one combined review) Owner's method for 0.5.10: every lane put its slice on `release/relay-0510` (per-slice commits, subject prefixed with the slice name). This PR runs the one combined pass: check fast + full CI once, one dori review, one omo gate (anthropic/claude-opus-5-5 high) over the whole diff, t13r on the security slices, one fix round. A bad slice can be dropped by reverting its commits. Base: `860d1b5b6` (main with 0.5.9). ### Slices | slice | commits | what | t13r | |---|---|---|---| | approve-card | fe336dd..112bfd1, b527564 | A PC with no account member lets its first phone in by a tap in the PC's own window (digits shown, "allow only if your phone shows this number"); any other window gets 403. Phone waiting screen: "맥에서 [허용]을 눌러 주세요". QR key confirm: [이 PC에서 확인] opens the existing confirm page (POST /api/account/confirm-page, own window only); no route approves a key. | YES | | uvb-S1, S1b | d32628d, e8a755b, d028865 | Unified sidebar adds the account PCs by itself; nothing to press (no Check again, digits, Change PC); header dot. | - | | uvb-S2 | b9bee3d | Relay drive devices may add account PCs; a vouched PC join is a WATCH row. | YES | | uvb-S3, S3b | e84272c, fe760e2 | Shell opens any online PC by itself, moves off one that goes away; account-only PCs only when confirmed, past new_until, not introduction-only. | YES | | uvb-S4 | ddedeb1 | Vouched PC join approved by a plain tap, bound to the joining server proven in-session and matched against the approver's own /v1/pcs. | YES | | phone-first-build | e62c516..80e5620 | Phone native first screen; Android Tailscale check (manifest `<queries>` com.tailscale.ipn). Owner OK given. | - | | desktop-update-about | 31d609b..d1dd8a8 | Settings > About [업데이트 확인] runs the app's own update check. Replaces #4427. | - | | add-connection-qr | 5ce18df..f7312c0 | Add a connection shows a phone QR on every tab, drops Phones and devices; PC page link `#sign-in=` signs in, then joins that PC. Replaces #4431. Owner UI OK given. | YES | | control-page-fold | e87df8e..a3a28f0, fixes 44fb77d..30d20c6 | Removes the app.ovis.sh control page; 기기 끊기 / PC 빼기 (dead PC, any age) / 계정 삭제 under Settings > 기기와 PC > [계정 관리]. 모든 기기 로그아웃 was later pulled back INTO 0.5.10 by the owner (owner-fix round below). Manage account also reachable from the signed-in start screen (owner-approved). | YES (PCR-1: ovis-sh/account#58, not a regression) | ### Replaced PRs #4428 (closed), #4427 (closed), #4431 (closed). ### Review trail - Combined gate @f7312c09e BLOCK -> fix round -> delta gate @781e03309 BLOCK (HIGH-2) -> fixes -> delta gate @a4c9bb23b CLEAR -> MEDIUM fix 5438550..fd2e5fb CLEAR. - control-page-fold gate @fd2e5fbdf BLOCK (hosted leave feedback) -> fixes 44fb77d..30d20c6 (gate running). - dori @f7312c09e BLOCK (native #picked) -> fixed 477f3d0/a4c9bb23b; dori @a3a28f017 CLEAR; dori at the final tip running. - Fix commits are prefixed by slice ('uvb-fix:', 'approve-card:', 'add-connection-qr:', 'control-page-fold:'). ### Merge conditions - check fast + CI green, dori CLEAR, gate CLEAR, t13r YES on approve-card, uvb-S2/S3/S4, add-connection-qr, control-page-fold. - Owner OK on add-connection-qr UI and phone-first-build: both given. - Owner tests the Mac + phone preview of the final tip and says OK (lead's condition). ## Owner-fix round (fix/owner-0510, landed as 89c9e26..cccb50f) The owner tested the 89c9e26 previews and reported findings #1-#10; the lead added items (a) sign out every device, (c) reconnect speed, (d) PCR-1 app side + #4440 relay/account items, (e) ovis CLI cleanup (lane ovis-cli-design), and the PC proof on re-list (#65 condition). All landed on side branch fix/owner-0510, then fast-forwarded here. | Item | Commits | |---|---| | #1 signed-in 0-PC: 3 tabs + ⋮ menu | 09a09dc | | #2 confirm an unconfirmed PC (+ two-step line, gaps) | 0325bf6, ea87f1e, 3cc9d07 | | #3 setup row = checklist | 164012c | | #4 Tailscale serve/open (+ owner-login condition) | e614cf1, ab20c89 | | #5 phone approve/deny of a join | 701e023, 9cf9b1a, 1dd2c61 | | #6 Direct = address line + code, no QR | 2caeb4e, e02aedc | | #7 signed-out account PC one line | 7928083 | | #8 join notice to the right windows, kept until seen | 6662003, f718efe, dbd2f68, cccb50f | | #9 reconnect UI (grey after 1 s, card after 10 s) | 4a6247e | | #10 Inbox entry beside Settings | 0ec0dbe | | SSH from hosted Direct -> app's own SSH screen | 1c51cb1, 3f9be0b | | (a) sign out every device (account#64 live) | 9b63d95, c8fa0a4, 7b2574f | | (c) reconnect wins | 84b8ce6, 69b5c1e | | (d) PCR-1 app retry + #4440 items + Delete account wording | e26082f, 11c8926..9f60656, e6168df | | PC proof on re-list after ovis logout (account#65 live) | e66b12b | | (e) ovis CLI (login/logout/approve/pair --relay) | 11c13e1, dcae136, f363d42 | | fake parity with account#62/#63, red-test fixes, B1b | 9a47489, 25ad3d9, bcf5059, 181884b, 2072a04, 15cea4f, 1674ca5, ea66c62 | Review trail for the round: security-triage YES per item (Tailscale routes with the owner-login condition; confirm UI conditions; sign-out wording; join notice; SSH handoff; Decline; logout/leave with PC proof; MEDIUM pc-proof scoping ledgered as ovis-sh/account#66, MUST-CLOSE before Step 2 opens beyond the owner). Opus gate (one pass over the round): CLEAR at 181884b, delta CLEAR at cccb50f (join-notice MEDIUM fixed). check fast in the CI image: green at 03fcd4e06 (unit 22471/0). --------- Co-authored-by: sisyphus-dev-ai <[email protected]> Co-authored-by: Claude Fable 5.2 <[email protected]>
devswha
added a commit
that referenced
this pull request
Nov 23, 2026
… Back, row state From the adversarial review of #4487: - #1 Forget sits in a column of its own beside the row's open link (each row a subgrid of the list), so a tap on the chevron never lands on Forget. - #2 The phone app's saved PCs are asked only of an app with getState, and a front page waits on the answer for 1.5 s at most; a late answer still lists them. - #4 What is saved decides only the app's own front page: a PC's own page keeps that PC's sign-in, and its Back on a relay with no accounts. - #5, #10 Add PC over My PCs has an entry of its own in the history (useSheetHistory), so Back returns to My PCs; the focus moves to its title and back to Add PC. - #8 A row says first what this device knows: a pairing's saved Ovis too old, a check that settled (off or on), then the account's word. - #11, #12 The acceptance check finds the forgotten laptop's one row; the mixed list test has a relay pairing and opens every native row at its own address. Co-Authored-By: Claude Opus 5.5 <[email protected]>
devswha
added a commit
that referenced
this pull request
Nov 23, 2026
…that stay, codes kept From the adversarial review of #4492: - #1 #2 #7 #10 One open attempt for the whole connect screen, tracked from the tap (before the Tailscale question, whose wait is bounded and takes only an explicit off as off): a newer tap, Cancel or leaving drops an earlier one's late answer, no second open runs while one does, both panes show the one status, open is called only where the app has it, Cancel shows only where it can stop it, and the plain wait and the removed screen show a scanned PC's open too. - #3 #4 My PCs and Add a PC stay mounted under one parent across 1024 px, so the tab, what is typed, the focus, the search and an open survive a resize; a pairing dialog stays the top of the history when the window narrows under it. - #5 Each desktop pane scrolls on its own; checked at 1024x400 with the wheel. - #6 A code is looked up in its own field, kept through a failure to correct. - #8 Tailscale's IPv6 range counts as a Tailscale address. - #9 Android's no-answer is explained; an unknown reason never shows the app's words. - #11 #12 A PC the app keeps open while choosing shows My PCs with its Back, and only its own scope on a self-hosted relay's origin is marked. - #13 One alert for a failed sign-in on a wide screen. #14 The Cancel test presses it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
devswha
added a commit
that referenced
this pull request
Nov 27, 2026
…ter a stop (#4856) ## What A Chat send to a Claude Code pane is no longer refused as an input draft when Claude's input box holds only the chat's own last message, which Claude put back folded as `[Pasted text #N +M lines]` after the turn was stopped (#3563). The box's words are no proof the placeholder is the chat's (anyone's paste of as many lines reads the same), so the fix ties it to Claude's own records, as the triage asked ("the send must remember what it pasted"): - `claude-store.ts` `claudeRestoredPaste`: for the pane's one Claude process (its store and its session from the PID record, as `claudeForegroundSession` reads them), the session's **last** prompt in `<config>/history.jsonl` must be exactly one text paste whose content is the chat's last message (`lastChatSubmitted`; inline `content`, or `paste-cache/<contentHash>.txt` for a long one), and its placeholder must be `#(N-1)` with the same line count as the box's `#N`. And the session's transcript must hold **no reply after its last human prompt** (Claude dropped the stopped turn before answering): a turn that went on leaves the same history line, and a paste a person makes after its answer takes the same next number. Tabs compare as the four spaces Claude keeps a paste with. The history file is read from its tail (256 KB) with the same ownership / no-symlink checks as the other Claude records; a hash that is not hex is never used as a path. - `core/composer.ts` `freeClaudeBox`: the existing "restored copy" branch (two Esc, then send) now also takes such a box; the box is read again after Claude's records and must still be the one they were checked for before the Esc presses go. Everything else still refuses exactly as before: a working agent, a queued/automatic send, words beside the placeholder, an image, a truncated paste, an unsubmitted paste, another session's prompt, a later prompt or paste, a record that cannot be read. ## Why this evidence (measured on Claude Code 2.1.330, isolated `HOME`/`CLAUDE_CONFIG_DIR`, a local API stub, no herdr) | Step | Box | `history.jsonl` | |---|---|---| | paste 13 lines | `[Pasted text #1 +12 lines]` | - | | Enter, then Esc while the request is pending | `[Pasted text #2 +12 lines]` (put back under the **next** number) | `{"display":"[Pasted text #1 +12 lines]","pastedContents":{"1":{"id":1,"type":"text","content":<exact text>}},"sessionId":...}` | | Ctrl+U, paste other 13 lines | `[Pasted text #3 +12 lines]` | - | | Esc Esc (clears), paste again | `[Pasted text #4 +12 lines]` | the cleared input is added as its own line | | paste 401 lines, Enter, Esc | `[Pasted text #6 +400 lines]` | `pastedContents` holds `contentHash`, the text is in `paste-cache/<hash>.txt` | Numbers only grow within a process, so a paste the user makes after the restore can never carry the restored number, and a box cleared with Esc Esc adds a later history line, which also refuses. Not covered (still refused, as today): a paste whose Enter never landed (nothing is in Claude's history then), and `claude attach` clients. No contract change, no UI change (the existing refusal and its text stay for every other case), nothing of the user's Claude settings is written: the records are only read. Refs #3563 ## Validation - New `server/submit.contract.test.ts` case (real herdr test session, a `claude` process whose own environment names a temp store with its PID record): **fails on main** (`input_draft` refusal on the second send) and passes here; it also checks that a history line for another message, an answered turn, and a box replaced while the records are read all keep refusing with nothing typed. - New `server/claude-store.test.ts` `claudeRestoredPaste (#3563)` cases (a child process whose environment names a temp store): the restored paste, wrapped placeholder, paste-cache, tabs, an answered turn, a missing transcript, and nine more refusal shapes. - `bun test ./server/claude-store.test.ts ./server/submit.contract.test.ts ./server/prompt.test.ts ./server/core/pending.test.ts ./server/conventions.test.ts` pass; `bun run typecheck` pass. - `bun run check fast` ran on another PC (this one is over 85% CPU). The files it failed (`tui/testing/entry-pty`, `server/usage-login-outcome`, `server/usage-account-list`) fail the same way on main there; `src/App.deviceNotices` and `server/account/device-journal` pass alone. `server/pending-input.contract.test.ts` has 15 s timeouts there and on this PC under load **on main too** (a different handful each run; control run on an unchanged server tree: 7 fail). - Skipped: browser regressions (no UI change).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Observe mode, held-input draft, and status push for every pane
Three changes to how browsers share herdr's panes:
1. Connection roles — input and resize authority, enforced server-side
Every client used to be able to type into and resize the shared pty: attaching resized it to the attacher's geometry, so opening a pane on a phone changed the size the desktop saw (reconnecting did it again, and refit-on-focus fought back).
role {mode: "interact" | "observe"}(defaultinteract); the server stores it per connection and answersrole-ack.observeconnection'sinput,keysandresizeframes get aread_onlyerror, and itsattachnever resizes the pty. Not a disabled button — the server refuses.pane-geometrywhenever it changes: observers adopt it (their xterm renders the operator's grid instead of fighting it), operators drive it. When an observe connection creates the attachment, the pty spawns at the pane's own layout grid — never at the observer's viewport (gate review caught this hole in the observer-first flow). Returning tointeractrefits and re-asserts your own geometry after the ack.2. Held input across disconnects — auto-recover, never auto-send
The WS client used to queue
input/keyswhile disconnected and flush them on reconnect — an Enter or ^C typed into a dead socket would fire unannounced seconds later. Now:input/keysare dropped at the socket layer, never queued.3. Status push for every pane + notifications
Agent status used to be pushed only for the pane you had open; everything else waited for the 5s poll. herdr's subscription surface (verified live, protocol 22):
pane.agent_status_changedneeds a per-pane subscription but one connection carries any number;pane.created/closed/exitedsubscribe globally; a secondevents.subscribeon an open connection is silently ignored; a batch referencing a vanished pane is rejected wholesale and the connection dropped.server/collector.tskeeps one status connection covering every pane in the snapshot (reconciled on pane created/closed, 60s backstop, immediate re-subscribe from a fresh snapshot when herdr drops a batch) plus a global lifecycle subscription.pane-status,pane-exitedandsession-changedbroadcast to every connected client. The client merges pushes instantly (badge flips in ~400ms in QA) with a debounced snapshot refetch for the derived rollups; the 5s poll stays as a backstop.frame.data.pane, which never matched herdr's flat status frames — the oldpane-statuspush never fired.Tests
62 tests (was 36), all against the live herdr server: contract tests prove observe enforcement (no resize on attach,
read_onlyerrors, observer-first spawn sized from the pane's layout rect — mutation-verified), unattached-panepane-statusandpane-exitedpush (driven deterministically viapane.report_agent), plus unit tests for the draft, notification-transition, snapshot-merge and collector parsing logic.tsc --noEmitclean;bun run buildclean.QA
Four rounds of dual-oracle visual review on browser captures (desktop 1280px + emulated mobile 390/320px) plus two gate reviews of the whole diff: visual rounds caught translucent observe surfaces, a 40px pill occluding two terminal rows, a missing disabled affordance, the offline-toggle stuck-observe bug and a 320px header overflow; the gate review caught the observer-first spawn hole (B1) and a bookkeeping-only assertion (B2), both fixed with a mutation-proven test. Final rounds: PASS. Browser QA asserts 16 rows (role confirmed-state, draft delivery to the real pane, badge push latency, banner stacking, key bar unmount under touch emulation, 320px fit).