Skip to content

docs: reconcile the documentation corpus; fix the recurring CI flake sources - #1311

Merged
huichen merged 7 commits into
mainfrom
pr/huichen
Oct 22, 2026
Merged

huichen merged 7 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Reconciles the documentation corpus with the code it describes, and fixes the
remaining recurring CI flake sources at their causes instead of around them.
Most of the diff (95 of 107 files) is documentation; the code changes are a
reply-cache deadline, supervisor retry instrumentation and fixture locking.

Commits

  • docs: reconcile the documentation corpus with the code (977e706)
  • docs: index the gaps the documentation audit left open (be8f68d)
  • fix(tests): stop recurring CI flakes at their causes (b1ace28)
  • fix(tests): count supervisor retries at the retry seam, not accepted sockets (4f0ef3b)

What changed

  • Approval tiers, make test suite count, architecture ownership, goal CLI
    command count, protocol/schema versions and rpc module list now match the
    code; historical narration ("this branch", removed loop group, the retired
    TypeScript RPC client) is gone from the live docs.
  • The remote/host single-flight reply cache carries its own deadline, so an
    expired slot is replaced on read instead of depending on a best-effort
    retirement timer that a cancelled spawn or a fixture's registry reset could
    drop.
  • The supervisor retry test counts increments at the retry seam
    (dispatched == reconnect_attempt_budget()) instead of accepted sockets, and
    re-installing a supervisor retires the previous loop.
  • Two bridge fixtures now hold the HOME fixture lock so they stop clobbering
    the process-global supervisor another test is mid-command on.

Verification

Local, on the pinned toolchain (rustc 1.97.0), at the frozen tip:

  • cargo fmt --all -- --check — clean; cargo fmt --check in
    desktop/src-tauri — clean
  • cargo clippy -p future-agent -p future-channel -p future-cli -p future-host -p future-remote-client -p future-remote-server --all-targets -- -D warnings
    — clean
  • cargo test -p future-agent --lib -- broadcaster — 51 passed
  • cargo test -p future-channel --lib -- qq — 53 passed
  • cargo test -p future-host --lib -- remote_peer — 132 passed
  • cargo test -p future-host --lib -- remote_host::business::tasks — 20 passed
  • cargo test -p future-remote-client --lib — 64 passed
  • cargo test -p future-remote-server --lib -- commands — 7 passed
  • cargo test -p future-cli --test remote_start_refusal — 14 passed
  • npx jest src/screens/__tests__/SessionList.test.ts (mobile) — 78 passed

cargo clippy -p futureos was not run: the GUI dependency build does not fit
the self-test budget, and the only src-tauri change is inside update_journal
test helpers (fmt clean, covered by CI).

Notes

No migrations, no flag or default changes reachable from here; cli/src/main.rs
changes are module-comment text only.

Audited every failed `ci.yml` job in the last 200 runs (48 runs, 144 failed
jobs) and grouped the failures by test. Most were already fixed by #1293,
#1305 and #1309; this is the residual set with an established cause.

remote/host: an expired reply slot is replaced on read, not only by its timer.
The single-flight cache scheduled retirement through the Host executor, and
that path is best-effort: `runtime::spawn` drops the future outright when task
admission is closed, and the registry's timer can be cancelled by a fixture in
the same binary. A lost timer then served a cached reply forever — the test
that waits on the real eviction reported `Elapsed(())` on `Shared host (Windows)`
in runs 39437825835, 39440217807, 39526548081 and 39540018985. `CachedReply`
now carries its own deadline: a read past it replaces the entry, so a retry
executes instead of receiving a retired reply, and the timer is only
reclamation. A slot still executing is never replaced (`prompt` runs for its
600 s TTL), so single-flight is unchanged. The two host fixtures assert the
contract — an expired id re-executes — instead of waiting on the process-global
task registry.

host/remote: the two bridge fixtures that took no lock now hold the HOME
fixture. The control gate consults the process-global `SUPERVISOR`, which every
bridge fixture start re-points at its own pairing, so a fixture with no lock at
all clobbered whichever test was mid-command:
`declared_capability_reaches_the_running_command_loop` received
`{"success":false,"error":"superseded"}` in runs 39724323762 and 39540018985.
With both fixtures holding the lock every bridge test in the binary serialises
on it (the rest already did).

channels/qq: ack the gateway heartbeat when the first heartbeat is *recorded*
rather than after a fixed 130 ms. With a 90 ms interval the ack raced the next
interval on a loaded runner and the gateway reported "not acknowledged" (run
39742523871). The interval is 300 ms and the ack is ordered on the frame, so the
ack has a whole interval to be read.

agent: the no-progress journal failure is eventual (batch window + worker
thread), not synchronous; its 500 ms poll failed once on main (run 39767494038).
Five seconds still fails a journal that never reports.

