Skip to content

feat(mobile,host,agent): show and edit a queued message's files - #1576

Merged
huichen merged 3 commits into
mainfrom
pr/huichen
Nov 9, 2026
Merged

huichen merged 3 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

A queued (not yet running) message in the mobile chat reported only its text, so a photo or file could be parked in the queue and be invisible until it ran — and editing its text silently dropped whatever it carried. This PR makes the queue report the files each waiting prompt holds, draws them in the queue panel, and lets a reader open, remove or add files on a waiting row through the same cancel-and-resend operation the session already supports.

What changed

  • Wire contract (packages/rpc): QueuedRunState grows a repeated QueuedRunAttachment attachments field (path, kind, name, size measured at read time). Codec, payload mirror and parity tests updated; regeneration is checked in.
  • Agent (agent/src/rpc): get_state fills that list from the real files on disk for every queued run.
  • Host (host/src/agent_bridge/queue.rs): forwards the new field to paired clients.
  • Mobile: the queue panel draws one chip per file (tap opens it through the same download + preview path a sent message's attachment uses; X drops it; + adds photos or files via the composer's source menu, now a shared AttachmentSourceMenu component). A text edit keeps the files it used to drop. Kept files are copied down before the queued run is cancelled, so a failed transfer leaves the row untouched, and a refused re-send restores text plus files to the composer. A row whose desktop does not report files offers no file controls at all rather than guessing.

Commits

  • feat(mobile,host,agent): show and edit a queued message's files
  • fix(tui): carry the new attachments field in the queued-run fixture
  • test(cli,tui): wait for the effect, not a fixed sleep, in two Windows flakes

Verification

Local, on the CI-pinned Rust toolchain (1.99.1) and Node 22, ulimit -n 8192:

  • cargo fmt --all -- --check → clean
  • cargo clippy -p future-rpc -p future-host -p future-agent --all-targets -- -D warnings → clean
  • cargo test -p future-agent --lib → 3033 passed, 0 failed (7 ignored)
  • cargo test -p future-host --lib → 2224 passed, 0 failed (14 ignored)
  • cargo test -p future-rpc --lib → 264 passed, 0 failed
  • npx tsc --noEmit (mobile) → clean
  • npx eslint on the 10 touched mobile files → clean
  • npx jest --runInBand ChatScreen.test.ts ComposerDock.test.ts sessionQueue.test.ts → 3 suites, 122 tests passed
  • After the follow-up fix: cargo fmt -p future-tui --check, cargo clippy -p future-tui -p future-cli --all-targets -- -D warnings, cargo test -p future-tui --lib → 1835 passed, 0 failed
  • The third commit replaces two fixed sleeps with effect-based waits in cli/tests/remote_start_refusal.rs and tui/src/workbench/run.rs; both tests had failed on Windows runs of this branch on different assertions, so the wait was the unstable part, not the code under test. Verified with cargo test -p future-cli --test remote_start_refusal and cargo test -p future-tui --lib (formatted, clippy clean on the pinned 1.99.1 toolchain).

User-visible changes

  • Mobile chat queue rows now list their files. Before: a queued message showed only its text, and its photo/file was invisible until it ran. After: one chip per file with open / remove / add controls. Rollback: revert 3a0fd2537.
  • Editing a queued message's text no longer discards its files. Before: the editor warned that a text edit would lose attachments it could not show. After: files are kept, and additions/removals are honoured through cancel-and-resend. Rollback: same commit.
  • No behaviour change for older desktops: a host that does not report queued files yields rows without file controls (no destructive guesses).

A waiting message reported only its text, so a queue could be read but not
seen: a photo could be queued and then be invisible until it ran, and the
phone's only file-related verdict was a warning that a text edit would lose
what it could not show.

The queue now reports the files each waiting prompt carries. `get_state`'s
`queuedRuns` rows grow a `QueuedRunAttachment` list (path, kind, name, size,
size measured at read time), the host forwards it, and an older Agent that
has no such field still reads as a row with no files rather than a broken
one.

