Skip to content

feat(remote): one Remote page for both directions, and stop calling it a phone - #965

Merged
huichen merged 1 commit into
mainfrom
feat/remote-hub
Oct 10, 2026
Merged

huichen merged 1 commit into
mainfrom
feat/remote-hub

Conversation

@huichen

@huichen huichen commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

What this does

The rail had two entries a word apart — "Phone Control" and "Remote Desktops" — and neither label said which way the connection went. Neither was even accurate any more: a computer can connect to this machine, and this machine can connect to a computer.

There is now one entry, "Remote", and the page leads with the distinction the user actually needs — this machine's own conversations are in Chats; below are the connections to other devices — then splits by direction:

Direction What it is
Let other devices connect here pairing code + QR, connected devices, auto-connect, unpair
Connect to another computer paste a link, paired computers, per-computer settings

Direction is a difference a reader gets right on the first pass; a device name is not, once either side can be a computer.

The wording was wrong in seven places

The "phone" framing was a leftover from when the only client was a phone. After the desktop-client role landed (#955–#964), these were simply false:

  • the rail label and both page titles;
  • the description ("let a phone remotely take over");
  • the QR hint and the unpair confirmation ("this phone will no longer control this computer");
  • the note ("phone control requires this computer to stay on");
  • the settings tab name.

All are now device-neutral. The QR hint is the one exception, deliberately: the QR is genuinely phone-only, because a desktop pairs by pasting the code. So the hint names both paths — scan it on a phone, copy it into another computer — instead of pretending one exists.

Two consequences that are not cosmetic

  1. The entry is always shown. It used to be hidden unless signed in, because the host half issues its pairing code through the FutureOS service. But the client half needs no account at all — so hiding the entry hid a feature that worked. The section that does need an account says so itself, inside.
  2. Signing out no longer throws the user off the page, for the same reason: the list of computers this one connects out to is exactly what a signed-out user may still be looking at.

The auto-connect preference moved here from Settings, which had it on a page of its own. That tab is deleted rather than duplicated — one place to look for it, not two.

Found while testing this: unpairing was impossible

The confirmation dialog was rendered inside the list branch, while the button that opens it lives on that computer's settings page. The two could never appear together, so unpairRemotePeer was never reached: the user pressed Unpair and nothing happened.

This is the second defect of exactly this shape in this feature (#961 fixed the hub/entry duplication that made a value unreachable); both were found by writing the test that drives the path rather than by reading the code. The dialog is a modal and now sits outside both branches, with a test per path: confirm, cancel, and Escape.

Tests

17 new tests; 3483 desktop tests pass. tsc --noEmit, full eslint (0 errors), stylelint, and the shared shell-projection test all pass — the same scope CI runs. 0 uncovered lines added by this branch, including the previously-uncovered parts of the client section that this PR reindents and now covers properly (pairing, disconnect/reconnect, unpair confirm/cancel/Escape, the settings page and its change callback, the transcript's callback routing).

Assertions are written to be discriminating where it is easy to be fooled:

  • Two different controls answer to "Connect" (the pairing form's and an offline computer's row) and to "Unpair" (the row's and the dialog's), so the helpers are scoped to the row / the dialog. Picking the first match would click a disabled button and pass by doing nothing — which is exactly how the unpair bug hid.
  • Headings must not name a device; the explanatory sentences may. A phone is one of the devices that can connect here, so removing it from the prose would be less clear, not more neutral.
  • A failed pairing keeps the link in the box, and a failed revoke is reported rather than swallowed.

Scope note

No Rust changes — this is the desktop UI and its strings. The client-role backend, the transfer transport, and the file browser all landed in #955–#964.

Related

#955 · #956 · #957 · #958 · #959 · #960 · #961 · #964

…t a phone

The rail had two entries a word apart — "Phone Control" and "Remote Desktops" —
and neither label said which way the connection went. Neither was even accurate
any more: a *computer* can connect to this machine, and this machine can connect
to a computer. The wording was a leftover from when the only client was a phone,
and after the client role landed it was simply wrong in seven places (the title,
the description, the QR hint, the unpair confirmation, the note, and the
download link).

There is now one entry, "Remote", and the page leads with the distinction the
user actually needs — this machine's own conversations are in Chats, and below
are the connections to other devices — then splits by **direction**: "Let other
devices connect here" and "Connect to another computer". Direction is a
difference a reader gets right on the first pass; a device name is not, once
either side can be a computer.

Two consequences that are not cosmetic:

* The entry is **always shown**. It used to be hidden unless signed in, because
  the host half issues its pairing code through the FutureOS service — but the
  client half needs no account at all, so hiding the entry hid a feature that
  worked. The section that does need an account says so itself.
* Signing out no longer throws the user off the page, for the same reason: the
  list of computers this one connects out to is exactly what a signed-out user
  may still be looking at.

The auto-connect preference moves here from Settings, which had it on a page of
its own; that tab is gone, so there is one place to look for it rather than two.
The QR hint now names both pairing paths — a phone scans the code, another
computer copies it — because the code is what a desktop pastes.

Found while testing this, and fixed here: **unpairing a computer was
impossible**. The confirmation dialog was rendered inside the list branch while
the button that opens it lives on that computer's settings page, so the two
could never appear together and `unpairRemotePeer` was never reached. The dialog
is a modal and now sits outside both branches.
@huichen
huichen enabled auto-merge (squash) October 10, 2026 04:01
@huichen
huichen merged commit 1b3b83c into main Oct 10, 2026
12 checks passed
auto-merge was automatically disabled October 10, 2026 04:05

Pull Request is not mergeable

@huichen
huichen deleted the feat/remote-hub branch October 10, 2026 04:05
huichen added a commit that referenced this pull request Oct 10, 2026
…t behind (#982)

The client role landed over eighteen PRs and left no trace in `docs/`: neither
`CONNECTION.md` nor `PRODUCT.md` mentioned that a Desktop can connect *out*, and
both still framed the domain as phone-only. `CONNECTION` calls itself the single
maintenance location for this domain, so a reader following the repo's own
convention would have concluded the desktop client could not exist.

Added §2.2.2 (both languages): the two roles in one process, the handshake's
identity fields and why identity is not a capability, `remote_peers.json` being
separate from the host's book and why, the merged list and the `lastMessageAt`
key it needed, what is hidden rather than shown as a dead button, the capability
alignment with mobile, and the three known limitations stated as limitations
(host-side single slot, mobile's read-only catalogue observers, device
identification needing a newer host).

Corrected two claims that had stopped being true: the rail entry is always shown
(connecting out needs no account), and the feature is no longer phone-only.
`PRODUCT`'s §5.3 now says what the two directions are for.

Four things the audit turned up, all mine:

* `hiddenCount` (#955) was never called — the filter selects rows, nothing
  reports how many it withheld. Deleted, with its assertions replaced by the
  filter behaviour itself.
* `forgetRemoteToolTargets` (#974) was never called either, so the fetched
  tool-argument cache was never dropped and grew for the life of the window. Now
  wired into leaving a conversation, which is where the doc always said it went —
  and the test asserts a *re-read*, because dropping the cache would be wrong if
  nothing refetched.
* `RemoteConversationSettings` computed a refusal message, and commented that the
  user "gets a value that snapped back **and a reason why**" — but never rendered
  it. The hook's tests asserted on the state, not on the screen, so the reason
  reached nobody: the user watched a setting revert with no stated cause. Now
  rendered as an alert beside the pickers (mutation-checked: hiding it fails the
  test).
* Four translation keys (`toolRunning`, `loadOlderFailed`, `providersHint`,
  `newConversationHint`) were superseded by later changes and left behind, plus
  `pairedDevices`, which I wrote in #965 and never used. Removed.

Also verified: `thinkingLevel.*`'s six keys are built dynamically
(`t(\`thinkingLevel.${level}\`)`) and are not orphans, and the four orphan keys in
`remote.json` (`connectedAs`, `reconnectingAs`, `connectionHint`,
`agentUnavailable`) predate this work (#123, #242, #554) — left alone.

`make check-docs` reports the same failures before and after this change
(whitelisting of `agent/src/prompt/*.md`, and `docs/architecture/tasks.md` whose
Chinese pair another in-flight branch has not written yet); none of them comes
from these four files.
huichen added a commit that referenced this pull request Oct 11, 2026
… up (#983)

* fix(remote): what rendering the client role's screens for real turned up

The screenshot harness renders the real app (real CSS, real bundle, real input
events) and had not been run against this feature — there was no scenario for any
client-role screen. Running it found six defects, one of them mine from the first
PR and none of them visible to the jsdom suite.

**1. The harness was rendering blank pages, for every scenario.** `remote_peer_list`
was read straight into React state, so a backend that answers `null` — the harness
mock does, for a command it does not implement — put `null` into `peers`, and the
first screen that rendered it (`peers.map`) threw during render and took the
*whole application* down. Not just the remote screen: every capture since #955
produced a white rectangle, and nobody noticed because no scenario runs in CI.
Validated at the helper boundary now (an empty list is the honest reading of "no
answer"), with a test.

**2. A turn that ran several tools showed only the first.** The transcript did
`blocks.find(tool_call)`, so a turn that ran `read` then `shell` rendered one row —
and the second call's arguments were never fetched, so the line that says what the
machine actually ran was simply missing. One row per call now, each fetching its
own target, with the fixture updated to a two-call turn (the old fixture had one
tool per turn, which is why the tests agreed with the bug).

**3. The local conversation tree disappeared in merged mode.** Merged mode turns
on as soon as *any* host is connected, and it passed neither `depth` nor
`hasChildren` to the local rows: forks rendered as roots, with no indent and no
fold toggle, so a user with a host connected lost their tree. The rail now keeps
each local row's place, and collapsing a parent hides its forks exactly as the
local list does — a toggle that renders but does nothing would have been worse
than no toggle.

**4. The client direction's explanation was printed twice** on the Remote page:
the hub renders it as the section subtitle and the section rendered it again. The
host half had been fixed in the same PR that introduced this; only the client half
was missed.

**5. A button's label wrapped into two stacked lines.** The host-settings "保存"
button measured 44×32 with the label on two line boxes (保 over 存) — the shared
`Button` had no `whitespace-nowrap`. Now it does, with a test; a control whose
label is unreadable is not a control.

**6. The device selector had no accessible name.** Its visible name starts with a
decorative glyph, so the control's accessible name was the emoji — unreadable to a
screen reader and unaddressable by label. `aria-label` added.

**Verified as *not* defects, by measurement rather than by eye.** A visual read
claimed the remote conversation's header overlapped its compress button and that
the button contained an overlapping icon. Measured: the header does not overflow
(`scrollWidth == clientWidth`) and no two children's boxes intersect; the button
renders no icon at all (it is `{t("compact")}` and nothing else). Both claims were
artefacts of a magnified crop, and I left the code alone.

**Two scenarios were also broken** by the #965 rename of the rail entry — they
still tapped "手机遥控" — which is what a scenario file nothing runs in CI does.

**New scenarios (desktop):** `remote-hub`, `remote-merged`, `remote-device-picker`,
`remote-conversation`, `remote-host-settings`, `remote-host-tasks`, each with `eval`
assertions against the rendered DOM: both directions named, this machine's and the
host's conversations interleaved, a row naming its host, a remote composer saying
where the message runs, tool targets read back, the host's model in the picker, no
API key anywhere in the UI, and no duplicate explanation. The harness's desktop
mock gained the client-role commands (peers, catalogues, workspaces, the routed
`remote_peer_request` family) and a two-host fixture — one connected, one
disconnected, because "a host that is not reachable" is a state the list has to
survive.

11/11 scenarios captured (7 new, 4 pre-existing as a regression net) with every
assertion passing, and 3679 tests with 0 uncovered lines added.

* style(shot): drop the trailing blank lines eslint rejects

CI lints `shot/**` as well as `src/**`; my local run only covered src, so this
reached CI. Running the project's own lint script (which is what CI runs) is the
scope that matters — the same lesson as clippy's --no-default-features earlier.
huichen added a commit that referenced this pull request Oct 14, 2026
#1074)

Opening 远程 gave a page that scrolled: the lead, the host card and the client
card came to 833px in a window with 812px of room, and the card the user came for
— the machines this computer connects out to — was the part below the fold. At
the smallest window the app allows (1024x720) it was 181px over.

Two things took the room, and neither was information:

- The pairing form sat open at 158px — a heading, two sentences about a text box,
  and the box — above the machines, on a card whose content is the machines. It
  is one errand per computer; it is now a row that says 添加桌面 and opens where
  it stands (and folds again after a pairing, since the machine it added is now a
  row below). The instructions are read when the box is in front of the user.
- Two directions on one page is a deliberate design (see #965), but the page had
  its own 24px rhythm inside cards that already have padding and borders. The
  hub's stack is now 16px.

Measured in the rendered app (1280 wide, the demo's two machines):

| | before | after |
|---|---|---|
| the page's own column | 769px | 625px |
| does it scroll in a 860px window | yes, 21px | no |
| at the smallest window (1024x720) | 181px over | 37px over |
| the client card | 456px | 344px |
| the pairing form | 158px open | 52px folded |

`remote-hub` now asserts the two claims the page is about: with the form folded
the page does **not** scroll at its window, and the folded row renders no box but
does carry an affordance. The first fails on the old code with "the Remote page
wants 21px more than the window has" — measured, not eyeballed.

Also covered by unit tests: the row starts folded, opens on click, names the box
for a screen reader once the label that used to sit beside it is gone (`aria-
expanded` is what they read, not a class), and closes after a successful pairing.
302 files / 4057 desktop tests pass; eslint + tsc clean.
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