cli (Windows): a console that goes away with the child is not a delivery fault.
`SetConsoleCtrlHandler(NULL, TRUE)` fails once the target's console is gone, and
the old assertion reported that as a broken Ctrl+C (runs 39576790228,
39474870891). Both calls now treat an already-exited target as "interrupt moot"
— the same rule the attach above them already uses — and still fail loudly while
the child is alive.

mobile: the `SessionList` setup hook renders once and flushes one microtask; the
5 s Jest default measured the machine (`Exceeded timeout of 5000 ms for a hook`,
run 39742523871) while the whole suite runs in one worker. A 30 s budget only
keeps a real hang from wedging the suite.

desktop: `acquire_transaction_lease` reported every `try_lock_exclusive` error
as "Another update transaction is active". Only `WouldBlock` is a concurrent
transaction now; anything else surfaces its own message, which is what the
unexplained first-`begin` failure in a fresh directory (run 39767494038, 1 round
in 6 measured in #1305) needed to be diagnosed.
…sockets

`a_supervisor_gives_up_after_its_window` asserted that the fake broker had
accepted exactly 18 connections. The broker counts sockets, not retries: a
leftover loop reaching the listener, a reused ephemeral port or any extra
dialling source moves that number without moving the retry policy, and a CI run
reported 34 accepted for an 18-attempt budget.

Count the retry itself: the supervisor records one increment immediately before
each `resume`, in the test-only `retry_attempts` map (per host, so two loops for
one host would exceed the budget instead of agreeing with it), and the test
asserts `dispatched == reconnect_attempt_budget()` with the budget's value pinned
at 18. The socket counter stays as a diagnostic and as proof the loop reached the
broker.

Also retire a superseded loop in `install_supervisor_for_test`: overwriting the
map entry left the old loop running with no owner to abort it, which is how a
host could be dialled by two loops. Pinned by
`a_second_install_retires_the_first_retry_loop`.
A full pass over every live document, checking three things: does it match
the code, does it still carry narration about states that no longer exist,
and is anything shipped but undocumented.

Against the code: the approval tier is four values (off/manual/sandbox/auto),
not three, in README, SECURITY, the wiki and desktop/CLAUDE.md;
desktop/CLAUDE.md's Store, Shadow Review and provider-validation paths moved
to host/; `make test` is eight suites and `make fmt` does not format mobile;
the architecture docs gave the task executor to the desktop when it lives in
future-host; the goal CLI has 43 commands in 7 groups, not 41 in 5; the
protocol is 2 and the agent schema 7, not 1 and 6; the rpc crate's module list
was missing twelve modules; auto_connect_remote and skill_recommend defaults
were inverted; the TUI now hosts the agent in-process and the supervision doc
still called that undecided; the wiki's Settings/Remote/Sandbox pages described
a Phone Control tab and a "Pair and start" button that no longer exist;
Bubblewrap compatibility is a runtime probe, not a 0.9.0 floor; the channel and
schema-inventory docs had drifted from their tables.

Against historical pollution: dropped the loop group (removed from the CLI),
the TypeScript RPC client and its npm package, migration notes for
long-finished refactors, "this branch"/"this pass"/PR-time narration, and the
old-layout breadcrumbs in the docs index.

New documents for real gaps: future data backup and recovery had only a
section inside the storage-migration doc; agent/ and host/ had no module map;
scheduled tasks shipped with no wiki page at all. Also added the missing
Models navigation and the testing-record index entries.
- CLI wiki page (en/zh): `## See also` now links the guides behind
  `future host`, `future relay`, `future task` and `future data` — host mode,
  the self-hosted relay, `architecture/tasks.md` and
  `architecture/sqlite-migration.md`. The seven missing command entries and the
  removal of the deleted `loop` group were already in place on the branch.
- Root README (en/zh): one feature-table row states that `future relay
  init|serve` runs the relay behind remote control without a FutureOS account in
  the path (evidence: `cli/src/main.rs:44`, `cli/src/help.rs:36`,
  `cli/src/relay/cli.rs:77-78`, `docs/guide/self-hosted-relay.md`).
- `docs/testing/README.md` + `.zh-CN.md`: the `headless-*.json` row described
  only the two CI/baseline payloads, while 57 of the 63 `headless-*.json` files
  are per-change acceptance payloads (`baseCommit`, `change`, `testOwnership`,
  `localTests`, `limits`); the row now says so.
- `cli/src/main.rs`: the module comment claimed the standalone binaries "remain
  installed and usable directly". `Makefile` `install`/`install-cli`/
  `install-desktop` place only `future` and `futureos`, so it now says they stay
  `cargo build -p <crate>` targets. Comment only, no logic change.
@huichen
huichen enabled auto-merge (squash) October 22, 2026 20:23
@huichen
huichen merged commit 9666d31 into main Oct 22, 2026
33 checks passed
@huichen
huichen deleted the pr/huichen branch October 22, 2026 20:40
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