On the phone the panel draws one chip per file and offers what the
transcript already offers: tap opens it (the same download + preview path a
sent message's attachment uses), the X drops it, the + adds photos/files
through the composer's own source menu (now a shared component). A text
edit keeps the files it used to drop. Every one of those is the same
operation the session supports — cancel the queued run and send again — with
the kept files copied down BEFORE the cancel, so a failed transfer leaves
the row untouched instead of taking it away, and a refused re-send puts the
text and files back in the box.

A row whose desktop does not report files offers no file controls at all: a
removal there would drop the files the phone cannot see, so the editor keeps
saying that instead of guessing.

Tests: the row parse (including "no files" vs "not reported"), the panel's
three file verbs and the editor warning per row, the screen's keep/remove/add
paths (files copied first, only kept files re-sent), and the agent's and
host's queue reads with a real file on disk.
@huichen
huichen enabled auto-merge (squash) November 9, 2026 17:40
3a0fd25 gave payloads::QueuedRunState an attachments list, so the get_state wire round-trip test stopped building: its fixture imports that wire struct (the use future_rpc::payloads::{...} line shadows the TUI's own same-named client model) and builds it with a struct literal.

The fixture pins the decoder's real output, so it now carries a real attachment instead of an empty list - the point of the change is that a queued row can arrive with files. The TUI's own model stays as it is: it does not need the field, and serde drops it on parse.
@huichen huichen closed this Nov 9, 2026
auto-merge was automatically disabled November 9, 2026 18:25

Pull request was closed

@huichen huichen reopened this Nov 9, 2026
@huichen
huichen enabled auto-merge (squash) November 9, 2026 18:25
@huichen huichen closed this Nov 9, 2026
auto-merge was automatically disabled November 9, 2026 18:28

Pull request was closed

@huichen huichen reopened this Nov 9, 2026
@huichen
huichen enabled auto-merge (squash) November 9, 2026 18:29
@huichen huichen closed this Nov 9, 2026
auto-merge was automatically disabled November 9, 2026 20:05

Pull request was closed

@huichen huichen reopened this Nov 9, 2026
@huichen
huichen enabled auto-merge (squash) November 9, 2026 20:08
… flakes

`Rust Windows test / tui-cli` failed twice on the same head (run
42689608460, PR #1576) and each attempt failed a *different* test, while
the same SHA was green in run 42682307162. Both failures are waits that
priced the runner instead of ending on the effect they assert:

- `a_row_with_no_body_keeps_the_detail_pane_a_box` (tui): a tab switch
  reads beside the surface and the panel keeps painting the view it
  holds until the read lands, so the "has a patch" wait was satisfied by
  the *log*'s commit body the frame was still showing, and the paint
  then held `commit 42b37bf ... diff --git a/a.txt` with no `+two`. The
  wait now names `GitSection::Status` and the working-tree patch, so it
  ends on the read `3` started. Reproduced deterministically (2 s delay
  on the Status read): red before, green after, and still red when the
  read produces no patch.

- `a_reconnect_with_a_pre_v2_slot_forgets_it` (cli): the `Remote:
  <phase>` line trails the state by one loop tick (the loop prints the
  phase it read last iteration, then sleeps a second), so the fixed 2 s
  sleep read `Reconnecting` while the transcript already carried the
  Enabled-only "No device is paired yet" notice: the runtime had
  stopped, only the announcement was late. `ChildRun::await_phase` now
  waits for the phase line with `TERMINAL_CAP` as the backstop, the same
  shape `docs/testing/remote-start-refusal-wait-2026-10-26.md` adopted.
  Shown red with a 4 s announcement tick and green after; a tiny cap
  still fails naming the phase it sat on.

Assertions, budgets and the negative checks are unchanged.
@huichen
huichen merged commit 5e8503f into main Nov 9, 2026
29 checks passed
@huichen
huichen deleted the pr/huichen branch November 9, 2026 21:41
huichen added a commit that referenced this pull request Nov 10, 2026
…block a merge

The aggregate gate failed on any `needs.<job>.result` other than success. After a
rerun (`re-run failed jobs`) or a close/reopen of the pull request, GitHub leaves
the attempt it replaced behind as `abandoned` for a reusable-workflow caller, so a
fully green PR stayed red however often it was retried — measured on #1576, whose
23 checks all passed while the aggregate reported
`rust-linux-test: abandoned; required=true`.

ci-result.mjs now reads this run's own jobs (attempt `filter=all`) and decides one
verdict per planned caller group from that group's rows' newest completed attempt:
a superseded `abandoned`/`cancelled` attempt yields to the newer one, while
`failure` and `timed_out` stay red, and cancelling a whole CI run still fails
because its cancelled row is the newest attempt. A group the run lists no row for
falls back to its caller result, which only concludes success after its rows did.

Gate coverage is table-driven in scripts/tests/ci-plan.test.mjs, including the two
supersession cases that regress to red when the rule is reverted.
huichen added a commit that referenced this pull request Nov 11, 2026
…e, CI-gate and db-lock fixes (#1588)

* feat(cli): agent-ergonomic output, following the AXI principles

Apply the AXI design principles (https://axi.md/) that fit this CLI, without
breaking what scripts and humans already read.

Content first (principle 8):
- bare `future` is now a live home view — binary, version, home, agent state,
  session count, default model, scheduled tasks, installed skills — instead of
  the help screen; `--help` still prints the help.
- bare `future session`, `future task` and `future mcp` likewise show their live
  list rather than the group help.

Aggregates and empty states (principles 4, 5):
- a list states its size up front (`count: N`) and states an empty result
  instead of printing nothing.

Contextual disclosure (principle 9):
- every list ends with a `help[N]:` block of the concrete next commands.

Token-efficient output and minimal schemas (principles 1, 2):
- `--format toon` prints the same rows in TOON: one declared header, no braces,
  quotes or repeated keys. `--json` is unchanged, and data formats carry no
  prose, so an existing script keeps working.

Structured errors and exit codes (principle 6):
- one shared flag parser (cli/src/flags.rs, extracted from `future mcp`), so an
  invented flag is refused instead of silently ignored;
- usage errors exit 2 (`unknown option: --jsno` plus the usage line on stderr) —
  an unknown group or subcommand included, which used to print the help and exit
  0 as if the command had run;
- a command that ran and failed is still exit 1.

The wiki CLI pages (en + zh) document the home view, the output conventions and
the exit codes.

* feat(goal): add scout task class and direction-proposal ledger

Exploration nodes: a scout todo's output is a direction proposal, not a
deliverable, so a goal can discover new directions instead of only
executing the ones it was handed.

- TaskClass::Scout, classified as runnable worker work but excluded from
  delivery accounting; Todo gains kill_when and origin_proposal.
- work_items/direction.rs: DirectionProposal/Candidate, order- and
  wording-insensitive dedupe_key, and validate_candidates_against
  (duplicate titles, duplicate proposals, cycles via the existing task
  graph, superseded revival, unknown depends_on).
- Store events DirectionProposed/Accepted/Rejected/Expired with a
  projection-only ledger; goal replay ignores them.
- CLI: future goal direction propose|list|accept|reject|expire, plus
  todo add --class scout --kill-when. accept creates a todo of the
  candidate's class, so a direction can produce delivery work.
- exploration_gap obligation raised from failed_attempts, repeated
  verify rejections and the outcome floor; scout turns get a replacing
  envelope that names the exact propose command.

* feat(goal): refuse a scout closure with no direction proposal (run loop)

A scout's deliverable is a direction proposal, not an artifact. Extract the
ledger floor into one shared `scout_proposal_error` and apply it to the
automatic writeback in `run_turns_inner` as well as the manual `todo complete`,
so a worker that reports "completed" having proposed nothing keeps its todo
open instead of closing an empty exploration. The refusal is recorded as the
run error (hard error, so the repair budget is charged) and the turn's own
evidence is retained.

* feat(goal): close the worker-bridge hole in the scout proposal floor

`future goal worker-bridge` is the second automatic writeback path and it
selects from the same frontier where a scout is runnable work, so a scout could
still be closed through it having recorded nothing. Apply the shared
`scout_proposal_error` floor before `failure_kind` is stamped there too: the
worker's result is recorded in full, only the closure is refused, the todo stays
open for a bounded retry and the run is classified as a hard error.

Tests drive the real binary over piped stdin: a scout that reported completed
with no proposal stays open with the refusal as its run error (and a variant
with the gate disabled reproduces the closure), while a scout named by a
recorded proposal still completes.

* fix(ci): judge each planned check's newest attempt so a rerun cannot block a merge

The aggregate gate failed on any `needs.<job>.result` other than success. After a
rerun (`re-run failed jobs`) or a close/reopen of the pull request, GitHub leaves
the attempt it replaced behind as `abandoned` for a reusable-workflow caller, so a
fully green PR stayed red however often it was retried — measured on #1576, whose
23 checks all passed while the aggregate reported
`rust-linux-test: abandoned; required=true`.

ci-result.mjs now reads this run's own jobs (attempt `filter=all`) and decides one
verdict per planned caller group from that group's rows' newest completed attempt:
a superseded `abandoned`/`cancelled` attempt yields to the newer one, while
`failure` and `timed_out` stay red, and cancelling a whole CI run still fails
because its cancelled row is the newest attempt. A group the run lists no row for
falls back to its caller result, which only concludes success after its rows did.

Gate coverage is table-driven in scripts/tests/ci-plan.test.mjs, including the two
supersession cases that regress to red when the rule is reverted.

* fix(cli): a help request never runs a command, and a stray argument never does damage

The audit (`goal_5ea68140b459`) found one class of bug that matters more than any
token saving: a `--help` or a typo reached a command body and did something.
This commit closes that class for the worst offenders.

`--help` is a read (AXI principles 6 + 10):
- the dispatcher now answers `--help`/`-h` before any group runs, printing the
  subcommand's own page where one exists and the group page otherwise;
- `future skills update --help` ran the skill sync (a write), `future auth logout
  --help` signed the user out, `future channel --help` started the bridge and
  blocked, `future doctor --help` ran a full diagnostic, and `session info
  --help` passed `--help` to the agent as a session id. All five now print text
  and touch nothing;
- `future doctor` gains the page it never had.

`auth` takes only the arguments it understands (the 2026-11-10 incident):
- `future auth logout bogus` used to log the user out, leaving `auth.json` with
  `{type, base_url}` and no `key` (recovered only by signing in again). `logout`
  now takes no arguments at all; `login`, `status` and `credential` refuse what
  they do not know instead of starting a device-code flow because of a typo;
- `auth status` distinguishes "no credential" from "an entry whose key was
  cleared", names the file, and says what fixes it; `--json` reports the same
  three states as `{"loggedIn": …}`, so a script can branch on it;
- `auth logout` says how to sign back in.

`task` declares its flag surface:
- an unknown flag is refused (exit 2) before any subcommand reads the store, and
  a value-taking flag with no value is refused instead of dropped. Before this,
  `future task run --yolo` queued a real run and exited 0;
- a soft-deleted task renders as `deleted`, not `off`, so `task list --all` stops
  contradicting `task show <it>` ("task not found").

Output fixes:
- `mcp call --json` keeps stdout parseable: the notes that accompany a capped or
  mirrored result go to stderr, so the document is JSON again (the harness
  `JSON.parse`s the whole of stdout);
- `session list --format toon` carries `cwd`, `parent` and `streaming`, which the
  payload already had and the table has no room for;
- `[dns] plan=…` prints only with `FUTURE_DNS_DEBUG` set: it used to be the first
  line of stderr on every networked command, and landed mid-sentence in bare
  `future`'s home view.

Tests: two new dispatcher tests (help-never-runs, logout-refuses-arguments-without-
touching-the-credential), one for the task flag surface, one for the TOON columns,
plus the status/logout expectations updated. `cargo test -p future-cli` (1597 lib +
integration), `-p future-channel` (1507) and `-p future-http` pass; clippy clean on
all three.

* fix(cli): a usage mistake is exit 2 everywhere, not just in the groups that adopted the helper

`docs/wiki/{en,zh}/CLI.md` promises exit 2 for "the request itself was wrong",
but only the handful of commands converted to `axi::usage` honoured it: every
other group raised a plain `Err("Usage: …")` and the dispatcher turned all of
them into exit 1. A script could not tell "I asked wrong" from "it failed".

`catch` now classifies the error text (`axi::is_usage_error`): a `Usage: …`
line, an unknown/extra argument, an unknown option, a missing value, a missing
confirmation — exit 2. Converting a group to `axi::usage` later keeps the same
answer, so the two paths converge instead of drifting.

`future data restore <dir>` without `--yes` also stops calling itself an
"Invalid data command": it says the flag is what is missing, and which command
to run. Five tests that asserted exit 1 for exactly this class are updated —
their names already said "is a usage error".

* fix(cli): a failed run is not a successful one

`future run` read the answer out of the event stream and never looked at the
terminal `agent_end` record. A run the agent ended with `state="error"` printed
nothing, exited 0, and left a script to conclude that the answer was empty.

The terminal record now decides the exit status: `error`, `incomplete`,
`cancelled`, `cancelled_before_start`, `interrupted_by_restart` — and a
`completed` whose stream was flagged `reason=incomplete` — return an error with
the agent's own message on stderr. The partial text stays on stdout, because
showing what did arrive is honest; the exit code is what a caller branches on.

`terminal_outcome` is a pure function over the events and is unit-tested for
every state the agent emits (`agent/src/session/run_journal.rs`).

* feat(cli): clip long values with their size and a way back (AXI principle 3)

Three text views let one value swallow the whole output: `desktop settings`
printed a 2904-character line (108 hidden models), `task runs` inlined a run's
stored `error_message` verbatim, and `future task wait` did the same inline.
None of them said how long the value was or how to get the rest.

`axi::clip` cuts at a character boundary, names the total size and the flag that
shows the whole thing; `axi::clip_list` folds a long list into its count. The
data formats are untouched — `--json` still carries everything.

- `future desktop settings [--full]`: list values print as `[108 items — add
  --full to see them]`; `--full` prints them in full.
- `future task runs`: the error column is a summary (120 chars) pointing at
  `--json`.
- `future task wait`: the failure text is clipped at 400 chars.

* feat(mobile): a long send queue opens as its header, not over the reply

The send queue is docked in the composer's column, so every row it drew was
taken from the transcript above it. A burst of queued messages — eight goal
pokes is what the report showed — left nothing of the conversation on screen,
and there was no way to put the list away short of clearing it.

The panel now opens as one header line once more than two messages wait, and
the header is the expand/collapse control (the whole row, not the 14pt chevron).
An open list is bounded by the room the screen leaves after the keyboard
(`sendQueueListHeight`, same contract as `sessionPickerHeight`): past it the
rows scroll inside the panel, so expanding a long queue still cannot take the
reply away. What is waiting stays readable while closed — the count, the
merge/parked hint and the parked-row warning all live in the header.

Measured in the screenshot harness, on the reported shape (`?queue=8`, 390×844):
closed, the panel is 50px tall with no rows drawn and the conversation, chart
and all, still readable above it; opened, the list is 240px of a 524px queue
and scrolls.

- SendQueuePanel: header toggle, closed-by-default rule, bounded open list.
- ComposerDock: measures the room for the open list.
- shot mock: `?queue=<n>` gives the chat screen a queue to draw;
  `queue-collapsed` / `queue-expanded` capture both states.
- tests: the closed/open rule, the parked warning staying in the header, the
  bounded list, and the height helper's floor and cap.

* feat(cli): doctor reports as data, and --strict is the only way to fail on warnings

`future doctor` printed ANSI prose and exited 0 with nine warnings, so the one
command an agent asks "is this machine healthy" could not be parsed and could
not fail. `--help` arrived in the previous commit; this adds the other two.

- `--json` prints one object — `{ok, counts:{ok,warn,issue}, checks:[{name,
  status, detail}]}` — with no colour codes, so a caller branches on counts
  instead of counting lines.
- `--strict` makes an issue or a warning a non-zero exit. The default stays 0,
  deliberately: `scripts/ci/check-packaged-entrypoints.py` and the CLI harness
  both run `future doctor` and must not start failing on a warning.

Tests: the JSON form parses, is ANSI-free and lists every check; `--strict`
fails in a home with warnings while the default run still succeeds.

* fix(desktop): a long send queue scrolls inside its own panel

The queue panel floats over the transcript inside a frame that clips
(`overflow-hidden`), and it drew every waiting row at full height. A queue long
enough to outgrow the window therefore had its first rows clipped away above the
frame — not merely unreadable but unreachable: the edit and delete buttons on
those rows could not be hit by any pointer, and the footer's reservation, taller
than the frame it lives in, turned the transcript into blank space. The Agent
holds up to `DEFAULT_SESSION_QUEUE_CAPACITY` = 128 rows for one conversation, so
this is a state a real queue reaches.

The list is now its own scroll container, capped at `min(45vh, 26rem)`, so the
same rows are reachable by scrolling the panel. `useComposerInset` still reserves
the footer's measured height but stops at the frame minus a 120px band of
transcript, and re-measures when the frame itself resizes — the reservation can no
longer outrun the frame. No colours, type, spacing or radii change; the only new
pixels are the list's own scrollbar once it overflows.

Measured in the screenshot harness at the ceiling (`?queue=128`, the new
`queue-many` scenario, 1280×860). Every claim is a rect or a hit test:

  before: panel top −6482 (6530px above the frame), list 7164px with no scroll,
          first row's delete button behind "nothing", transcript −6530px
  after:  panel top 295, list 387px of 7164px, first and last rows' delete
          buttons both hit, composer 56px and hit, transcript 247px painted

Reverting the panel to an unbounded list turns that scenario red on its first
check; reverting the inset clamp is covered by the new
"stops the reservation at the frame" unit test.

* fix(cli): `future doctor --json` actually prints JSON

Reported while showing the new output: `future doctor --json` printed the text
report. The flag never reached the command — a subcommand-less group receives
`--json` as the *second* argv word, which `dispatch` splits into `command`, and
the call passed only `rest`. `doctor` now gets everything after the group name.

The unit test for `doctor()` passed its arguments directly, which is exactly why
this slipped through; the regression test goes through `dispatch` instead and
also pins `--strict`'s non-zero exit.

* feat(mobile,desktop,remote): name a phone by its own id on the device list

A pair id names a connection and is minted again on the next pairing, so two
phones of one model were the same words on the desktop's paired-device list
and neither phone could say which row it was.

- The client's presence beat now carries the device id it is paired under
  (dev_...). The field already exists on the wire (the signed handshake uses
  it), so nothing is bumped: the beat is the one message that repeats, and a
  host that does not know the field reads the beat it always read.
- The server records it onto the identity the secure_ready declared, and a
  beat without one (every older client) keeps whatever is already known.
- The desktop's device row prints the short form after the model name
  (PJZ110 . dev_1a2b3c4d); the full value never reaches that page.
- The phone's own settings gain a Device ID row: short form on the row, the
  full value behind a tap, copyable. It appears once a pairing has minted one.

* fix(desktop): refuse a window launch with no graphical session

A launch from SSH, a daemon context, or a Mac sitting at the login window
never gets a WindowServer connection: AppKit never posts
`applicationDidFinishLaunching`, so `RunEvent::Ready` never arrives and the
process waits in the event loop forever with no window. The only trace was
the stall watchdog repeating "it is at step 'event loop'", which reads like a
deadlock although the launch was never viable.

The session is now asked about once, before the loop is entered: a launch
without a display is refused with a message naming the missing precondition
and both ways forward, and exits 1. `FUTURE_DESKTOP_SESSION=background`
makes the refusal reproducible whatever session the test runs in, and
`desktop_entry` asserts the whole chain — no `Ready` wait, exit code 1,
stderr carrying the remedy, and a host log that stops at the session check.

* fix(remote): never show a device name the wire mangled

A desktop's name reached this machine as `FutureOS Desktop (␦␦␦␦␦␦ļ␦)`: an
environment copy of a Chinese computer name decoded with a local code page
leaves one U+FFFD per lost byte (and one surviving GBK pair). Nothing stores
that value — it lives in the per-connection identity slot, and `app.db` has no
remote tables — so there is no record to migrate, but the leftovers came back
on every connect and they name the device worse than "unknown" does.

Two halves, receiving side first:

- Receive side: a declared name carrying U+FFFD counts as not declared, the
  same as a blank one, so the device list falls back to its own "unknown"
  wording instead of rendering something nobody can read or search for.
- Production side: the label asks the OS for the computer name
  (`SCDynamicStoreCopyComputerName` on macOS, `GetComputerNameW` on Windows,
  the kernel's own file on Linux) instead of reading `COMPUTERNAME`/`HOSTNAME`.
  That variable is a forwarded copy, and any launcher in between can re-encode
  it. It survives only as a fallback for platforms the OS cannot answer for,
  and is refused when it carries replacements.

Both rules are pinned by tests that fail when reverted: the identity rule at
the pure function and at the slot the status page reads, the name rule on the
combination of a good OS answer with a mangled environment copy.

* fix(ci): read this run's jobs without a workflow token

The gate reads `/actions/runs/{id}/jobs` for this run only, and ci-result is a
public repository read: the jobs API answers anonymously. ci-result.mjs still
required GITHUB_TOKEN and threw without it, while the assertion that the
workflow exports the token never had a matching line in ci.yml — so the local
self-test failed on every branch.

Send the token only when the environment provides one, and treat a denied or
throttled anonymous read (403/429) as "this run listed no rows": each planned
group then falls back to its `needs.<key>.result`, exactly as it already does
for a group that ran no rows, instead of failing an all-green run. With a
token the same status stays a real failure, and the 429/5xx retries are
unchanged.

The workflow is untouched. The test now pins the anonymous read, the signed
read, the caller-result fallback, and `CI_NEEDS` (not a token) reaching the
gate.

* fix(desktop): decide a window launch's session before building the window

The guard from 0b21302 ran after `gui_builder(..).build(context)`, which is
too late on Linux: that build initializes the toolkit, and `gtk_init` answers
"no display" by aborting the process inside tao ("Failed to initialize gtk
backend!"), so a headless launch exited 101 from a panic instead of refusing
with the message and exit code 1 the guard promises.

Ask before the build, and give Linux a probe of its own — it was answered by a
no-op there. `DISPLAY`, `WAYLAND_DISPLAY`, `BROADWAY_DISPLAY` and the
`$XDG_RUNTIME_DIR/wayland-0` socket libwayland falls back to are the sources
GTK itself consults; the refusal speaks only when none of them is there, so a
launch that would have opened a window is never turned away.

`setup` is what opens the host log and a refused launch never builds an app to
run it in, so the refusal opens the log itself — under the instance lock, which
is what keeps it from trimming a running Desktop's log.

The retained test now also asserts the launch never reached the window build,
which fails if the check moves back after it.

* fix(cli): shorten a backslashed home the same way on every host

`tilde` built its prefix as `home + MAIN_SEPARATOR`, so the rule followed the
separator of the build it was compiled in rather than the one the path was
rendered with. This machine's unit test then asserted `~/` outright, which on
Windows CI was the only thing wrong: the shortening itself produced the right
`~\x\future` and the assertion rejected it.

Compare rendered text instead — a prefix followed by either separator becomes
`~` plus the rest, keeping the separator the path used — and split the rule out
as `tilde_within` so it can be asserted against an explicit home. The
backslash case is pinned on every host: it is the Windows string CI printed, and
an implementation that only recognizes `/` returns the whole home path back and
turns it red.

The environment-bound test now asserts this host's own separator instead of `/`.

* feat(desktop,host): explain a missing terminal and log a host's capabilities

A paired desktop that does not advertise `terminal_v1` had no terminal
control at all. That is deliberate — the button could only produce an
error — but it reads as a broken window, which is how it was reported:
a machine on a build without the capability looked exactly like a bug in
this one, and neither the window nor `future remote peers` could say
which it was (the peer-state projection drops the capability list, and
nothing wrote it down).

The header now renders the same button disabled, naming the machine and
saying it serves no terminals to paired devices. `terminalScope` stays
the one place that decides whether a panel exists; the new
`remoteTerminalUnsupported` only names the refusal it makes, so the two
cannot disagree about a draft or a non-conversation view.

The host adapter writes the advertised list once per connection it
establishes, which is what makes the question answerable at all
(`grep remote_peer_connected` in the host log).

* fix(remote): advertise one feature list on both handshake paths

`terminal_v1` was never advertised to a current client. The secure
handshake — `secure_open` / `secure_finish`, the only path a paired
desktop takes — sealed `remote-protocol`'s own `SERVER_FEATURES` literal,
which had fallen three flags behind the list the legacy
`pair_handshake_confirm` built: `segmented_content_v1`,
`reasoning_fetch_v1` and `terminal_v1`. A desktop therefore hid the
terminal control on *every* host, including builds whose `future host`
installed the registry, and no version of the host could have fixed it.

The list now lives once, in the protocol crate, and `confirmation` takes
it from the endpoint that owns the host services instead of reading a
constant of its own — the terminal flag is a property of the process, so
it has to be asked for. A test asserts the sealed body equals what the
process serves, so the two can never drift apart again.

* docs(host,terminal): record a host binary replacement and how to ask a host what it advertises

Two things were learned on a shared GPU server that only a document keeps:
a host answers with the binary it was *started* from, so replacing the file
changes nothing until the process restarts; and on a machine that is not
ours, `install`/`rm`/`systemctl` are the owner's decision.

`docs/guide/desktop-host.md` gains the four-step replacement, the rollback
command, the record of the 2026-11-11 install (what was installed, what it
replaced, how it was verified) and the inventory of what a source build
leaves behind — listed, not removed, because that is the owner's call.

`docs/internals/desktop/embedded-terminal.md` gains the probe that answers
"why is the terminal panel missing": `cargo run -p future-host --example
peer_features` prints the host's own capability list, which is the only way
to tell "this machine serves no shells" from "the window is broken". The
example is committed beside it so the documented command exists, and it is
also named as the tool for the gap `future remote peers list` leaves.

* fix(agent): wait for the write lock when an open installs the schema

`initialize_schema` opened a deferred transaction, read the projection
identity, and only then wrote the DDL. In WAL mode that read-then-write
upgrade cannot wait: while another connection holds the write lock, SQLite
fails the upgrade immediately with SQLITE_BUSY_SNAPSHOT ("database is
locked") and never invokes `busy_timeout`, so no timeout setting covers it.
A second connection is the ordinary case here, not an exotic one: the
writer lane reclaims space on its own connection in short slices, and a CLI
command can open agent.db beside the running Agent.

Windows CI hit that once in 3033 tests on a head that changed no Agent code
(`maintenance_preserves_messages_and_usage_and_is_repeatable` failed in
`open_database` with "database is locked"), and a rerun of the same job
failed the same way, which is what a load-dependent lock race looks like.
The new test holds the write lock from a second connection and fails with
"database is locked" in 0.02 s without the change, so the 5 s busy timeout
the opener already sets is demonstrably not part of that path.

Take the write lock at BEGIN through `begin_write_transaction`, the waited
acquisition -- and bounded retry ladder -- the session writes already use.
The transaction's first write moves a couple of statements earlier, so the
schema install holds the write lock for the same duration it always did.

* test(host): pin the unified feature list in the legacy handshake reply

`2cd0f1bfe` moved the advertised capabilities into one list owned by
`future-remote-protocol`, and both handshake paths answer with it. This
expectation still pinned the narrower literal the legacy reply built before
that: `e2ee_v2`, `auto_approval_v1`, `fusion_v1` and `fusion_settings_v1` were
the secure list's own flags, so every paired desktop — the only path a current
client takes — already received them, and the desktop gates its Fusion row, its
approval menu and its confirmation parse on them.

The unified list is the intended answer — the shared `handshake-confirmation`
fixture in `packages/remote-protocol/fixtures/protocol.json` already pins it, in
this order — so the expectation now names all 25 flags, item by item, instead of
relaxing the comparison. `terminal_v1` stays filtered out: it is the one
capability a process decides, and its composition is pinned in
`remote_server::commands::feature_tests`.

* fix(agent): refuse a shell that reaches its handler after a stop

The shell handler read the session's cancel generation and then ran the
command. Admission is counted when the RPC is accepted — in the gRPC layer and
again in the dispatcher — so a command can be admitted before a stop, reach
this handler on its blocking thread after it, and read the generation the stop
already advanced. Nothing is left to cancel it, the drain's "admitted commands"
stage waits out the whole stop budget, and the Agent reports "shutdown deadline
exceeded during admitted commands" with the instance ownership retained
(macOS host-core, 2026-11-11, on a 30-second shell; a one-second delay between
admission and this handler reproduces it deterministically, and the exact
message is what CI printed).

Read the generation first and take the Agent's own admission second, so exactly
one of the two orders applies: a shell that captured the generation before the
stop is cancelled by the advance, and one that reaches admission after it is
refused with `agent_stopping` before a process exists. That is the same
admission `handle_command_internal` already refuses with when a command arrives
after the boundary, applied to the residual window inside the handler.

The fixture test covers the refused direction: a session wired to a closed
Agent, with the generation already advanced, answers in milliseconds with the
`agent_stopping` code instead of running the command.
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