Skip to content

fix(account): a PC names the list's devices by the names the list seals for them - #4714

Closed
devswha wants to merge 3 commits into
mainfrom
fix/list-qa-pc-device-names
Closed

devswha wants to merge 3 commits into
mainfrom
fix/list-qa-pc-device-names

Conversation

@devswha

@devswha devswha commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

What

A PC pinned to its account's signed list made its account rows for the list's devices with the placeholder label
Device (listCommit, LIST_DEVICE_LABEL) and no system, so its Settings › Devices and PCs listed each as
"Device · Browser · Through your account" (signed-list staging QA). The names are sealed in the list's entries
under the epoch key, which the PC is given a wrap of when a member adds it, and which it already uses to seal the
names it writes.

ListFollow now opens the name the list sealed for each of its devices with the epoch key it holds, and writes the
rows again when one opened. listCommit takes those names (and says so: names: true), and AccountDevices.commit
replaces only the Device placeholder of a row, never a name a person gave it at the PC, and only on such a list
commit: a PC that follows no list keeps the labels its rows came in with. An entry it cannot open keeps Device.
The kind ("Phone", "Browser") follows from the name as it does for every row.

How the names are opened (after the review, D1 and D2):

  • the account service's wraps calls and the opens run outside the follower's turn, the queue a read takes; the turn
    is taken only to keep the names and write the rows again, so a read (a removal before a session opens) never
    waits for them;
  • a round asks the service once per epoch, however many entries that epoch seals;
  • an entry counts as tried only once its open was decided (opened, no name sealed, no wrap held for its epoch); one
    the service could not be asked about is asked again in a round a minute later; a new copy of the same list keeps
    the round's names, only another list drops them.

Names decide nothing: whom the PC lets in is still the list's alone, and no name leaves the PC that did not before
(the rows are the PC's own, shown to the devices that may read them, which can open the same names themselves). A
row a person named Device at the PC, or cleared, takes the list's name: the PC tells it from the placeholder by
the label alone (docs/account-list.md says so).

Validation

bun run check fast was not run locally: the PC's heavy queue did not open for over an hour (load above 150); ran the typecheck, the convention tests and the touched test files; CI's Fast checks run the unit suite.

At 3396e93f0: bun run typecheck (clean), then server/account/account-devices.test.ts server/account/list-allow-review.contract.test.ts server/account/list-allow.contract.test.ts server/account/list-follow.test.ts server/account/list-join.contract.test.ts server/account/list-migrate.contract.test.ts server/account/list-notice-lifecycle.contract.test.ts server/account/list-pinned-review.contract.test.ts server/account/list-pinned.contract.test.ts server/account/list-shadow.contract.test.ts with the three
conventions.test.ts files and scripts/changelog-fold.test.ts (445 pass, 0 fail), and the other tests that use a
list commit (observed-use-session.contract, observed-use, join-hold, catch-up, account-rows-signin,
account-rows-listed.contract: 62 pass). The three review tests (the removal read while the wraps route is held,
a name asked for again, the placeholder kept off the list path) fail on the head before the fix. Not run: the unit
suite, the integration suite, the browser runs.

🤖 Generated with Claude Code

…ls for them

A PC pinned to its account's signed list made its account rows for the list's devices with the
placeholder label "Device" (listCommit, LIST_DEVICE_LABEL) and no system, so its Devices list showed
each as "Device · Browser". The names are sealed in the list's entries under the epoch key, which a
PC is given a wrap of when a member adds it (and which it already uses to seal names it writes).

ListFollow now opens, once per entry and in its own turn, the name the list sealed for each of its
devices with the epoch key it holds (epochKey, quietly: a service that does not answer leaves the
rows unnamed and sets no error), and writes the rows again when one opened. listCommit takes those
names; AccountDevices.commit replaces only the "Device" placeholder of a row, never a name a person
gave it at the PC. An entry it cannot open keeps "Device". Names decide nothing: whom the PC lets
in is still the list's alone, and no name leaves the PC that did not before.

Co-Authored-By: Claude Opus <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 44 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b0f20e7 and 3396e93.

Files selected for processing: 8

  • changelog.d/list-device-names-on-pc.md
  • docs/account-list.md
  • server/account/account-device-state.ts
  • server/account/account-devices.test.ts
  • server/account/account-devices.ts
  • server/account/list-follow.ts
  • server/account/list-pinned.contract.test.ts
  • server/account/list.test-helpers.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@devswha devswha added the hold Not merged until the owner says so label Nov 25, 2026
@devswha

devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Independent review standing in for CodeRabbit (rate limited on this PR)

A reviewer who was given the code and not the author's conclusions read this branch and tried to break it. One finding blocks the merge (narrow: a removal can be read late while names are being opened) and one should be fixed; the PR stays on hold until they are closed, and how each was closed is added here.

D1. BLOCKS MERGE (narrow): naming holds the follower's queue across account-service calls, so a removal is not read
before a session opens. PROVED.

The naming task runs on this.turn (list-follow.ts:2600, enqueue :2121), the same queue as readNow()
(:2352) and settle. epochKey(..., quiet) caches only a key that opened (:1905). So each named entry whose
epoch key is not held makes its own /v2/pc/list/wraps round trip (prove, then call, each up to 15 s,
mailbox.ts:1141). A pinned PC's sign-in waits at most 5 s for a fresh read before it decides (beforeSession,
:1536-1548).

Probe zz-rv-names.test.ts ("removal probe"): 4 named devices, a wraps route answering 503 after 1.5 s, and the
victim removed at the service just after the pull:

  • beforeSession(5000) returns after 5000 ms with the victim's role() still "drive";
  • the same run without names takes 37 ms and gives role() === null;
  • once naming ends, the removal applies (role null).

So a removed key gets a session for as long as the naming holds the queue, against the pinned-PC rule at
session.ts:454 ("a removal that waits at the account service is read before any session opens"). It needs entries
whose name the PC has not opened and a slow or failing wraps route, or an epoch the PC has no wrap for: one call per
entry. Smallest fix: do the wraps calls and opens outside this.turn, and take the turn only to store names and
settle(). Also remember a failed or absent wrap per (list, epoch) for the round, so N entries make at most one call.

D2. SHOULD FIX: a name skipped once is never tried again. PROVED.
names.tried is filled before the task runs (:2599). The task gives up on keys === null || this.copy !== copy
(:2602), and on any null from epochKey (a service error, a 503, a 429). Nothing tries those entries again until
the list changes or Ovis restarts. this.copy is replaced by clocked() on every role() lookup in a later second
(:565, 631-633, so on any sign-in), and by every new keep.

Probe zz-rv-names.test.ts:

  • a sign-in in a later second while the naming task waits: the row stays Device through later pulls (hits: 2,
    label Device); the control run gets Dana's tablet;
  • wraps failing once: all 4 rows stay Device after the service is healthy again.

Fix: only mark an entry tried when its open was decided (opened, or no sealed name, or no wrap the service has for
that epoch). Give up only when this.copy?.list !== copy.list, and work from this.copy when the task runs.

NOTE D3. PROVED. A person who names a row Device at the PC, or clears its name (rename stores "Device",
account-devices.ts:77), has it replaced by the list's name at the next commit. Probe test 3 shows this.

NOTE D4. TRACED. The label replacement (account-devices.ts:304-305) sits in commit(), which the snapshot path
also takes (account-catch-up.ts:72 → commitList). On a PC that follows no list, rows labelled Device now take
the account service's label on each read. The changelog and docs speak of pinned PCs only. A pinned PC does not
commit snapshots (account-catch-up.ts:70). Harmless, since names decide nothing, but say so or limit it to the list
path.

NOTE D5. isListLabel (shared/account-list.ts:322-326):

  • it rejects Cc, Cs, odd spaces, leading, trailing and double spaces, and more than 48 code units;
  • it allows Cf (bidi overrides U+202E and U+2066-2069, zero-width U+200B-200D), so a member can spoof another
    device's name.

The client shows the same labels by the same rule (listNames.ts), so this adds no new capability. React escapes the
text, and Cc (so no newlines) is rejected before journal and log lines.

Questions checked (#4714)

  • Binding: { list: seq === 0 ? "" : copy.list, seq } matches the client's listNames.ts:89,
    account-list-seal.test.ts:840 and the helper's sealFields (seq: head.seq + 1). The AEAD data binds (list, seq,
    epoch), so bytes copied from another entry or another list do not open (refused). A wrong binding opens nothing; it
    cannot open another entry's name.
  • Names and decisions: listCommit changes only label. eligible comes from admittedDevices, no from seq,
    moved from signers. commit() reads the label nowhere but the new replacement. Names decide nothing.
  • Stopped follower: keysOf returns null when stopped, and settle checks stopped. quiet hides only the
    wraps-call failure of naming; nothing is cached on failure, so the follower's own epochKey callers (:1850, 1869)
    still report theirs. other_key is still reported (intended). Throws inside the task would still reach this.error
    through enqueue (:2123); none were found.
  • Test: it fails without the change. It does not cover D1 to D4.

devswha and others added 2 commits November 25, 2026 17:26
Review of #4714 (D1, D2). Opening the names the list sealed for its
devices ran on the follower's turn, the queue a read takes, and asked
the account service for a wrap once per entry. With a slow or failing
wraps route a removal was not read before a session opened: a pinned
PC's sign-in waits five seconds at most for a fresh read.

The wraps calls and opens now run outside the turn; the turn is taken
only to keep the names and write the rows again. A round asks the
service once per epoch. An entry counts as tried only once its open was
decided (opened, no name sealed, no wrap held for its epoch); one the
service could not be asked about is asked again in a round a minute on.
A new copy of the same list keeps the round's names: only another list
drops them. settled() waits for the round too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review of #4714 (D4, D3). The replacement of a row still named "Device"
sat in AccountDevices.commit, which a snapshot read takes too, so on a
PC that follows no list such rows took the account service's label on
each read. A ListCommit now says when its labels are the list's names
(names: true, set by listCommit), and only such a commit renames rows.

docs/account-list.md says how the names are asked for (outside the
follower's turn, once per epoch, again a minute later), that a row a
person named "Device" or cleared takes the list's name, and that a PC
that follows no list keeps its rows' labels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@devswha

devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Review fixes at 3396e93f0 (two commits on top of bee15c50f), against the stand-in review:

  • D1 (blocks merge): fixed in 3fe5c7d44. The wraps calls and opens of nameDevices now run outside the follower's turn; the turn is taken only to keep the names and settle(). A round remembers what it learnt of each epoch (key, none, or failed), so N entries make one wraps call at most. Test: "opening names never holds up a read: with names to open and the wraps route held, then failing, a removal is read before a session opens" (4 named devices, the wraps route held open; beforeSession(5000) reads the removal and role() is null; one wraps call). On bee15c50f it fails after the 5 s wait with the role still drive.
  • D2: fixed in 3fe5c7d44. An entry is marked tried only once its open was decided (opened, no sealed name, no wrap for its epoch). A service that could not be asked sets a one-minute gate, after which the next settle asks again. The round gives up only when the list is another; a new copy of the same list keeps its names. Test: "a name the service could not give yet is asked for again, and a copy of the same list read meanwhile keeps the names opened" (fails on bee15c50f: the row stays Device).
  • D4: fixed in 3396e93f0. ListCommit carries names: true from listCommit alone, and AccountDevices.commit replaces the placeholder only then; a snapshot commit (a PC that follows no list) keeps the labels. Test in account-devices.test.ts "the names of the rows" (fails on bee15c50f).
  • D3: accepted as is, said in docs/account-list.md (a row a person named Device or cleared takes the list's name), with a line on how names are asked for and that a PC following no list keeps its labels.
  • D5: not in this PR, on the follow-up list (bidi and zero-width characters in a list label, client and PC alike).

ListFollow.settled() now also waits for a naming round under way (it is used by tests and one QA script only). Split check at 3396e93f0: typecheck clean; 445 pass across the touched and neighbouring account test files, the conventions and changelog-fold tests; 62 pass in the other tests that use a list commit.

@devswha

devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Closure check by the independent reviewer at 3396e93

The reviewer re-ran its probes and the new tests on the two fix commits. D1 to D4 are closed (the removal probe now reads the removal in 30 ms; one wraps call per epoch per round), D5 stays a follow-up as ruled, and the fix reads no removal late by any other path.

I read the two new commits (3fe5c7d, 3396e93) in a fresh detached worktree, since removed.
Ran:

  • probe zz-rv-names.test.ts, updated in ~/.cache/ovis-tmp/rvfix/probes/;
  • list-pinned.contract.test.ts -t name: 11 pass;
  • account-devices.test.ts: 18 pass.

Per finding:

  • D1: CLOSED.
    • keysOf, the wraps call and the opens now run outside this.turn (nameDevices). The turn is taken only for a
      short step that stores the names and settles.
    • Removal probe with 4 named entries and the wraps route failing: before, beforeSession(5000) waited 5000 ms and
      the victim was still "drive". Now it waits 30 ms and gives role() === null.
    • Wraps calls for 4 entries in one epoch: before 4, now 1. A round keeps what it learnt per epoch.
    • The PR adds the removal probe as a test, with the route held and then failing.
  • D2: CLOSED.
    • An entry is marked tried only inside the store step, and only when decided: opened, no sealed name, or no wrap
      held for its epoch.
    • The store step gives up only when the list or the round is another (deviceNames !== names or a different list).
      A copy replaced within the same list no longer drops the round. Probe: with a sign-in in a later second before
      the round stores, the row is now named (Dana's tablet; before, Device for good).
    • A failed service sets namesRetryAt to now plus 60 s. Probe: still Device 1 s later; named after 62 s and a pull
      with no change to the list, so the retry does not need a list change.
  • D3: CLOSED as ruled. A row a person named Device, or cleared, still takes the list's name; the docs now say so
    (account-list.md:2314-2316).
  • D4: CLOSED. The replacement now needs list.names === true (account-devices.ts:305), which only listCommit
    sets (list-follow.ts:2878). It reaches the store through the { ...rows } spread in settle. A snapshot commit
    keeps today's labels, as the new account-devices.test.ts case shows.
  • D5: OPEN as ruled (follow-up): isListLabel still allows bidi and zero-width Cf characters.

What the fix itself could break:

  • A removal read late by another path? None found.
    • Nothing in production awaits ListFollow.settled(), the one place that now also waits for naming; the other
      settled() hits are other classes in codex.ts and index.ts.
    • The store step is synchronous apart from the settle() it shares with every commit.
  • A loop of wraps calls? None.
    • One round at a time (namingNow).
    • A follow-up round runs only after a round that decided something and did not fail. Decided entries go into
      tried, so each follow-up round asks only rows not tried yet, and the rounds end.
    • A failed round waits 60 s, and the next round starts only from a later settle.
    • A round whose keysOf returns null marks nothing and stores nothing. It costs only a local key read per
      settle, never a service call.
  • A name stored for the wrong key? No.
    • The name and the key come from the same entry at row.seq of the state the round began with.
    • The open is bound to (list, seq, epoch), and names are stored only while the copy is of the same list.
    • Exotic case: if the same list id is re-read with another history (a fork), tried is keyed by seq and may skip
      the new entry at that seq. It never names the wrong key.

New notes (no BLOCKS MERGE or SHOULD FIX):

  • NOTE (traced): keysOf now runs outside the turn, and its side effects (held, heldFor, keysState, error)
    land whenever it returns.
    • For the same relay identity they write the same values.
    • If the identity is reset during a round, it can leave the old server's keys in held. That fails closed:
      allowRefusal answers unavailable (:1586), and ensureCopy reads the keys again because heldFor differs
      (:2295).
    • Errors other than ListKeysError from keysOf are now swallowed by the round's catch. Before, enqueue
      reported them in error.
  • NOTE: "No wrap held for the epoch" counts as decided. A wrap that a member gives the PC later is not used for
    entries already tried until the PC restarts or follows another list. This matches the docs ("cannot open … leaves
    the row named Device").

@devswha

devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Closed in favour of #4723, which merges this branch together with the other fixes the signed-list staging QA asked for. Nothing of this pull request was dropped: #4723 is main with these branches merged in. The reason is CI capacity: twelve separate runs and twelve merges, each waiting for Fast checks on a new base, had filled the self-hosted runners for every session.

The description, the tests and the review of this change stay here; #4723's table links back to it.

@devswha devswha closed this Nov 25, 2026
@devswha
devswha deleted the fix/list-qa-pc-device-names branch November 25, 2026 13:05
devswha added a commit that referenced this pull request Nov 25, 2026
…to the list (#4741)

## Summary

A PC added to its account's signed list after the list's epoch moved
(after a removal) showed the devices let in before it came as `Device`
in Settings › Devices and PCs, for good, also after a restart
(signed-list staging QA, the pinned Mac).

A newcomer to the list is given wraps of the epoch it comes in at and of
later ones only. A name sealed in an earlier epoch is read through the
links the list's `epoch` entries carry: each epoch key encrypts the one
before (docs/account-list.md, "epoch_link"). Devices already read names
that way (`src/lib/account/listNames.ts` `openEpochs`). The PC's naming
(`server/account/list-follow.ts`, from #4714) used only a wrap of the
exact epoch and never walked the links.

`epochKeyOf` now handles an epoch before the PC's own wraps:
- it opens the nearest later wrap the PC holds;
- it walks back to that epoch with the shared `walkBack`
(`shared/account-list-seal.ts`), checking each key against the
commitment in the PC's verified copy;
- it keeps every key the walk reaches.

The devices' `openEpochs` lives in `src/`, which the server does not
import, so the shared primitive is reused and nothing is moved. What the
walk cannot reach (a link missing, or one that does not open) stays
final, with no error and no further call, as before.

Also in this PR:
- the test helper `TestList` gains `nextEpoch()` (a good or a broken
link) and seals under its current epoch;
- docs/account-list.md corrects a sentence that said this would need the
account service;
- the names changelog fragment says it.

## Who can open a PC

Nothing changes. This is names only:
- The walked keys go into the cache the PC opens names with.
- That cache's sealing callers seal and wrap only under the current
epoch, whose key is still the PC's own opened wrap.
- Nothing that decides admission or removal reads these keys.
- No new call to the account service is made (the walk is local crypto,
bounded by `LIST_EPOCH_WALK_MAX`), and nothing runs on the follower's
turn.

## Review

An agent's independent review stands in for the human review. It read
this change at `9d250943f`, before the rebase onto main; the rebased
commit is the same change (the diffs' added and removed lines are
identical). All four questions were closed:
1. Names only.
2. Each walked key is checked against the PC's own verified copy.
3. A removed device is never named, and no removed member's label comes
back.
4. No new call, loop or work in the follower's turn.

## Validation

`bun run check fast` and the browser batteries did not run locally. On
the rebased head (on main `e897294ac`):
- `bun run typecheck` is clean.
- Every test file under `server/account/` and `server/relay/` ran one
file per process, three at a time, with a 900 s limit per file. The same
run covered `scripts/conventions.test.ts`, `src/conventions.test.ts`,
`server/conventions.test.ts` and `scripts/changelog-fold.test.ts`: 143
files.
- 136 passed in that run. Seven failed only under the parallel load and
each passed when run alone afterwards:
- six with "herdr session.snapshot timed out after 10000ms":
`step2-upgrade.contract`, `step2-upgrade-turnover.contract`,
`step2-upgrade-v056.contract`, `unknown-key-signin.contract`,
`waiting-block-list.contract`, `witness.contract`;
- one timing test at 10.6 s: `server/relay/session-ws.contract.test.ts`,
"drops a key not yet typed when the phone closes the socket".

The two new tests in `server/account/list-pinned.contract.test.ts`:
- "a PC added after the epoch moved names a device sealed in an earlier
epoch" fails without the change;
- "a link that does not open leaves the row Device for good" pins the
final rule.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Not merged until the owner says so

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant