Skip to content

refactor(build): unify Rust workspace and CLI/Desktop builds - #1153

Merged
tallcode merged 10 commits into
mainfrom
refactor/unified-rust-build
Oct 16, 2026
Merged

tallcode merged 10 commits into
mainfrom
refactor/unified-rust-build

Conversation

@tallcode

Copy link
Copy Markdown
Collaborator

改动

  • 将 Desktop Rust 后端纳入根 Cargo workspace,统一 Cargo.lock、release Thin LTO 和 target 目录。
  • macOS/Windows 通过一次 Cargo 调用构建 CLI 与 Desktop,共享依赖的 feature 集合和编译产物;Tauri 继续负责资源处理和打包。
  • Linux 保留 musl CLI/headless 与 GNU GUI 两个目标:CLI/headless 联合构建,GUI 打包复用已构建的 musl CLI sidecar。
  • 调整本地构建入口、打包脚本、CI 路径及相关文档。
  • 删除 prewarm workflow、检查脚本、回归测试、Makefile 入口和 CI 引用,改为每个 PR/手动分支运行自行保存缓存,并为测试矩阵设置独立 shared-key。
  • Rust CI/构建从 rust-toolchain.toml 读取工具链,在 job 临时目录使用独立 RUSTUP_HOME,避免 runner 预装的额外 Rust 版本改变缓存哈希。

验证

@tallcode
tallcode enabled auto-merge (squash) October 16, 2026 13:51
@tallcode
tallcode merged commit 4214eeb into main Oct 16, 2026
15 checks passed
@tallcode
tallcode deleted the refactor/unified-rust-build branch October 16, 2026 14:23
huichen added a commit that referenced this pull request Oct 22, 2026
A Windows process takes its main-thread stack size from its PE header, and the
linker default — 1 MB, measured on this crate's own `future.exe` — is an eighth
of what Linux and macOS give the same code. Growth is on demand, so a frame that
runs past the reserve is fatal and silent:
`STATUS_STACK_OVERFLOW` (0xc00000fd), no message, no exit path.

That is not hypothetical: `future session list` died exactly that way on one
build of this CLI while `models list`, `task list` and `auth status` all worked
on the same isolated Agent — the shape of a reserve that is barely big enough.
The desktop already passes `/STACK:8388608,65536` for its command dispatch
(#1153); `build.rs` now passes the same for every binary of this crate. The
reserve is address space, not memory: commit stays at 64 KB and the stack grows
into it on demand.

`cli/tests/windows_stack.rs` reads `SizeOfStackReserve` off the built binary, so
losing the link argument fails a test. Checked as a negative control: with the
argument removed the test fails and names the 1 MB default, and with it restored
the built image reports 8388608 bytes / 65536 commit.
huichen added a commit that referenced this pull request Oct 22, 2026
…, reserve the Windows stack (#1309)

* test(desktop): say why a host status is not ready

`an_owned_host_counts_its_activity_and_a_stopped_host_reports_none` failed once
on a loaded Windows machine with only

    assertion `left == right` failed
      left: "unavailable"
     right: "ready"

and the child's own output could not narrow it further: `AgentStatus` carries the
transport, handshake or data-root reason in `error`, and nothing printed it. The
assertion now includes the whole status, so a repeat names the cause instead of
asking the reader to reproduce it.

Investigating that flake: it is not reproducible here. The case passed 30
sequential runs, three full library suites at `--test-threads=16`, and four and
eight concurrent runs of the whole fixture module with the CPU saturated, all on
the merged tree. The two failures both came from one build of an unmerged branch
state, so this commit adds the diagnosis rather than a fix for a cause that was
not established.

* fix(goal): replay restores created_at from the ledger, not the replay clock

`replay()` seeds state with `Goal::new`, which stamps `created_at:
now_epoch()`, and the `GoalStarted` fold dropped the event's `ts`. Replaying
therefore re-dated creation to the moment of the read: `created_at` drifted on
every replay and only looked stable while both clock reads landed in the same
wall-clock second.

That is what failed CI on main (run 39809589270): the goal's newest ledger ts
(1792685455) was compared against `created_at`, re-stamped to 1792685456.

- `apply(GoalStarted)` restores `created_at` from the event ts - the ledger is
  the canonical source of the creation time.
- `replay()` seeds `created_at` from the registry entry first, so a legacy
  goal whose ledger has no `GoalStarted` keeps its registration time. The
  replay clock is now only the last resort, for a goal with neither source.
- Regression tests: creation backdated two seconds must survive replay
  (deterministically red before the fix), plus the registry fallback tier.
- webui: comments no longer claim replay re-stamps creation with "now".

* fix(cli): reserve the platform stack on Windows

A Windows process takes its main-thread stack size from its PE header, and the
linker default — 1 MB, measured on this crate's own `future.exe` — is an eighth
of what Linux and macOS give the same code. Growth is on demand, so a frame that
runs past the reserve is fatal and silent:
`STATUS_STACK_OVERFLOW` (0xc00000fd), no message, no exit path.

That is not hypothetical: `future session list` died exactly that way on one
build of this CLI while `models list`, `task list` and `auth status` all worked
on the same isolated Agent — the shape of a reserve that is barely big enough.
The desktop already passes `/STACK:8388608,65536` for its command dispatch
(#1153); `build.rs` now passes the same for every binary of this crate. The
reserve is address space, not memory: commit stays at 64 KB and the stack grows
into it on demand.

`cli/tests/windows_stack.rs` reads `SizeOfStackReserve` off the built binary, so
losing the link argument fails a test. Checked as a negative control: with the
argument removed the test fails and names the 1 MB default, and with it restored
the built image reports 8388608 bytes / 65536 commit.

* test(cli): a mock-platform fixture that survives a connection with no request

`auth_login_writes_the_key_itself_when_no_agent_is_running` and
`auth_login_saves_through_a_running_agent` failed in roughly two of every three
full-suite runs on a Windows runner, and passed when run alone. The failure read
as two unrelated things: the listener thread reported
`assertion failed: request.read_line(..).expect("request headers") > 0`, and the
test reported `Network error: error sending request for url (…/device/code)`.

They are one thing. The CLI occasionally opens a connection to the platform,
sends nothing, closes it, and then makes its real request on a new connection —
a connect it abandoned and retried, seen under load and never in isolation
(verified: 12 concurrent `auth login` runs against a Python server produced
none, while full-suite runs produced one or two). Measuring the peer pid at
accept time named `future.exe`, the test's own CLI.

The fixture asserted `> 0` on that read. The assertion runs on the listener
thread, so the empty connection panicked the thread, the listener socket was
dropped with it, and the login the test is about then failed on a refused
connection — three removes from the cause.

The fixture now answers requests instead of policing the client: a connection
that carries no request is skipped, a malformed one is recorded in the new
`faults` list (and answered with 413 when it is oversized) rather than panicking,
and a test that cares asserts the list is empty. Both auth tests do, so a
genuinely malformed request is still a failure — with a message that names it.

Verified: 15 consecutive full-suite runs, 0 failures (before: 2 of 3 failing),
and 37 more after the final formatting pass. Negative control: restoring the
fatal `panic!` on the empty connection makes the new regression test
`a_connection_that_sends_nothing_does_not_poison_the_mock_platform` fail with the
original signature, so the guard is not vacuous.

* fix(scripts): verify pinned installs and fail closed without a checksum

The one-line installers run straight from `curl | bash`, yet two paths installed
artifacts without verifying anything:

- a pinned FUTUREOS_VERSION constructed the asset URL and skipped the manifest,
  so `FUTUREOS_VERSION=v1.0.2` downloaded and installed with no SHA-256 at all;
- a host without shasum/sha256sum logged a warning and returned success, which
  callers read as "verified".

Both now fail closed. A pinned install reads that release's own manifest
(releases/<version>/latest.json, published beside its artifacts) and shares the
latest-path verification; a release with no manifest entry, or a manifest entry
without sha256, is refused. Skipping the check requires FUTUREOS_SKIP_VERIFY=1,
documented as the deliberate risk it is. install.ps1 gets the same
pinned-manifest lookup and opt-in; it already failed closed on the hash tool,
because Get-FileHash ships with PowerShell (it now also refuses a pinned release
with no windows-x86_64 sha256, and a host without Get-FileHash).

Tests: scripts/tests/test-install.py gains pinned, fail-closed and opt-in cases
and now runs in CI's affected job; test-install.ps1 exercises the manifest, the
refusal and the opt-in, and no longer risks running a real `future init`.

* fix(cli): scope the Windows stack reserve to the binary

The reserve the CLI needs is for the shipped `future` binary. A bare
`rustc-link-arg` gave it to every target of the package, including every
test binary Cargo links for this crate.

`-bins` narrows it to `[[bin]]` targets. `cli/tests/windows_stack.rs`
now asserts both halves: the binary reports an 8 MB reserve and this test
binary reports the 1 MB linker default, so widening the scope again fails a
test rather than passing silently.

Measured after the change: target/debug/future.exe reserve=8388608
commit=65536, target/debug/deps/windows_stack-*.exe reserve=1048576
commit=4096.

* test(cli): an abandoned request is not a fault in the mock platform

`auth_login_saves_through_a_running_agent` flaked because the fixture
reported a connection the client abandoned as something it could not serve:
the login test then failed on its `faults` assertion, three steps away from
the login it is about. The empty-connection half was fixed first (a connect
that sends nothing); a connect that gets a few bytes of the request out
before closing still landed in `faults`, and recorded it again.

The fixture now separates the two records. `faults` is a request received
in full and unservable (an unparseable `Content-Length`, an oversized
body). `abandoned` is everything that ended before the request did: no
bytes, an unreadable request line, headers that stop early, a short body. A
partial request was never answerable, so counting it as a fault only made
the fixture blame the client it was serving.

`a_request_abandoned_half_written_does_not_poison_the_mock_platform`
covers the second half deterministically: it writes a partial request line,
and a request line plus one header, then closes, waits for the fixture to
record both, and asserts the real login after them is served with no faults.
Reverting the `headers ended early` branch makes it fail.

* chore(skills): bump future-goal to the cross-model ensemble workflow

Points the skills submodule at future-skills 32e9173, which adds the Ensemble
goal workflow (one frozen brief, different models, blind judging, synthesis),
its references/ensemble.md templates and the contract test guarding them.

* chore(skills): bump future-goal registry metadata

Points the skills submodule at future-skills 8c28fd9, which describes the
cross-model ensemble workflow in the future-goal registry entry so the skill
panel shows it.

* test(cli): assert the stack reserve did not reach the tests, without pinning the default

The new assertion compared this test binary's reserve to the 1 MB linker
default by value. That passes today and fails on an unrelated toolchain or
linker upgrade that moves the default, reporting a stack-reserve bug that
does not exist — and CI runs this test on windows-latest, so the false red
would land on an unrelated PR.

What has to hold is narrower: this binary did not receive the reserve the CLI
got. `test_reserve < binary_reserve` says exactly that. Verified in both
directions: widening `build.rs` back to a bare `rustc-link-arg` fails the
test with `this test binary reserves 8388608 bytes and the CLI reserves
8388608`, and `rustc-link-arg-bins` passes with 1048576 against 8388608.

* test(cli): record an abandoned connection once, not once per symptom

A reset can reach the fixture as an unreadable header line *and* as headers
that stopped early, and the header loop recorded both: one connection added
two entries to `abandoned`. The count then depended on which side of the
reset the fixture happened to see, which made the new regression test's
`== 2` assertion an occasional failure of its own.

The error is now carried out of the loop and recorded once, with the detail
kept, and the test treats the count as a precondition (`>= 2`) rather than
the property under test -- what that test asserts is that the login after the
abandoned connections is served and reports no faults.

15 consecutive `cargo test -p future-cli --test bin` runs: 25 passed each.

* fix(host): read an empty tail page as a live turn, not lost history

create_run stamps the thread's activity as soon as a send starts, while the
Agent persists the user entry only once the prompt is admitted. A reload that
lands inside that window read an empty history page for a conversation that
already claimed activity, and the GUI showed "Conversation history is
unavailable: restore its matching Agent database" on top of a healthy first
reply.

Only a conversation with nothing running can really be missing its history:
exempt the in-flight case (store::has_active_run) and keep the banner for a
settled conversation whose Agent page is empty.

* fix(ci): move the mirror list, not just the apt sources, when failing over

The apt failover added for run 39802801818 never switched anything. GitHub's
Ubuntu images name no hostname in their sources: 24.04 ships
`URIs: mirror+file:/etc/apt/apt-mirrors.txt` and keeps the endpoints in that
mirror list (azure priority:1, archive.ubuntu.com priority:2,
security.ubuntu.com priority:3 - 144 bytes, which is exactly the size apt
reported fetching from the mirrorlist in the log). `switch_to_public_archive`
grepped the sources for an azure hostname, matched nothing, rewrote nothing and
returned success, so the retry again called azure.archive.ubuntu.com.

Evidence from run 39822317986, job `Rust check / desktop`:

  17:36:12  Get:2 http://azure.archive.ubuntu.com/... libjavascriptcoregtk...
  17:39:12  Package installation did not finish (status 124); switching...
  17:39:12  Hit:2 http://azure.archive.ubuntu.com/ubuntu noble InRelease
  17:39:14  Get:2 http://azure.archive.ubuntu.com/... (same packaging, 145 s)

The endpoint never moved, so the second 180 s budget went to the same
~50 kB/s transfer. The mirror itself is not inherently slow - a sibling job in
the same run (`Rust Linux test / desktop`, 17:25) fetched the same 59 MB from
azure in 19 s.

What changed:

- `switch_to_public_archive` rewrites every file that can name the endpoint:
  sources.list, sources.list.d/*.sources|*.list and the file each
  `mirror+file:`/`file:` URI defers to (the mirror list). It reports each file
  it rewrote and *fails* when nothing matched, instead of claiming a switch.
- Every attempt prints the archive host and one sample URI apt would actually
  fetch, taken from `apt-get --print-uris` rather than from the source files,
  so the log shows whether a switch moved the endpoint.
- Download and unpack are separate phases with separate budgets; the download
  budget follows the payload from `--print-uris` (90 s + 4 s/MB, 180-480 s)
  instead of a flat 180 s. A failure names the phase that ran out, the host it
  was using and the archives still outstanding.
- `--self-test` exercises the rewrite against a runner-shaped fixture tree
  (mirror-list layout, classic sources.list, arm64 ports list, and a no-op that
  must not claim success); `scripts/tests/ci-plan.test.mjs` runs it.

Refs #1309

* chore(skills): ship the future-goal dispatch rule

Bump the skills submodule to future-skills 9b5e98c, which teaches future-goal
that a bare `/future-goal` is a full invocation: the token carries a request to
run the accompanying work as a supervised goal, so the session dispatches at
least one worker instead of answering inline. Previously the same task ending in
just the token produced no goal and no worker, while the same task ending in
"使用 /future-goal 技能启动多个 worker" dispatched reliably.

The installed copy under ~/.future/agent/skills was updated in place; this
pointer is what makes a fresh checkout and `future skills install` ship 5.3.0.

* fix(ci): resolve the mirror list in the apt plan, not the pseudo-URI

`apt-get --print-uris` does not resolve a `mirror+file:` source. The first CI
run of #1309's follow-up printed, in the very line meant to prove which archive
the job would use:

  APT sample URI: mirror+file:/etc/apt/apt-mirrors.txt/pool/main/b/...deb
  APT download: 2.4 MB from apt

`apt` was the third field of the mirror-list path, not a host. The same pseudo-
URI comes back before and after a switch, so that comparison would have
reported "nothing changed" for a switch that did move the endpoint.

Resolve it the way apt does: the `mirror+file:` target's lowest priority number
wins and the rest are failover, substituted back into the plan line, so host,
sample URI and byte budget all describe the archive the transfer will really
touch. The attempt line now reads, on the same plan line:

  before: APT mirror list /etc/apt/apt-mirrors.txt: 3 entries, using http://azure.archive.ubuntu.com/ubuntu/
  after:  APT mirror list /etc/apt/apt-mirrors.txt: 3 entries, using http://archive.ubuntu.com/ubuntu/

The self-test asserts the resolution on both sides of the switch, on an
identical plan line.
huichen added a commit that referenced this pull request Oct 22, 2026
…forked store after closing it (#1310)

* test(desktop): say why a host status is not ready

`an_owned_host_counts_its_activity_and_a_stopped_host_reports_none` failed once
on a loaded Windows machine with only

    assertion `left == right` failed
      left: "unavailable"
     right: "ready"

and the child's own output could not narrow it further: `AgentStatus` carries the
transport, handshake or data-root reason in `error`, and nothing printed it. The
assertion now includes the whole status, so a repeat names the cause instead of
asking the reader to reproduce it.

Investigating that flake: it is not reproducible here. The case passed 30
sequential runs, three full library suites at `--test-threads=16`, and four and
eight concurrent runs of the whole fixture module with the CPU saturated, all on
the merged tree. The two failures both came from one build of an unmerged branch
state, so this commit adds the diagnosis rather than a fix for a cause that was
not established.

* fix(goal): replay restores created_at from the ledger, not the replay clock

`replay()` seeds state with `Goal::new`, which stamps `created_at:
now_epoch()`, and the `GoalStarted` fold dropped the event's `ts`. Replaying
therefore re-dated creation to the moment of the read: `created_at` drifted on
every replay and only looked stable while both clock reads landed in the same
wall-clock second.

That is what failed CI on main (run 39809589270): the goal's newest ledger ts
(1792685455) was compared against `created_at`, re-stamped to 1792685456.

- `apply(GoalStarted)` restores `created_at` from the event ts - the ledger is
  the canonical source of the creation time.
- `replay()` seeds `created_at` from the registry entry first, so a legacy
  goal whose ledger has no `GoalStarted` keeps its registration time. The
  replay clock is now only the last resort, for a goal with neither source.
- Regression tests: creation backdated two seconds must survive replay
  (deterministically red before the fix), plus the registry fallback tier.
- webui: comments no longer claim replay re-stamps creation with "now".

* fix(cli): reserve the platform stack on Windows

A Windows process takes its main-thread stack size from its PE header, and the
linker default — 1 MB, measured on this crate's own `future.exe` — is an eighth
of what Linux and macOS give the same code. Growth is on demand, so a frame that
runs past the reserve is fatal and silent:
`STATUS_STACK_OVERFLOW` (0xc00000fd), no message, no exit path.

That is not hypothetical: `future session list` died exactly that way on one
build of this CLI while `models list`, `task list` and `auth status` all worked
on the same isolated Agent — the shape of a reserve that is barely big enough.
The desktop already passes `/STACK:8388608,65536` for its command dispatch
(#1153); `build.rs` now passes the same for every binary of this crate. The
reserve is address space, not memory: commit stays at 64 KB and the stack grows
into it on demand.

`cli/tests/windows_stack.rs` reads `SizeOfStackReserve` off the built binary, so
losing the link argument fails a test. Checked as a negative control: with the
argument removed the test fails and names the 1 MB default, and with it restored
the built image reports 8388608 bytes / 65536 commit.

* test(cli): a mock-platform fixture that survives a connection with no request

`auth_login_writes_the_key_itself_when_no_agent_is_running` and
`auth_login_saves_through_a_running_agent` failed in roughly two of every three
full-suite runs on a Windows runner, and passed when run alone. The failure read
as two unrelated things: the listener thread reported
`assertion failed: request.read_line(..).expect("request headers") > 0`, and the
test reported `Network error: error sending request for url (…/device/code)`.

They are one thing. The CLI occasionally opens a connection to the platform,
sends nothing, closes it, and then makes its real request on a new connection —
a connect it abandoned and retried, seen under load and never in isolation
(verified: 12 concurrent `auth login` runs against a Python server produced
none, while full-suite runs produced one or two). Measuring the peer pid at
accept time named `future.exe`, the test's own CLI.

The fixture asserted `> 0` on that read. The assertion runs on the listener
thread, so the empty connection panicked the thread, the listener socket was
dropped with it, and the login the test is about then failed on a refused
connection — three removes from the cause.

The fixture now answers requests instead of policing the client: a connection
that carries no request is skipped, a malformed one is recorded in the new
`faults` list (and answered with 413 when it is oversized) rather than panicking,
and a test that cares asserts the list is empty. Both auth tests do, so a
genuinely malformed request is still a failure — with a message that names it.

Verified: 15 consecutive full-suite runs, 0 failures (before: 2 of 3 failing),
and 37 more after the final formatting pass. Negative control: restoring the
fatal `panic!` on the empty connection makes the new regression test
`a_connection_that_sends_nothing_does_not_poison_the_mock_platform` fail with the
original signature, so the guard is not vacuous.

* fix(scripts): verify pinned installs and fail closed without a checksum

The one-line installers run straight from `curl | bash`, yet two paths installed
artifacts without verifying anything:

- a pinned FUTUREOS_VERSION constructed the asset URL and skipped the manifest,
  so `FUTUREOS_VERSION=v1.0.2` downloaded and installed with no SHA-256 at all;
- a host without shasum/sha256sum logged a warning and returned success, which
  callers read as "verified".

Both now fail closed. A pinned install reads that release's own manifest
(releases/<version>/latest.json, published beside its artifacts) and shares the
latest-path verification; a release with no manifest entry, or a manifest entry
without sha256, is refused. Skipping the check requires FUTUREOS_SKIP_VERIFY=1,
documented as the deliberate risk it is. install.ps1 gets the same
pinned-manifest lookup and opt-in; it already failed closed on the hash tool,
because Get-FileHash ships with PowerShell (it now also refuses a pinned release
with no windows-x86_64 sha256, and a host without Get-FileHash).

Tests: scripts/tests/test-install.py gains pinned, fail-closed and opt-in cases
and now runs in CI's affected job; test-install.ps1 exercises the manifest, the
refusal and the opt-in, and no longer risks running a real `future init`.

* fix(cli): scope the Windows stack reserve to the binary

The reserve the CLI needs is for the shipped `future` binary. A bare
`rustc-link-arg` gave it to every target of the package, including every
test binary Cargo links for this crate.

`-bins` narrows it to `[[bin]]` targets. `cli/tests/windows_stack.rs`
now asserts both halves: the binary reports an 8 MB reserve and this test
binary reports the 1 MB linker default, so widening the scope again fails a
test rather than passing silently.

Measured after the change: target/debug/future.exe reserve=8388608
commit=65536, target/debug/deps/windows_stack-*.exe reserve=1048576
commit=4096.

* test(cli): an abandoned request is not a fault in the mock platform

`auth_login_saves_through_a_running_agent` flaked because the fixture
reported a connection the client abandoned as something it could not serve:
the login test then failed on its `faults` assertion, three steps away from
the login it is about. The empty-connection half was fixed first (a connect
that sends nothing); a connect that gets a few bytes of the request out
before closing still landed in `faults`, and recorded it again.

The fixture now separates the two records. `faults` is a request received
in full and unservable (an unparseable `Content-Length`, an oversized
body). `abandoned` is everything that ended before the request did: no
bytes, an unreadable request line, headers that stop early, a short body. A
partial request was never answerable, so counting it as a fault only made
the fixture blame the client it was serving.

`a_request_abandoned_half_written_does_not_poison_the_mock_platform`
covers the second half deterministically: it writes a partial request line,
and a request line plus one header, then closes, waits for the fixture to
record both, and asserts the real login after them is served with no faults.
Reverting the `headers ended early` branch makes it fail.

* chore(skills): bump future-goal to the cross-model ensemble workflow

Points the skills submodule at future-skills 32e9173, which adds the Ensemble
goal workflow (one frozen brief, different models, blind judging, synthesis),
its references/ensemble.md templates and the contract test guarding them.

* chore(skills): bump future-goal registry metadata

Points the skills submodule at future-skills 8c28fd9, which describes the
cross-model ensemble workflow in the future-goal registry entry so the skill
panel shows it.

* test(cli): assert the stack reserve did not reach the tests, without pinning the default

The new assertion compared this test binary's reserve to the 1 MB linker
default by value. That passes today and fails on an unrelated toolchain or
linker upgrade that moves the default, reporting a stack-reserve bug that
does not exist — and CI runs this test on windows-latest, so the false red
would land on an unrelated PR.

What has to hold is narrower: this binary did not receive the reserve the CLI
got. `test_reserve < binary_reserve` says exactly that. Verified in both
directions: widening `build.rs` back to a bare `rustc-link-arg` fails the
test with `this test binary reserves 8388608 bytes and the CLI reserves
8388608`, and `rustc-link-arg-bins` passes with 1048576 against 8388608.

* test(cli): record an abandoned connection once, not once per symptom

A reset can reach the fixture as an unreadable header line *and* as headers
that stopped early, and the header loop recorded both: one connection added
two entries to `abandoned`. The count then depended on which side of the
reset the fixture happened to see, which made the new regression test's
`== 2` assertion an occasional failure of its own.

The error is now carried out of the loop and recorded once, with the detail
kept, and the test treats the count as a precondition (`>= 2`) rather than
the property under test -- what that test asserts is that the login after the
abandoned connections is served and reports no faults.

15 consecutive `cargo test -p future-cli --test bin` runs: 25 passed each.

* fix(host): read an empty tail page as a live turn, not lost history

create_run stamps the thread's activity as soon as a send starts, while the
Agent persists the user entry only once the prompt is admitted. A reload that
lands inside that window read an empty history page for a conversation that
already claimed activity, and the GUI showed "Conversation history is
unavailable: restore its matching Agent database" on top of a healthy first
reply.

Only a conversation with nothing running can really be missing its history:
exempt the in-flight case (store::has_active_run) and keep the banner for a
settled conversation whose Agent page is empty.

* fix(ci): move the mirror list, not just the apt sources, when failing over

The apt failover added for run 39802801818 never switched anything. GitHub's
Ubuntu images name no hostname in their sources: 24.04 ships
`URIs: mirror+file:/etc/apt/apt-mirrors.txt` and keeps the endpoints in that
mirror list (azure priority:1, archive.ubuntu.com priority:2,
security.ubuntu.com priority:3 - 144 bytes, which is exactly the size apt
reported fetching from the mirrorlist in the log). `switch_to_public_archive`
grepped the sources for an azure hostname, matched nothing, rewrote nothing and
returned success, so the retry again called azure.archive.ubuntu.com.

Evidence from run 39822317986, job `Rust check / desktop`:

  17:36:12  Get:2 http://azure.archive.ubuntu.com/... libjavascriptcoregtk...
  17:39:12  Package installation did not finish (status 124); switching...
  17:39:12  Hit:2 http://azure.archive.ubuntu.com/ubuntu noble InRelease
  17:39:14  Get:2 http://azure.archive.ubuntu.com/... (same packaging, 145 s)

The endpoint never moved, so the second 180 s budget went to the same
~50 kB/s transfer. The mirror itself is not inherently slow - a sibling job in
the same run (`Rust Linux test / desktop`, 17:25) fetched the same 59 MB from
azure in 19 s.

What changed:

- `switch_to_public_archive` rewrites every file that can name the endpoint:
  sources.list, sources.list.d/*.sources|*.list and the file each
  `mirror+file:`/`file:` URI defers to (the mirror list). It reports each file
  it rewrote and *fails* when nothing matched, instead of claiming a switch.
- Every attempt prints the archive host and one sample URI apt would actually
  fetch, taken from `apt-get --print-uris` rather than from the source files,
  so the log shows whether a switch moved the endpoint.
- Download and unpack are separate phases with separate budgets; the download
  budget follows the payload from `--print-uris` (90 s + 4 s/MB, 180-480 s)
  instead of a flat 180 s. A failure names the phase that ran out, the host it
  was using and the archives still outstanding.
- `--self-test` exercises the rewrite against a runner-shaped fixture tree
  (mirror-list layout, classic sources.list, arm64 ports list, and a no-op that
  must not claim success); `scripts/tests/ci-plan.test.mjs` runs it.

Refs #1309

* chore(skills): ship the future-goal dispatch rule

Bump the skills submodule to future-skills 9b5e98c, which teaches future-goal
that a bare `/future-goal` is a full invocation: the token carries a request to
run the accompanying work as a supervised goal, so the session dispatches at
least one worker instead of answering inline. Previously the same task ending in
just the token produced no goal and no worker, while the same task ending in
"使用 /future-goal 技能启动多个 worker" dispatched reliably.

The installed copy under ~/.future/agent/skills was updated in place; this
pointer is what makes a fresh checkout and `future skills install` ship 5.3.0.

* fix(ci): resolve the mirror list in the apt plan, not the pseudo-URI

`apt-get --print-uris` does not resolve a `mirror+file:` source. The first CI
run of #1309's follow-up printed, in the very line meant to prove which archive
the job would use:

  APT sample URI: mirror+file:/etc/apt/apt-mirrors.txt/pool/main/b/...deb
  APT download: 2.4 MB from apt

`apt` was the third field of the mirror-list path, not a host. The same pseudo-
URI comes back before and after a switch, so that comparison would have
reported "nothing changed" for a switch that did move the endpoint.

Resolve it the way apt does: the `mirror+file:` target's lowest priority number
wins and the rest are failover, substituted back into the plan line, so host,
sample URI and byte budget all describe the archive the transfer will really
touch. The attempt line now reads, on the same plan line:

  before: APT mirror list /etc/apt/apt-mirrors.txt: 3 entries, using http://azure.archive.ubuntu.com/ubuntu/
  after:  APT mirror list /etc/apt/apt-mirrors.txt: 3 entries, using http://archive.ubuntu.com/ubuntu/

The self-test asserts the resolution on both sides of the switch, on an
identical plan line.

* feat(mobile): open the recency row's under-line with the machine

On the recency page every row says where it lives under its title, and the
machine's glyph trailed the workspace name — so the under-line started with a
word whose length decided where the device icon sat, and nothing in that line
shared the title's left edge.

The glyph now leads the line, on the row's own left edge, so its column lines
up with the title above it: measured in the mobile harness at x=24 for both,
with the workspace name opening at x=48. The 4px margin it carried as a
follower would read as an indent against that edge, so it moves to the glyph's
right and the pair keeps its 8px separation.

The other two places a merged row draws its glyph (a workspace heading and a
flat/chat row) are untouched: they are single-line rows where the icon does sit
after the text it labels.

Verified: tsc --noEmit, eslint on both files, and SessionList + SessionsScreen
suites (150 tests) pass; the new test fails with the old order restored.

* test(agent): reopen the forked store after closing it, not beside it

`forked_checkpoint_evidence_resolves_through_history_after_restart` failed once
on CI (run 39828434841, job `Rust Linux test / agent`):

  session::fork::tests::forked_checkpoint_evidence_resolves_through_history_after_restart
  panicked at agent/src/session/fork.rs:497:51:
  called `Result::unwrap()` on an `Err` value: database is locked
  Caused by: Error code 5: database is locked

That line is `restarted.load(&child.id)`, not the summary assertion. The test
wrote the child through one store and then read it through a second store it
opened *beside* the first, so two live connections shared agent.db:

- the first store's worker keeps an idle space reclaimer (128 single-page
  `PRAGMA incremental_vacuum(1)` commits, then `wal_checkpoint(TRUNCATE)`,
  `synchronous=FULL`), and
- the reopened store's load is a read that has to take the same write lock
  (SQLite blocks readers on the wal-index write lock while a writer commits).

Measured on an idle disk with the real code paths: one reclaimer slice is
133 ms (1.04 ms per single-page commit) and a concurrent store's load fails
3 of 4 attempts with `database is locked` / SQLITE_BUSY_SNAPSHOT. On a runner
whose commits are slower than that, the slice outlasts the 5 s busy timeout and
the failure surfaces as plain SQLITE_BUSY — what CI reported. Nothing is wrong
with the fork, the checkpoint or its evidence; the extra connection is the
problem.

A restart ends the store that wrote the child, so close it before reopening.
The test still forks twice through a freshly opened store with a rebuilt
history index — the property it asserts - but it no longer races its own
predecessor, and the agent keeps one store per process anyway.

Verified: the test passes in 12 consecutive runs and inside a full parallel
2483-test lib run; `session::fork` 21/21; fmt and clippy clean. The local full
suite still reports unrelated failures that reproduce on the unmodified branch
here (`grpc::tests::the_public_serve_wrappers_bind_serve_and_report_bind_failures`
fails on dev-huichen too, and `service::tests::*` flake under this machine's
load), so they are not evidence about this change.

* chore(skills): bump future-versioning to record the repository convention by default

Picks up future-skills#107 (dee9352): the skill now writes a repository's
delivery convention into its AGENTS.md as part of the work, in a commit of
its own, instead of offering to and waiting for an answer. The consent gate
remains where the file is not the user's to set and for initializing a
repository.

Without this bump the shipped skill keeps the old wording, which is what let
a session skip the AGENTS.md entirely.
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