Skip to content

fix(server): share one pty when clients attach the same pane concurrently - #2

Merged
devswha merged 1 commit into
mainfrom
fix/concurrent-attach
Sep 19, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/concurrent-attach

Conversation

@devswha

@devswha devswha commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Problem

ensureAttachment checked the attachment map, then awaited the terminal lookup (session.snapshot) before storing the new record. When two attaches to the same pane landed in that window, each one spawned its own herdr terminal attach. That can happen when a PC and a phone reconnect together after a server restart.

  • The later record replaced the earlier one in the map, and the earlier pty was orphaned.
  • The orphan's onData still looked the pane up by id, so its output went into the surviving attachment.
  • One client went silent (no pty-data, no pane-geometry), and the other got output from two ptys.
  • When the orphan exited, closeAttachment(paneId) closed the surviving attachment too. stop() never killed the orphan.

Fix

  • A concurrent attach now joins the in-flight creation through a pendingAttachments map. The entry is cleared in finally, so a failed lookup (pane_not_found) doesn't leave the pane stuck.
  • The creation body moved into spawnAttachment unchanged. attachments.set still runs synchronously right before new PtySession(...).
  • Mixed roles work as before: whichever attach joins second takes its own branch after the shared creation. An interact client resizes; an observer receives pane-geometry.

Test

WebSocket concurrent attach runs on its own herdr-web-ui-test-race workspace, so it doesn't depend on another test's pane. It sends two attaches in the same tick, waits for pty-data on both sockets, then checks that a resize from one reaches both.

Check Result
Mutation: server/index.ts fix reverted new test fails 3/3 (second hears resize ×2, first pty-data ×1)
bun test server/api.contract.test.ts ×4 22 pass / 0 fail each run
bun test 63 pass / 0 fail, 9 files
bun run typecheck / bun run build clean
Leftovers after runs no herdr terminal attach / pty-host.mjs processes, no herdr-web-ui-test* workspaces

The README test count (63) matches the suite again. The coverage sentence now lists concurrent attaches.

🤖 Generated with Claude Code

…ntly

ensureAttachment checked the attachment map, then awaited the terminal
lookup before storing the new record. Two attaches to the same pane in
that window each spawned their own `herdr terminal attach`. The later
record replaced the earlier one in the map, but the orphaned pty's onData
still looked the pane up by id, so it streamed into the surviving
attachment: one client went silent, the other got output from two ptys,
and the orphan's exit closed the surviving attachment.

A concurrent attach now joins the in-flight creation through a pending
map that is cleared on success and failure alike. A new contract test
races two attaches on a fresh pane and checks a resize reaches both
clients; with the fix reverted it fails 3/3.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@devswha
devswha merged commit 7f4c4a3 into main Sep 19, 2026
@devswha
devswha deleted the fix/concurrent-attach branch September 19, 2026 05:09
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 22, 2026
….*.ts (#1674)

Second PR of the i18n split (#2 in the split plan, after the Settings
pilot #1673). The strings that only the terminal's files use move out of
the three base dictionaries into `src/lib/i18n/terminal.{ko,ja,zh}.ts`.
`t()`, the English keys, every translation, placeholders, the English
fallback and all call sites stay the same.

## What changes

- **Moved:** 113 keys in each language, byte for byte, in the order each
language's file had them. A key moves only when every file that uses it
is a terminal file: `components/PaneTerminal.tsx`,
`components/PaneCanvas.tsx`, `components/KeyBar.tsx` (with its `ARROWS`
and `KEY_SPOKEN_NAMES` label maps), `components/FindBar.tsx`,
`components/TerminalViewportTools.tsx`,
`components/SplitDropPreview.tsx`, `components/TabStrip.tsx`,
`lib/terminalLabel.ts` and `lib/tabName.ts`. Keys these files share with
another feature stay in the base files.
- **Composition:** each base file gains one import and one `KO_PARTS` /
`JA_PARTS` / `ZH_PARTS` entry (`terminal: TERMINAL_KO`, …). Nothing else
in the base files changes.
- No test, docs or CONTRIBUTING change: the pilot's tests already cover
every part, and CONTRIBUTING already says where a feature's strings go.

## Key list

I regenerated the list with the split plan's ownership script on this
branch's base, `a717621f`. That script collects keys the same way as
`i18n.test.ts`: `t()`/`tt()` literals plus the 13 label maps, recorded
per file. It finds 113 terminal keys, identical to the plan's list from
`8b5aaba2`, with no key added or removed. Since then main gained only
#1672 (no i18n change) and the pilot #1673 (which moved only
Settings-only keys).

## Checks

- **Same dictionaries:** the composed `KO`, `JA` and `ZH` (every key and
value) dumped as sorted JSON on `a717621f` and on this branch are
byte-identical (`EQUIVALENT`).
- **`--color-moved` summary:** `git diff --color-moved=plain
origin/main...HEAD` over the base and part files shows all 339 removed
entry lines (113 × 3) as moved. The only non-moved lines are 33 added
lines, 11 per language:
  - the import;
  - the parts entry;
- the part file's 7-line header, its `export const` line and its closing
`};`.

  No line is removed other than moved entries.
- **Same keys moved:** the keys of `TERMINAL_KO`, `TERMINAL_JA` and
`TERMINAL_ZH` each equal the 113-key list (`SAME-KEYS` for ko, ja and
zh). The scan still finds all 1,389 keys, the same count as main.
- **Part sizes:** each part file is 122 lines, under the 400-line cap.
`i18n.ko.ts` goes from 1,180 to 1,069 lines, `i18n.ja.ts` from 1,182 to
1,071 and `i18n.zh.ts` from 1,184 to 1,073.
- `HERDR_TEST_MODE=unit bun test src/lib/i18n.test.ts`: 21 pass, 0 fail.
This covers missing, unused, placeholder and untranslated entries, a key
in two parts, and different placement across languages.
- `bun run typecheck`: passes.
- `bun run check fast`: passes (unit 6127 pass, 0 fail, 12 skip;
workflow syntax, generated types/themes, typecheck and build ok).

This PR contains only moved lines, one import and one parts entry per
language, and the part file header. It should qualify for the move-only
merge path if the parts entry and header are counted as part of the
move.

## Note

After this move the `// ---- key bar ----` section comment in each base
file has no entries left: its keys went to Settings (#1673) and here.
The comment is left in place to keep this diff move-only; the last split
PR can drop empty section comments.

No changelog fragment: users see no change.
devswha added a commit that referenced this pull request Oct 28, 2026
…efaults (#2276)

## Change

Default native TypeScript 7 checks to `GOGC=400`, retaining garbage
collection
while spending modestly more RAM to reduce CPU. Typecheck's Go 1.26.4
`tsc`
was the #2 CPU consumer on the shared P620 CI host.

The original proposal was `GOGC=off GOMEMLIMIT=6GiB`. The maintainer's
concurrency
steer requires sizing for 24 simultaneous typechecks with approximately
40 GB free;
the measurements below rule out a GC-off limit with the requested 1.5x
headroom,
so this PR uses the explicitly requested `GOGC=400` fallback instead.

- `package.json` routes `typecheck` through a small Bun wrapper. Both
CI's
`check fast`/`check concurrent` and the remote-bundle jobs already
invoke
`bun run typecheck`; neither `scripts/check.ts` nor any workflow needs
editing.
- The wrapper retains the existing native compiler launcher, both
tsconfig
invocations, sequential execution, inherited stdio, and failure exit
codes.
- Caller `GOGC` wins, including an explicitly empty value. `GOMEMLIMIT`
is
never assigned or removed by the wrapper, so caller limits remain in
force.
- The wrapper passes a child environment and argument array, with no
POSIX
environment-assignment syntax or hard-coded Linux compiler path. This
preserves
  TypeScript's platform package selection on Linux, macOS, and Windows.
- Seven subprocess regression cases cover both compiler environments,
default
and independent/combined/empty overrides, argument forwarding, inherited
  unrelated environment, and stopping on either compiler's failure.
- The explicit tools tsconfig now includes the wrapper and its tests so
the normal
  typecheck validates both new files.
- Includes an English maintenance changelog fragment. No workflow or
dependency
  changes.

## Concurrency sizing

Direct GNU `/usr/bin/time -v` measurements of
`node_modules/@typescript/typescript-linux-x64/lib/tsc`, **not Bun's
RSS**.
Three runs per project and setting, each through `dori heavy ram-gogc-pr
-- ...`;
the table reports the maximum of those three runs. Both projects run
sequentially.
Baseline and unlimited-off measurements explicitly remove `GOMEMLIMIT`.

| Native compiler setting | Main peak RSS MiB | Tools peak RSS MiB |
| --- | ---: | ---: |
| `GOGC=100`, no limit | 1205.29 | 606.29 |
| `GOGC=off`, no limit | 1400.33 | 695.16 |
| `GOGC=off GOMEMLIMIT=6GiB` | 1399.34 | 698.23 |
| **Chosen: `GOGC=400`, no limit** | **1381.34** | **684.29** |

Separate baseline `GODEBUG=gctrace=1` traces show largest post-GC live
heaps
(`X->Y->Z MB`, the `Z`) of **752 MiB main / 394 MiB tools**. These are
observed
live heaps, not a universal upper bound.

The no-GC main peak times 1.5 is 2100.50 MiB, rounded up to **2112MiB**.
That limit alone times 24 is **49.5 GiB**, before RSS overhead,
exceeding both
the approximately 30 GB target and approximately 40 GB free. Even
observed
unlimited-off RSS times 24 is 32.82 GiB / 35.24 decimal GB without
growth headroom.
There is no qualifying GC-off limit under the requested sizing rule.

Baseline direct RSS times 24 is **28.25 GiB / 30.33 decimal GB**. The
chosen
direct peak times 24 is **32.38 GiB / 34.76 decimal GB**. The larger
observed
full-command high-water RSS gives 32.49 GiB / 34.89 decimal GB.
The decision-relevant increment for these direct peaks is **176.05 MiB
per
compiler**, or **4.13 GiB / 4.43 decimal GB at 24**: the existing
baseline memory
is already consumed without this change. In the prior seven-round
CI-image
experiment below, the median increment is **157.00 MiB per compiler**,
or
**3.68 GiB / 3.95 decimal GB at 24**.
The fallback is below approximately 40 GB in this measurement but **does
not
meet the preferred approximately 30 GB envelope**; it leaves about 5 GB
for other
memory. `GOGC=400` retains collection, not an RSS cap or a guarantee
that 24
runners plus their overhead fit. `GOMEMLIMIT` remains available to the
caller.

Twenty-four simultaneous typechecks are a conservative planning case,
not the
usual workload: `CHECK_HOST_MAX_RUNS=4` bounds the herdr-backed lanes,
whereas
typecheck runs in Fast checks on up to 20 runners plus any applicable
lanes.
That lane bound is not a global semaphore for every Fast-check compiler.

## Performance evidence

### Prior CI-image experiment: seven rotating rounds

Source: `/home/devswha/.cache/ram-offload-tmp/gogc/results.md`, snapshot
`adfdef6e49767ec09323b9b2e1f0f151c6b84394`, Bun 1.4.2, TypeScript 7.0.2
/
Go 1.26.4, `herdr-ci-runner:local` on the 128-CPU P620. Medians:

| Setting | CPU user+sys s | Wall s | Max RSS MiB |
| --- | ---: | ---: | ---: |
| Default | 52.31 | 6.47 | 1188.54 |
| **Chosen fallback: `GOGC=400`** | **38.74 (-25.94%)** | **6.14
(-5.10%)** | **1345.54 (+157.00)** |
| Rejected: `GOGC=off GOMEMLIMIT=6GiB` | 23.49 (-55.09%) | 4.76
(-26.43%) | 1390.78 (+202.25) |

Every one of the seven GOGC=400 runs used less CPU than the baseline
median;
its worst was 47.16 CPU-s versus 52.31 CPU-s.

### This worktree: five alternating baseline/chosen comparisons

Rebased onto `792dbb98be8a2cd88b1123930a6aae8b131ebe23`; Bun 1.4.3,
native
TypeScript 7.0.2 / Go 1.26.4. GNU time wraps the real `bun run
typecheck`.
Baseline supplies `GOGC=100`; chosen leaves it unset and exercises the
wrapper
default. Both remove `GOMEMLIMIT`. Odd rounds run baseline then chosen,
even
rounds reverse that order. All runs use `dori heavy ram-gogc-pr -- ...`.

| Round | Baseline CPU s | Chosen CPU s | Baseline wall s | Chosen wall
s | Baseline RSS MiB | Chosen RSS MiB |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| 1 | 59.58 | 43.57 | 6.34 | 7.37 | 1191.29 | 1310.29 |
| 2 | 48.88 | 36.36 | 8.39 | 7.83 | 1174.24 | 1382.29 |
| 3 | 66.91 | 42.98 | 7.38 | 6.25 | 1132.29 | 1386.23 |
| 4 | 58.33 | 41.24 | 6.30 | 6.23 | 1132.29 | 1195.29 |
| 5 | 64.05 | 61.80 | 9.07 | 10.97 | 1194.29 | 1191.29 |
| **Median** | **59.58** | **42.98 (-27.86%)** | **7.38** | **7.37
(-0.14%)** | **1174.24** | **1310.29 (+136.05)** |

Every chosen run beats its paired baseline on CPU; four of five also
beat the
baseline median. Round 5's 61.80 CPU-s exceeds the 59.58 CPU-s baseline
median
and is retained. Wall-time improvement is negligible on this busy shared
host.
Full-command RSS is GNU time's process-tree high-water statistic, not a
sum of
simultaneously resident processes.

For the originally requested chronological three-run before/after
comparison:
the unchanged script was measured before tracked edits, so no stash was
needed.
Before CPU was 35.10 / 36.17 / 28.64 s, wall 4.32 / 4.95 / 5.94 s, and
RSS 1202.23 / 1206.29 / 1207.29 MiB. The first three after runs are
rounds 1-3
above. Their medians are **35.10 -> 42.98 CPU-s, 4.95 -> 7.37 wall-s,
1206.29 -> 1382.29 MiB**. That chronology-only comparison is slower;
shared-host
conditions differed between blocks. The alternating comparison above is
the
contemporaneous evidence for the win. No result was discarded.

Full-command `GODEBUG=gctrace=1` counts: **24 before, 6 after** (3 per
compiler).
The 0-2 expectation was for GC off; the selected fallback deliberately
retains GC.

Raw logs, scripts, and the complete local report are retained at
`/home/devswha/.cache/ram-offload-tmp/pr-tmp/` (`sizing-results.md`,
`baseline-*.time`, `size-*.time`, `compare-*.time`, and `*.trace`).
The table above uses `final/compare-*.time` and
`final/size-chosen-*.time`.
An earlier five-round comparison before adding the module marker and
tools
typechecking coverage is retained too: medians 55.60 -> 39.74 CPU-s
(-28.53%),
7.03 -> 6.74 wall-s, 1193.21 -> 1250.16 MiB. The final tree was
remeasured rather
than substituting those earlier results.

## Validation

- `dori heavy ram-gogc-pr -- bun test ./scripts/typecheck.test.ts`: 7
pass, 0 fail.
- Native TS7 checks the new wrapper and tests through
`tsconfig.tools.json`.
- Required local `dori heavy ram-gogc-pr -- bun run check fast`: **exit
0**;
**8202 pass, 0 fail, 33 skip in 530 files**. Workflow syntax, both
generated-file
freshness checks, both TypeScript projects, build, and unit tests all
passed.
  Report `e39ee9c2-d32d-4758-89a6-7432c7db8945` has `status=success`,
`verification.status=verified`, `source.unchanged=true`, and no errors;
  log: `check-fast-final.log`.
- Final diff reviewed locally. An independent gate reviewer could not be
started
  because this task is already at the harness's maximum subagent depth.
- Native macOS and Windows runs were not executed locally; portability
follows
the existing launcher and Bun child-environment API, without shell
assignments.
- No live runner service/containers, panes, other worktrees, sysctl,
swap, or sudo
operations. Temporary evidence uses the requested `TMPDIR`; no shared
cleanup.

Co-authored-by: sisyphus-dev-ai <[email protected]>
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 21, 2026
…code warning where Add is not offered

From the real-staging run of #2: after Add on an unconfirmed PC the front page's Your PCs did not
list it until a reload, and a sign-in that cannot add it (two_step_required, or a Google sign-in in a
used account) still read 'add it only if you typed that code' beside 'add it with the number'.

The hosted front page reads the account's PCs again (onRefreshAccount, accountController
refreshNow) whenever a notice on it changes them (ACCOUNT_PCS_CHANGED_EVENT: a confirm, a removal,
a denied join). Where Add is not offered, the notice keeps the quoted name and the time and drops
the typed-code warning.
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant