Skip to content

docs(hpc): add a remote-control chapter, replace the desktop/TUI section - #1296

Merged
jiangzhuqing000 merged 1 commit into
mainfrom
docs/hpc-remote-section
Oct 22, 2026
Merged

jiangzhuqing000 merged 1 commit into
mainfrom
docs/hpc-remote-section

Conversation

@jiangzhuqing000

Copy link
Copy Markdown
Collaborator

Summary

The HPC campus guide (docs/hpc-westlake-guide.zh-CN.md, Chinese-only by design, distributed to 西湖大学 HPC users) covered desktop and TUI only. Two changes:

  • Chapter 3 rewritten as 远程控制(was 「桌面端与 TUI 的关系」). The old three bullets about configs/data move into 3.3 unchanged; the chapter now covers:
    • 3.1 手机远程:FutureOS App pairing via the desktop's 远程 page (QR, five-minute code, unpair to revoke), what the phone can do, and the constraint that tools run on the controlled machine.
    • 3.2 桌面远程:another computer controlling the desktop, plus the HPC-specific server case — host mode (future host in tmux on the login node) so a phone can reach server sessions without X11 forwarding or a desktop UI. Links to docs/guide/desktop-host.zh-CN.md.
    • 3.3 配置与数据:the original desktop/TUI config relationship bullets, plus one new line — remote control does not change that relationship, the phone operates the already-configured sessions on the controlled machine.
  • FAQ gains two rows: pairing code failures (environment match, toggle, manual paste) and a host-mode process lost to SSH disconnect (use tmux). Doc version bumps to v1.4.

future host is the current command name (the headless entry was renamed in #1292, headless remains a hidden alias).

Note on check-docs

make check-docs flags two pre-existing conditions on origin/main for this file, not introduced here:

  1. bilingual pair missing: docs/hpc-westlake-guide.zh-CN.md (expected docs/hpc-westlake-guide.md) — the file is Chinese-only by audience. BILINGUAL_PENDING is currently an empty set with the comment "keep the set empty so any future scope registers its pending entries here explicitly", so a reviewer may want to either register the pending pair or add an English side.
  2. The file itself is untracked on origin/main (it lives only in the user's working tree); this PR also puts it under version control.

Local link check passes: the one new local link targets docs/guide/desktop-host.zh-CN.md, which exists on this branch.

Test plan

  • python scripts/docs/check-docs.py --scope docs/hpc-westlake-guide.zh-CN.md — only the pre-existing bilingual-pair diagnostic; the local link resolves.
  • Chapter numbering, FAQ rows and the version header verified by reading the rendered markdown.

The guide covered desktop and TUI only. Chapter 3 now covers remote
control instead of restating where the configs live: phone -> desktop,
and another computer -> desktop (including the server host mode with
future host in tmux for HPC nodes). The config/data notes move into
3.3 unchanged, and two FAQ rows cover pairing failures and a host-mode
process lost to SSH disconnect. Doc version bumps to v1.4.
@jiangzhuqing000
jiangzhuqing000 enabled auto-merge (squash) October 22, 2026 03:19
@jiangzhuqing000
jiangzhuqing000 merged commit 3b7b4a0 into main Oct 22, 2026
10 checks passed
huichen added a commit that referenced this pull request Oct 22, 2026
…ng (#1306)

#1296 added docs/hpc-westlake-guide.zh-CN.md without its English pair and
without registering the debt, so every unrelated change on main reported
"bilingual pair missing" from make check-docs and had to explain it away.
BILINGUAL_PENDING exists for exactly this state: an entry is a warning in an
ordinary run and a hard failure under --strict-pending, which still fails here.
huichen added a commit that referenced this pull request Oct 22, 2026
…ried

`docs/hpc-westlake-guide.zh-CN.md` (#1296) was the repository's only entry in
`BILINGUAL_PENDING`: a Chinese-only guide for one institution's cluster, which
nothing else in the docs refers to. Rather than write an English pair for it, the
page goes and the pending entry with it, so `make check-docs` stops being a
standing red that every unrelated change has to explain — `--strict-pending` now
passes with no debt left.

The gate's third step also failed on Windows, for a reason unrelated to docs:
`check-channel-matrix.py` read the matrix, the registry and each provider with
`read_text()` and no encoding, so a machine whose locale is a legacy code page
could not decode the UTF-8 sources at all (`UnicodeDecodeError: 'gbk' codec …`).
All three reads now state `utf-8`, the same way `check-docs.py` already does.

`BILINGUAL_PENDING` stays a dict literal rather than becoming `set()`:
`scripts/tests/test-check-docs.py` inserts its debt fixture after the opening
brace, and 35 docs-gate regression tests pass unchanged.
huichen added a commit that referenced this pull request Oct 22, 2026
…tations, portable build steps (#1308)

* test(agent): give the shell timeout test room for PowerShell startup

`timeout_retains_partial_output_without_fabricated_exit` starts PowerShell on a
one-second deadline, so on a loaded Windows runner the window can close while
PowerShell is still starting up and the test reports the timeout property as
broken. It failed that way on 2026-10-22 (run 39779594808, `Rust Windows test /
agent`) on a commit that passed on macOS and Linux.

Nothing in the product changed: the same four assertions, the command still
sleeps far past the deadline, and POSIX keeps its one-second window. Only the
Windows deadline moves to 8s — eight times the window that lost, which is the
only measurement the failure gives (the cold start did not fit in 1s) — and the
failure message now reports the tool's own duration, the wall clock and the
output actually captured, so a slow shell start and dropped output stop looking
identical in the log. A new upper bound fails the test if a call returns well
past its deadline, which a never-returning timeout would otherwise turn into a
slow pass.

* fix(mobile): keep a standby desktop's settings out of reach

A machine another device drives refuses every command before a handler runs, so
the device page's five rows opened a stack of dead ends: greyed-out switches
under a "could not read the desktop" line, and approval radios that only asked
whether the machine was online — a tap wrote a command the host answers with
`superseded`.

Those rows are no longer drawn while `presence.control === "standby"`: the
banner above them (holder, reason, takeover) is what the page keeps, and the
machine's name and icon stay editable because they are this phone's own record
of it. A level already open when control is taken gives way to that banner and
returns in the same render once this phone has the machine again, and the
approval write is refused in its handler rather than only at the route.

* fix(mobile): align the scheduled-task form with the desktop's

The phone's editor was an approximation of the desktop's, and the differences
were load-bearing:

- A new task started on "manual", which is the one trigger that never fires
  (`TriggerKind::Manual` has no next due time) — and the phone has no run-now
  button either, so the task it built by default could not run at all. New
  tasks now pick a trigger and are refused without one; a task that is already
  manual keeps its option, so an edit round-trips.
- "Weekly" was a text field asking the user to spell `mon, fri`; it is the same
  seven toggles the desktop draws, stored in week order.
- A one-off's date was a text field whose `2026-12-24` placeholder read as a
  date already chosen — the trap the desktop removed with a picker. `DateField`
  is the same choice in three chip rows, with days that follow the month.
- The time zone sat outside the trigger and offered four hard-coded names. It
  belongs to the schedule, so it now sits inside the trigger and only for a
  mode that reads a clock, listing every zone the runtime knows, with a search
  field; a zone the task already carries is kept even if the list lacks it.
- The list row rendered `nextDueAt` on the *phone's* clock while the desktop
  rendered it on the task's, so the two clients named different wall clocks for
  the same run. `list_tasks` now carries the row's `timezone`, and the row is
  formatted on it.

Backing out of the form also kept discarding the draft: the system gesture and
the header arrow are how a phone leaves a screen, and an interrupted form is
exactly why the draft exists. Only Cancel and a save that landed clear it now.

* docs: drop the Westlake HPC guide and close the bilingual debt it carried

`docs/hpc-westlake-guide.zh-CN.md` (#1296) was the repository's only entry in
`BILINGUAL_PENDING`: a Chinese-only guide for one institution's cluster, which
nothing else in the docs refers to. Rather than write an English pair for it, the
page goes and the pending entry with it, so `make check-docs` stops being a
standing red that every unrelated change has to explain — `--strict-pending` now
passes with no debt left.

The gate's third step also failed on Windows, for a reason unrelated to docs:
`check-channel-matrix.py` read the matrix, the registry and each provider with
`read_text()` and no encoding, so a machine whose locale is a legacy code page
could not decode the UTF-8 sources at all (`UnicodeDecodeError: 'gbk' codec …`).
All three reads now state `utf-8`, the same way `check-docs.py` already does.

`BILINGUAL_PENDING` stays a dict literal rather than becoming `set()`:
`scripts/tests/test-check-docs.py` inserts its debt fixture after the opening
brace, and 35 docs-gate regression tests pass unchanged.

* fix(build): set the docs-test bytecode flag without a POSIX-only prefix

`make test-docs-check` could not run on Windows at all:

    PYTHONDONTWRITEBYTECODE=1 python3 scripts/tests/test-check-docs.py
    'PYTHONDONTWRITEBYTECODE' is not recognized as an internal or external command

That `VAR=1 command` prefix is POSIX shell syntax, and a Windows make runs
recipes through cmd.exe, which takes the first word of the line as the program
to run. The flag is now a target-specific exported variable, which make places
in the recipe's environment whatever the shell is — and, unlike a bare
`python3 -B`, the interpreter's own child processes inherit it, which is what
this test needs for the trees it builds and runs.

`test-screenshot-harness` sets the same two flags the same way; it had the same
error, three lines below.

The Makefile stays compatible with the GNU Make 3.81 on this machine, where
target-specific `export` is supported (verified, along with it being scoped to
its own target and inherited by a grandchild process).

* fix(apps): a cancelled invitation is revoked, a detached peer leaves, and the task form names zones

Four reports from the desktop defect list, each traced to a cause in the code.

- Add device, then Cancel: the invitation stayed on the platform. An
  unclaimed invitation is not in the pairing book — it enters at the handshake
  — so `unpair_slot` found no credentials and revoked nothing, and the platform
  row kept one slot of the per-desktop cap until its nonce expired. Five
  presses of add and cancel filled that cap with codes nobody could claim, and
  the sixth press was refused over a limit the user had never spent on devices.
  The discard now queues a revoke by the only identifier an unclaimed
  invitation has, its pair id, on the same compensation lane an unpair uses;
  `remove --all` clears them the same way. Delivery is queued rather than
  awaited, so closing the window never waits on the platform.

- The other computer unpaired this one, and its row stayed. The desktop client
  never read the host's own notice: the presence payload's `unpaired` (and
  `disconnected` with that reason) went into `apply_presence`, which only looks
  at `control`. The row therefore survived until somebody pressed Connect and
  the platform refused it. The list now drops the pairing — and its
  registration — when the host says so, and when the platform's own answer to
  a connect is `credential is invalid or revoked`. A machine that is merely
  asleep is left alone: forgetting it would silently unpair a computer that
  comes back when it wakes.

- Take over: "LNA-AL00 is in control" did not say what to do. The row reads
  "Another device (LNA-AL00) is in control"; Settings stays disabled with the
  reason on hover, which #1300 already did.

- Settings → Keyboard shortcuts: the two paragraphs naming the levels and the
  terminal's rule are gone. What is left is the search box, the reset button
  and the list.

- Scheduled tasks, time zone: a picker of four hundred English identifiers
  named the region and nothing else. Each row is now the zone's name in the UI
  language plus its offset (`中国时间 · UTC+8`), this machine's zone and the
  common ones lead, the rest run west to east, and a search box answers a
  name, an identifier, a city or `+8`. The stored value stays the IANA name,
  so changing the interface language never rewrites a schedule.

Docs record the two rules that changed: a discarded invitation is deleted on
the platform, not just forgotten here, and a zone is read in the reader's
language while the identifier remains what is saved.

* fix(build): pass the proto regeneration flag without a POSIX-only prefix

`make generate-proto` could not regenerate anything on Windows: the recipe wrote
`REGENERATE_PROTO=1 cargo build`, a POSIX shell prefix that cmd.exe reads as the
program name, so the build script never saw the variable and the targets failed
with `'REGENERATE_PROTO' is not recognized as an internal or external command`.

It is now a target-specific exported variable, which make puts in the recipe's
environment whatever the shell is. Verified on Windows: the build script now
receives it (it gets past its "not requested" early return and looks for protoc,
which it never did before), and a full run with a temporary protoc on PATH
regenerated both wire files byte-identically — `git status` shows no change
under packages/rpc/src/generated or channels/src/generated.

* fix(screenshots): make the orphan sweep work on Windows

The screenshot harness reaps browsers and `future-shot-` profiles that killed
runs left behind, and on Windows it could not: `list_processes()` shells out to
`ps -Ao`, which does not exist there, so it returned an empty list and the sweep
was a silent no-op — every interrupted run kept its browser and its 130-160 MB
profile, exactly the defect the sweep was written for.

The listing now comes from `Get-CimInstance Win32_Process` on Windows (as JSON,
asked for as UTF-8 so a non-ASCII temp path is not mangled), because the two
fields it needs — the parent id and the command line — are in neither `ps` nor
`tasklist`.

Orphan detection had the same POSIX assumption: it required `ppid == 1`, which
is what re-parenting to init looks like. Windows does not re-parent, so an
orphan there still names its dead launch. `parent_is_gone` therefore accepts
either form — re-parented to init, or a parent that is no longer in the listing
— and still cannot select a browser whose capture is running.

`os.kill(pid, signal.SIGTERM)` is the same call on both platforms; on Windows it
is `TerminateProcess`, which is the outcome the sweep wants for a browser whose
run is already gone. The SIGTERM *handler*, on the other hand, can never run on
Windows (`os.kill` terminates the process outright), so it is now POSIX-only and
says so — there the startup sweep is the guarantee, and `ReapTests` exercises it
on both platforms.

The tests lost two POSIX assumptions of their own: `process_absent` probed
liveness with `os.kill(pid, 0)`, which on Windows neither raises for a dead pid
nor sends anything (it could only ever time out), so existence now comes from
`OpenProcess`; and the signalled-exit case is skipped on Windows with the reason
above rather than silently failing. 17 tests pass here, 1 skipped.

* test(remote): decide a phone unpair's epoch before its cleanup, not by racing it

`an_unpair_whose_epoch_was_revoked_leaves_the_pairing_alone` failed about one
run in five. It asserted that a phone-initiated unpair leaves the pairing alone
after its epoch was revoked, and set the revoked state *after* the command
returned — on the premise that the test's current-thread runtime had not
scheduled the spawned cleanup yet.

That premise is false. The supervisor's executor is `DesktopExecutor`, which
spawns on the process-wide runtime, so the cleanup runs on another thread
concurrently with the test. Whichever side the scheduler picked decided the
outcome: with a live epoch the cleanup legitimately cleared the pairing, and the
assertion fired against behaviour that was correct.

The two halves now have their own tests, because they need opposite timing. The
acknowledgement is asserted through the command, which is what proves that path
reaches the cleanup at all; the guard is asserted by calling the same cleanup
under an epoch revoked *before* it starts, where the answer is decided rather
than raced. Both layers of the guard are described where they live: the inner
one (`CommandRuntime::unpair_slot` refuses a dead generation) is the guarantee,
the outer early return only keeps `remote_server_stopped` out of the log.

Verified by removal: with both guards gone the new test fails every run, so it
pins the invariant rather than the absence of a race. 20 consecutive runs of the
pair pass, and no run has failed since.

* test(shots): capture the three surfaces this change touches

The screenshots are the evidence, so the fixtures that produce them belong in
the repo: without the scenario rows and the mock state they cannot be re-run.

- `remote-peers-held`: a paired computer another device drives. The mock peers
  gain the `control`/`holder` fields the real peer summary carries — absent is
  still "no statement" (an older host), which is what every earlier scenario
  reads — and `?peers=held` marks the first one as held.
- `settings-shortcuts`: the shortcut page without the two paragraphs, asserted
  by their own text so a future edit that puts them back fails the capture.
- `tasks-timezone-picker` / `tasks-timezone-search`: the zone list in Chinese
  with offsets beside each name, and the same list narrowed by `+8`.

The time-zone trigger also gains an accessible name: its content is the chosen
zone ("中国时间 · UTC+8"), which does not say what the control is for, and a
button a scenario cannot address by name is a button whose accessible name is
missing.

* fix(desktop,ci): stop a forked child from reading as an active update; retry a stalled apt mirror

Two independent causes of the red required checks on #1308.

`Operation::begin` reported `Another update transaction is active` in CI for a
case that had started no update (run 39802801818, `Rust Linux test / desktop`).
The lease is a file lock, and this process spawns children constantly — the CLI
runner, the installer, terminal shells — so a child forked by another thread
inherits every descriptor that is open at that instant, this lease among them,
and keeps the lock until it execs. The refusal is now reported only after a short
settle window (250 ms in 10 ms steps); a genuinely concurrent installation holds
the lease for minutes, so the outcome for it is unchanged, while a fork-to-exec
gap is microseconds.

`install-apt-packages.sh` rewrote the mirror only when `apt-get update` failed.
A *stalled* download therefore had no fallback at all: `Acquire::http::Timeout`
bounds the socket rather than the transfer and `Acquire::Retries` retries an
error rather than a connection that opens and then crawls, so a run sat on
~2.5 MB from the Azure mirror until the 180 s budget expired and the job died
with 124 — three jobs at once in that run. A failed or timed-out installation now
switches to Ubuntu's public archive and tries once more, as the update step
already did.
@huichen
huichen deleted the docs/hpc-remote-section branch November 20, 2026 01:09
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