Repository navigation
feat(tui,desktop,agent,i18n): bilingual surfaces; restart auto-resume retired; recovery named - #1355
Merged
Merged
Conversation
A bridge whose relay grant was refused stayed dead until the process restarted. `desktop.log` from 2026-10-25 shows the shape twice: a relay `draining` event, then fifteen minutes later `User Authentication Expired` on the live socket, then `authorization violation` on every reconnect and nothing else for the rest of the run. `future remote status` kept reporting the machine as serving. Two independent dead ends produced it, and both had the same cause: a credential verdict taken as the end of *recovery* rather than the end of *that generation*. - `watch_generation` returned as soon as `NatsHealth::is_terminal()` was set, so a rejected credential — including one the relay only refused because its authorization cache had not caught up — was never replaced. The generation is disposable by design: `recovery_plan` rebuilds it with `host.refresh`, i.e. a new mint, which is a different thing from rotating the refused grant. It is now treated as one more unhealthy generation, under the existing budget (three rebuilds per ten minutes, then a cool-down that keeps trying instead of stopping). - `spawn_runtime_reconnect` spent exactly one attempt. When the rebuild failed — or answered a status `retryable_start_status` does not call transient, which is what a refused credential does — nothing was scheduled again, because the watch that asked for it had already returned. A failed rebuild now re-arms that watch, so the budget, and not a single attempt, decides when to stop trying. Two supporting changes keep those from being reached for the wrong reason: - `Event::Draining`/`LameDuckMode` ask for a replacement generation. The drain usually arrives just after a rotation, so the grant in hand is the one the retiring node stopped honouring; waiting for the close costs whatever lifetime the credential had left. - The refresh loop no longer connects with a credential that has already expired (a mint that crossed its own expiry, a clock that moved): it records `credential_expired` and asks for another, instead of earning a refusal that ends a generation over a credential dead on arrival. The grant's deadline is now in the status (`credentialExpiresAt`, also a line of the prose report), because "when does it renew" is the question that separates "between rotations" from "lapsed while nobody renewed it" — and it previously had no answer outside the socket log. Tests: two end-to-end regressions in `remote::tests::runtime_tests` (a refused grant is replaced without a restart; a failed rebuild is retried), both failing before this change; the health unit tests now assert that a drain asks for a rebuild and that a successful migration withdraws it. The fixture keeps `automatic_recovery` off, so the two new tests raise a `RuntimeHooks` switch for the duration they need it. Verified: cargo fmt clean; clippy `-D warnings` clean for future-remote-server and future-host on the pinned 1.97 toolchain; 172 + 273 + 123 tests green in the touched modules.
…adlocking
A restart that cut a tool call off left its effect unknown, and
`RecoverySafety` then refused every mutating tool in that session forever:
`unresolved` was recomputed from the transcript on every load, and "unknown
effect" never becomes a result there. Only `read` passed, so any restart that
happened to land on a running shell permanently ended the conversation.
The fence stays the default — nothing is replayed, and a model assertion still
cannot release it — but it now has one explicit, recorded way out:
- `acknowledge_recovery` (CLI: `future session unblock <id> [--why <text>]`)
appends one `custom`/`recovery_acknowledged` entry naming the exact
`(run_id, call_id)` pairs, the time, the caller and an optional reason.
Repeating it is a no-op.
- `RecoverySafety::load` moves those calls from `unresolved` to the `aborted`
tier: that operation is still questioned once per run (the model is told to
verify it read-only first) and every other tool works again. It is not marked
verified, because a human decision is not that fact.
- `pause_reason` now says this is a session-wide fence, tells the model not to
retry, and names `future session unblock <id>` — and it keeps the call id.
`custom` (with a `name`) rather than a new entry type: every projection,
fork/clone and export path already skips unknown types, so the record stays
journal-only and never becomes model-visible context.
Tests pin the un-released behaviour unchanged, the released behaviour (same
call warned once, other tools allowed), idempotency, and that a release for an
unrelated call releases nothing. Docs: guide/session-recovery{,.zh-CN}.md.
The picker only offered 中文/English, so a user who chose once could never go back to tracking the OS. Add a "follow system" preference (the default while nothing is stored), keep it as a stored value rather than a first-run fallback, and resolve it to a bundle whenever it is applied.
`future tui` drew its chrome in Chinese only, so an English reader met Chinese tabs, pickers and key hints in an otherwise English terminal. The chrome now ships both languages side by side in `workbench/i18n.rs` — one key per line with its 中文 and English spelling, so a half-translated key does not compile — and the surface picks one at start: `LC_ALL`, `LC_MESSAGES`, `LANG` (Windows: the user UI language when none is set), else English. `/lang` opens a picker with the same three rows the desktop and the phone use (system / 中文 / English); the choice is persisted as `language` in `~/.future/tui/settings.json` and applied to the frame, the adapter's own sentences and the panels' local facts at once. Content — a conversation, a session title, a path — is never translated. `workbench_demo --lang en` prints either language, and the screenshot capture pins `zh` through that settings file so a baseline does not depend on the machine's locale.
The list stays mounted under an open conversation (`App.tsx`), so its pixel offset survives a visit — but the rows do not. Both the recency page and the two tree pages redraw whenever the catalogue moves: a message appended anywhere re-ranks the row it belongs to, a run that ends leaves "Active", a peer machine's list is re-read after an action on it. A reader who scrolled to a conversation and came back found the same offset over different conversations, which is the "it was not where I left it" report. The FlatList now carries a native anchor (`maintainVisibleContentPosition`), the same one the transcript uses (`useChatScroll`): when the rows above the first visible one change, the view moves its offset to keep that row in place. Within zero of the top it stays at the top instead, because at the head of a page ranked by recency the newest row belongs on screen rather than pushed above it. Verified in the harness (web build, `?recent=1&recentMany=1`): scrolling to a conversation, opening it and coming back leaves `scrollTop` untouched at 902 and the same scroll node, i.e. nothing in JS resets the list — the movement the report describes is the rows, not the offset. tsc, eslint and `jest src/screens` (17 suites, 309 tests) clean.
huichen
enabled auto-merge (squash)
October 25, 2026 15:32
… needed The mechanism was a pair, introduced together in #1313: on startup the Agent continued every run a restart had cut off, and to make that safe it fenced the whole session when a tool call's outcome was unknown. The fence had no release path, so a restart that happened to land on a running shell left that session refusing every mutating tool forever — only `read` got through. #1333/#1337 narrowed it for user-aborted calls; the restart case was left because auto-continuation depended on it. Per the user's decision, the pair goes together. Without an automatic re-issue there is nothing to replay, so the fence guards a call that cannot happen while its own cost — a conversation turned read-only until a human runs a CLI — is real. Removed: - The startup pass and its plumbing: `agent/src/rpc/resume.rs`, the hook in `service/startup.rs`, `resumeInterruptedOnStart` (agent settings and the host's write-through), and the whole "continue a run without a user message" path: `continue_interrupted_run`, `Continuation`, `ResumeContext`, `close_outstanding_tool_calls`, `append_run_continuation`, `run_started_continuation`, `auto_resume_of`. - The fence and its release valve: `agent/src/rpc/recovery_safety.rs`, `acknowledge_recovery`, `future session unblock`, the `custom` `recovery_acknowledged` entry, and their docs. What remains is the informational half, which was designed for this: `repair_dangling_tool_calls` still answers a call whose result never landed with "[Tool execution lost — … so whether it ran is unknown. Check whether it took effect before running it again]", and a crashed run keeps its open `run_started` — the state clients already render as `interruptedRun`. The next run starts from a prompt somebody sent (the user, a client, or a supervising conversation) and closes the crashed run through `append_run_start` like any other boundary, so the journal never carries two open runs. The fence's tests were removed with the file they lived in; the property they encoded is now carried by `append_run_start_closes_an_unterminated_run` (a new prompt closes the crashed run) and the placeholder tests under `session/manager/tests/`. `docs/architecture/agent-supervision.md` §9.1 gains a reversal note and its D8/D9/D10 rows are marked reversed rather than rewritten, so the design history stays readable. Verified on a copy of the session this was reported against (20261025-215423): with the fence gone its `shell` runs again, a kill mid-tool followed by a restart submits nothing, and the next prompt still tells the model that the earlier call's outcome is unknown.
…the table `i18n.rs` makes a half-translated key uncompilable. It says nothing about a string that never went through the table, and that is how the bilingual surface drifts back to one language: every branch that adds a panel adds its own labels, and a hardcoded literal compiles and looks finished in whichever language its author happened to write. The three branches waiting to merge are exactly that case. `tui/tests/i18n_guard/` is the check, run by `cargo test -p future-tui` with no new CI job. It reads the sources and reports `file:line: literal` for two shapes: - Anything with a CJK character under `tui/src/` — chrome is authored in Chinese here, so a Chinese literal is chrome that skipped the table. Content is untouched: a conversation, a title or a path is runtime data. - An English sentence drawn by the surface (`workbench/` plus the modules it pulls display text out of). Two words of three or more letters, in a literal that is not a path, an identifier, an escape sequence or a format skeleton. Test modules are not read (they draw no frame) and `workbench/demo.rs` is exempt as a file (its strings are the content a session carries). The rest is a 30-row allowlist with a reason per row or a same-line `// i18n: <reason>` marker, and `BUDGET` pins the number of exemptions so a new one cannot be added quietly — the test fails until the number a reviewer reads moves too. Stale rows fail as well. On `dev-huichen` the guard is green: 52 files, 2299 literals outside tests, 60 chrome candidates, all exempted. 27 of those exemptions are pre-existing English-only chrome (the notice row, the approval-mode chip, the compaction marker, the folded-output footer) — frozen rather than translated, because translating them would change what a reader sees and belongs in its own change. `docs/tui/i18n-homeless-strings.md` (and its zh-CN pair) documents the rules, the blind spots, the frozen gaps, and the port list for `feat/workbench-ui`, `feat/wb-mentions` and `fix/workbench-degrade`, measured by pointing the same check at each branch's tree and diffing it against the commit where it left `dev-huichen`: 167/120/47 added literals, of which 84/6/41 are new chrome and the rest are already table rows, demo data, or known gaps. It also calls out the strings hardcoded in several places at once so the merge fixes them once. The only change to a drawing path is a comment: the two invariant messages the guard exempts in place carry their `// i18n:` marker. No wording, no behaviour, and no row of the existing 102 keys moved.
A timeout report prints the stage the drain was in when its budget ran out. The admission phase had exactly one name, so "during admission" could not say whether the time went on the session-map snapshot or on one session's lock - "the service is wedged" and "one busy session is wedged" need different answers, and the last three timeouts were all reported as this one name. Split it into "admission: session snapshot" and "admission: interrupting sessions", both set BEFORE the step that may block: a drain stuck past its deadline never reaches its own completion line, and the deadline watcher reads only this name. The initial "admission" stays as the value a report shows when the drain never got as far as either step. Also time both steps and warn past 250 ms, naming the sub-step and the session whose lock was held (with whether it had an active run, read from the guard once it is finally ours). Measurement only: no try_read, no skipped session, no change to `wait` or to the five-second budget, and a timeout still fails exactly as before. Tests drive `drain` on the test thread so a thread-local subscriber sees the warning: a held session write lock produces a warning naming the sub-step and that session and not the uncontended snapshot, and a drain with free locks stays quiet (the threshold must filter, or it would bury the one that matters).
…the race `a_freshly_refreshed_credential_rejected_on_a_live_link_is_terminal` asserted that a refused-but-fresh grant arms no rebuild, and the loaded CI runner printed `[RT001] … rebuilding generation (1/3)` before the entry's status poll noticed the verdict — red on Linux/macOS/Windows `tui-cli` (run 40207454243), green when the case ran alone. The assertion is stale, not the code: `d99a2546d` made a refused grant end only *that generation*, so `watch_generation` now treats the terminal health as one more unhealthy generation and rebuilds it from a new mint. Two components react to the same verdict on independent clocks — the watcher's one-second tick and the entry's one-second status poll — so which line lands first is not a property of the product. What the terminal verdict buys is the endpoint, and that is what the test now asserts: the run must end by itself, it must fail, the reason must be `ServiceAuthorization`, and the last phase the entry reports must be `Failed` — a rebuild may report the replacement live for as long as this broker takes to refuse it, but it must not turn the stop into continued service. `ChildRun` grows `wait_for_exit` and `settled_text` for that; the docstrings and the TAU-D26 index bullet now name the `d99a2546d` contract instead of the arm it replaced. Verified: 14/14 green in five consecutive full runs of the binary on 1.97 (70-72 s each) plus twice standalone; the inverted phase assertion was checked once to fail against the real transcript.
`9c83f6115` removed restart auto-resume and the recovery fence it needed, so the agent no longer reads `resumeInterruptedOnStart`. The desktop kept the switch: toggling it stored a value nothing acted on, which is worse than having no switch, because it read as a guarantee about restart behaviour. Removed: the GeneralPage row and its props/type, the SettingsDialog wiring, the `AppSettings` / `DEFAULT_APP_SETTINGS` / `updateAppSettings` fields, the settings.rs test literal, the en/zh copy, the screenshot fixture, and the CLI surface (`future desktop settings` listed it as settable and wrote it). Kept deliberately: `AppSettings::auto_resume_interrupted` and its stored key read back unchanged, so existing app.db rows and older clients see the same document, with no writer and no UI behind it. `SETTINGS` and the round-trip test's field list are the two places told about that one exception. Verified: desktop vitest 5291 passed, tsc / eslint / vite build clean; cargo test -p future-cli 1398 passed (one PATH-race flake that passes 3/3 alone), future-app-settings 20 passed, host settings + session modules 54 passed; clippy -D warnings on future-cli / future-host / futureos; fmt clean; make check-docs clean.
huichen
added a commit
that referenced
this pull request
Oct 27, 2026
`box_top` measured the label after `fit` had padded it to `inner - 1` columns, so `used` was always the full room, `rest` was always zero, and every titled box drew `╭─ title` and then blanks up to the corner. The composer only showed it once #1355 started passing it a title (`输入 · enter 发送 · ctrl+j 换行`): the top rule of the input box read as gone, and the panel and preview boxes had carried the same blank rule since the workbench landed. Clip the label to its room instead of fitting it to the room, so the `saturating_sub` leaves the remaining columns for `─`. A title that does not fit is still clipped with an ellipsis and the corner stays on the row. The regression test asserts the rule itself, not just the width.
huichen
added a commit
that referenced
this pull request
Oct 27, 2026
`box_top` measured the label after `fit` had padded it to `inner - 1` columns, so `used` was always the full room, `rest` was always zero, and every titled box drew `╭─ title` and then blanks up to the corner. The composer only showed it once #1355 started passing it a title (`输入 · enter 发送 · ctrl+j 换行`): the top rule of the input box read as gone, and the panel and preview boxes had carried the same blank rule since the workbench landed. Clip the label to its room instead of fitting it to the room, so the `saturating_sub` leaves the remaining columns for `─`. A title that does not fit is still clipped with an ellipsis and the corner stays on the row. The regression test asserts the rule itself, not just the width.
huichen
added a commit
that referenced
this pull request
Oct 27, 2026
…empty panels, box-title rules (#1391) * fix(tui): decide colour styling per thread, not by the process environment `theme::tests::no_color_applies_to_composed_styles_and_reverse_video` set `NO_COLOR` in the *process* environment, and every styling helper reads that variable. `cargo test` runs a binary's tests in parallel threads of one process, so for as long as the guard lived, a neighbouring test's `fg()` returned bare text: CI run 40475346830 failed `fg_wraps_with_256_color_and_reset` with `left: "hi"` while the same tree passed standalone. Any of this crate's ~90 colour assertions was exposed, not just that one. The styling helpers now resolve the policy through one function that reads the environment, and let a test inject a value for **its own thread** instead. The existing assertion keeps its exact expectations (`style`/`reverse_raw` go plain) while forcing the policy; a new test checks the production read still answers to the real `NO_COLOR`, which holds whichever way the ambient environment has it. No lock is needed: a thread-local override cannot reach a peer. Evidence: with the old guard plus a 4 s sleep in its window, `theme::tests` failed four colour assertions deterministically (3/3 runs, `raw_variants_omit_reset`, `style_composes_without_double_reset`, `wrapped_styles_emit_exact_sequences`, `raw_styles_omit_trailing_reset`); `NO_COLOR=1` alone reproduces CI's message for `fg_wraps_with_256_color_and_reset` verbatim. With the fix, the same 4 s window inside the injected policy leaves all 32 `theme::tests` green (3/3). * fix(tui): a failed call is one quiet row, not a red block A call that came back an error was the one entry a collapsed transcript still printed in full: a red band across the screen and its whole body in error red. A `cargo test` halted mid-run therefore turned its own diagnostics into the loudest thing on screen and pushed the reply that mattered off it. Every call is now one row, whichever way it ended — the neutral band, a dim `✗`, and the body behind `/tool-output` like any other output. With the bodies open, a failed call's text is painted in the body colour, never the error one. - chat_area: `render_tool_message` stops special-casing `Error`; the collapsed preview and `rows`'s `expanded`/`error` parameters go with it, so a body is only ever drawn at the expanded cap. - tests: the failed-call cases pin the one-row shape, the `✗`, the neutral band, the absence of the red one, and the body one toggle away. - docs: the `/tool-output` row says a failure is collapsed too. `tool_error_bg` stays in the palette — a theme's fields are a contract, and the picker previews them — but this row no longer paints it, and the test holds that line. * fix(tui): install the signal handlers in every profile `sigaction` was called from inside `debug_assert_eq!`, so a release build installed nothing: SIGWINCH never reached the process and a resized window kept painting the geometry it started with (measured on the installed release `future`: 2.36 s later it repainted all 38 rows of the old size, while the debug build answered in 5 ms at the new 26). The termination signals were lost the same way, so SIGTERM/SIGHUP left the terminal in raw mode on the alternate screen. The calls are now plain statements whose error is propagated, with a rollback in `enable_raw` for the pipe and termios it had already set up. The install test reads the dispositions back from the kernel, which is what `cargo test --release -p future-tui` needs to catch this class of bug — it fails against the debug_assert form and passes against this one. * fix(tui): a panel with nothing to list still fills its rectangle The 改动 and 储藏 tabs of a clean checkout, a failed git read, and `/diff` on a clean working tree all returned their box after the four rows they had drawn, so the conversation underneath showed through the rest of the panel's rectangle — `No stashes` sat above rows of the chat. Both surfaces now close their box the way the full lists already did: pad the panel to the frame's height, then the bottom rule. `/diff`'s empty branch also lost its `indent`, so it painted at column 0 while every other branch centred the same box. * fix(tui): draw the rule after a box title instead of padding it away `box_top` measured the label after `fit` had padded it to `inner - 1` columns, so `used` was always the full room, `rest` was always zero, and every titled box drew `╭─ title` and then blanks up to the corner. The composer only showed it once #1355 started passing it a title (`输入 · enter 发送 · ctrl+j 换行`): the top rule of the input box read as gone, and the panel and preview boxes had carried the same blank rule since the workbench landed. Clip the label to its room instead of fitting it to the room, so the `saturating_sub` leaves the remaining columns for `─`. A title that does not fit is still clipped with an ellipsis and the corner stays on the row. The regression test asserts the rule itself, not just the width.
huichen
added a commit
that referenced
this pull request
Oct 28, 2026
Three surfaces each decided for the user whether a reply was worth resuming, and none of them agreed on the shapes they accepted: - host: continue_run's source guard took only a `failed` run, so the row a restart leaves (`cancelled`/`interrupted`) could never be continued — the one thing the failure text tells the user to do after a restart; - desktop: the retry/continue row appeared only for `failed` and never for a stopped reply, and Continue was withheld for model-paused, content-filter and software-error failures; - phone: the same predicate, plus a refusal whenever a stale "still streaming" flag was set — from the outside, one generic "message failed to send" for all of them. The reason a reply stopped is information for the reader, not a permission: the desktop's Continue has always been a plain prompt re-send, and `#1355` retired the automatic resume, so a blocked button has no fallback path. The guard is now identity only — a run that belongs to the addressed session — and every client offers retry/continue on the latest reply that stopped (failed, user-stopped, truncated). Host: identity-only continuation test plus a command-level test that each terminal shape reaches the Agent. Desktop and phone: the recovery rows and their tests follow the same rule.
huichen
added a commit
that referenced
this pull request
Oct 28, 2026
A phone send answered "message failed to send" and never reached the desktop (no run row, no remote-command log). Two local gates can do that: the outbox refused while its own `streaming` flag said the session was busy, and the composer quietly dropped the submit when the timeline said the same. That flag is a projection: it lags a run that already ended — a missed terminal event, a socket that died mid-stream — and with automatic resume retired (#1355) nothing ever clears it, so the session reads busy forever and every message dies as a generic failure. - the phone no longer refuses or swallows a send over its own idea of whether the session is running. The desktop owns that truth: a run still in flight is refused there *before* anything is persisted, and the refusal now carries the stable `session_busy` token (same pattern as `session_not_on_desktop` / `continue_unavailable`). - one catch-all toast is replaced by the sentence that is true: still generating, connection dropped (including a transport timeout), pairing changed, a previous send not yet settled, a reply that cannot continue. The unknown remainder keeps "message failed to send". - the in-flight lane and the physical limits stay: they are about this device, not about guessing the run.
huichen
added a commit
that referenced
this pull request
Oct 28, 2026
…ds; isolate test roots (#1412) * fix(agent): bound the shutdown's listener drain A stop reached its deadline at "RPC listener and streams" whenever a client stayed connected — measured 2026-10-28 20:07: the Desktop's stop failed there, the failure retained instance ownership for the life of the process (the Desktop), and no Agent could start for ~40 minutes. Every scheduled task in that window failed with "unable to connect", and a 48-minute run was cut off. The wait was for Tonic's graceful shutdown, which only ends when every connection ends. One peer that never finished its request was enough, and nothing inside the service could bound it. The listener's share of the stop is now decided by the drain, not the clients: stop_listener keeps the graceful drain, wait_within gives it 500 ms of the five-second budget, and abandon_listener makes the serving future drop the server — closing the listener, its endpoint and every connection — so server_running clears in that same poll and the stop finishes as Stopped. A drain that still times out (a stuck storage write, a host that never polls `serve`) keeps today's behaviour: instance ownership is retained. The Desktop watchdog also stops skipping a refused recovery in silence; the one state that still needs a process restart now says so, rate-limited. Tests: agent/tests/shutdown_bounded.rs (a raw TCP client held open across the stop: Stopped in ~520 ms, replacement service in ~30 ms) and the host fixture `stalled`, which used to assert the opposite behaviour. * fix(remote): continue a reply an app restart interrupted A run the desktop's startup convergence settles cancelled/interrupted was refused by continue_run's source guard, which accepted only `failed`. The failure text tells the user to restart and then click Continue, so on the phone that button could never work — it answered "Only a failed run can be continued." and the client showed its generic "message failed to send". - host: a continuation source is a run that stopped without finishing — `failed`, or the `cancelled` row a restart leaves (`error_type = interrupted`). A completed run, and one the user stopped themselves, are still refused. - host: refusal carries the stable `continue_unavailable` token (same pattern as `session_not_on_desktop`) so a client can name the reason. - mobile: a refused continuation says the reply can no longer be continued instead of reading as a send/network failure. * feat(host): record the desktop's half of every remote command A phone that reports a conversation load timeout leaves exactly one question: was the desktop slow to answer, or was the relay slow to carry the answer? On 2026-10-28 that question was answered twice by guessing, and both answers were wrong, because the desktop kept no record of its own execution time. Measure every business command the desktop executes (`get_state`, `get_session_entries`, `get_read_chunk`, `get_events_since`, ...) and write a row into `desktop.log` when it was slow (>= 1 s) or failed: remote command slow: type=get_session_entries session=... elapsed=...ms remote command failed: type=get_state session=... elapsed=42ms error=... Heartbeat commands never report. A phone timeout with no slow row here is a transport symptom; a slow row names the exact read that was expensive. The row carries the command's type, session, elapsed time, reply bytes (binary pages only: measuring a JSON reply's size would serialize it for telemetry) and the error string, never its content. The sink decorator forwards both reply carriers: relying on the trait's default `send_binary` would downgrade a negotiated binary page to base64-in-JSON, which is a different wire shape from the one the connection declared, so the carrier test runs in this change's own set. * fix(i18n): name an app restart as the reason a reply stopped A restart settles the run the app was in the middle of as `cancelled`/`interrupted` with "Interrupted by application restart.", and the shared classifier fell through to the generic `failure.run`, whose title is "the model service failed". Nothing was wrong with the model, and the advice underneath (retry the request) points at the wrong thing. Classify it as its own outcome — "an app restart interrupted this reply, click Continue to pick it up" — in the desktop's zh/en bundles and the phone's, since both render from the one classifier. * feat(remote): continue any reply that stopped, whatever the reason Three surfaces each decided for the user whether a reply was worth resuming, and none of them agreed on the shapes they accepted: - host: continue_run's source guard took only a `failed` run, so the row a restart leaves (`cancelled`/`interrupted`) could never be continued — the one thing the failure text tells the user to do after a restart; - desktop: the retry/continue row appeared only for `failed` and never for a stopped reply, and Continue was withheld for model-paused, content-filter and software-error failures; - phone: the same predicate, plus a refusal whenever a stale "still streaming" flag was set — from the outside, one generic "message failed to send" for all of them. The reason a reply stopped is information for the reader, not a permission: the desktop's Continue has always been a plain prompt re-send, and `#1355` retired the automatic resume, so a blocked button has no fallback path. The guard is now identity only — a run that belongs to the addressed session — and every client offers retry/continue on the latest reply that stopped (failed, user-stopped, truncated). Host: identity-only continuation test plus a command-level test that each terminal shape reaches the Agent. Desktop and phone: the recovery rows and their tests follow the same rule. * fix(mobile): send, and say why, instead of guessing from local state A phone send answered "message failed to send" and never reached the desktop (no run row, no remote-command log). Two local gates can do that: the outbox refused while its own `streaming` flag said the session was busy, and the composer quietly dropped the submit when the timeline said the same. That flag is a projection: it lags a run that already ended — a missed terminal event, a socket that died mid-stream — and with automatic resume retired (#1355) nothing ever clears it, so the session reads busy forever and every message dies as a generic failure. - the phone no longer refuses or swallows a send over its own idea of whether the session is running. The desktop owns that truth: a run still in flight is refused there *before* anything is persisted, and the refusal now carries the stable `session_busy` token (same pattern as `session_not_on_desktop` / `continue_unavailable`). - one catch-all toast is replaced by the sentence that is true: still generating, connection dropped (including a transport timeout), pairing changed, a previous send not yet settled, a reply that cannot continue. The unknown remainder keeps "message failed to send". - the in-flight lane and the physical limits stay: they are about this device, not about guessing the run. * test(cli,host,agent,channels,rpc): move the FutureOS root, never drop it `FUTURE_HOME` is not a second way to say `HOME`: the files follow either, but the local endpoint is named from the override alone (an absent one resolves to the untagged default socket/pipe). So a fixture that redirected `HOME` and *removed* the override had isolated files and nothing else — its auth.json assertions passed while the process still reached the developer's running Agent, and any path the fixture printed looked isolated. Every isolation helper now points the root at `<temp>/.future` instead of unsetting it: `cli::test_env::EnvGuard` (both `set` and `with_temp_home`), `host::auth_store::test_support::HomeGuard` (which the Desktop's wrapper delegates to), `agent`'s `TestHome`, and `channels`' `IsolatedHome`. That value is what "override absent + this HOME" already resolved to, so no path assertion changed. `EnvGuard::set` also derives it, because that constructor is what the ~130 cli fixtures that keep their own `Home`/`Fixture` structs go through: with an ambient override in the developer's shell, those wrote their app database, workspaces and task store into the real `~/.future`. A decoy override run of `cargo test -p future-cli --lib` proved it — 70 failures, every one an ambient-clean assumption — and the same run is now 1358/1358. `cli/tests/golden-diff.sh` exports `FUTURE_HOME="${HOME}/.future"` and clears `FUTURE_AGENT_SOCKET`. All 15 goldens that embed a path name `<case_home>/.future/...`, so the value reproduces them byte-for-byte. Two ambient-dependent assertions are pinned rather than relaxed, since they only held on a machine with no override: `browser::screenshot_writer::browser_dir_honors_future_home_env` now names the home it derives from instead of reading `dirs::home_dir()`, and `channels::config::default_path_contains_channels` now asserts the path is under the fixture's own root. New guards, both directions: * `packages/rpc` `local_pipe_name_moves_with_the_future_home_override_and_not_with_home` — with the override the pipe carries the home tag; `HOME` alone leaves it the untagged default (the running Agent's name). Names only, nothing is bound. * `host` `a_live_home_guard_redirects_the_future_home_root_it_created` — deleting the one line that fixes the guard turns it red. * `cli` `set_redirects_the_future_home_root_with_the_home_it_redirects` — an ambient value is replaced while the guard lives and restored on drop, and an explicit `FUTURE_HOME` is still the caller's decision. * fix(mobile): a fatal client is rebuilt on recover, not probed forever A fatal RemoteClient is terminal by design: `transition` keeps it in `failed` and `assertBusinessReady` answers `communication_frozen` to every request, so a conversation stops opening and a prompt stops sending. The state machine's own answer is "a manual reconnect creates a fresh RemoteClient" -- but the phone only ever called `connect()` at bootstrap, so nothing in the app could perform that manual reconnect. `recoverNow` returns immediately for a terminal client, and the timeline's Retry called exactly that. The only way out was to kill the app, which is what the user reported doing. The runtime's recovery now reads `client.connectionState` (a new public getter) and rebuilds the client with the same credentials when it is `failed`; a `revoked` pairing still waits for a fresh pair, as before. The timeline's Retry goes through that runtime recovery instead of `client.recoverNow`, so the button reaches the branch that can actually heal the connection. A recovery skipped because AppState says the app is not active is now logged too: that is the other state an app restart used to be the only way out of, and a log line turns it from a spinner into evidence. Measured: the new mobile test fails without the rebuild branch (`recoverNow` is called and no new client is created), and the lifecycle test proves a fatal open leaves `connectionState === "failed"` with `recoverNow` a no-op. * fix(remote): say when a history page is short of the requested exchanges The phone opens a conversation with a backward read for three user exchanges. It can be answered with fewer: the byte budget sheds whole oldest exchanges, and the Agent itself cuts a backward read at its own row and byte limits (64 display rows), so a tool-dense exchange comes back as a fragment. `trimmed` reported only the first bound, so a page shortened by the second arrived looking complete. Measured 2026-10-28 on session 4a107f50 (213 display rows, three exchanges, the newest a 15-minute run with 50 tool calls), replaying the shipping path against the live Agent: - the tail read returned 64 tool rows with no prompt among them; - history assembly completed that prefix back to its prompt, so the delivered page was one exchange of 870 KB with `hasMore: true` and `trimmed: false` — the byte budget had nothing left to shed, because only one exchange was there; - the phone installed it as the whole window: the transcript drew the newest reply with nothing above it, and a pull-to-refresh re-read the same page, which is exactly what the user reported. `mark_short_backward_page` closes the gap in the contract the client already implements: a page holding fewer user exchanges than were requested, with more history behind it, says `trimmed` however it was shortened, and the client backfills to the window it asked for. A page with nothing behind it, and a page the caller asked to keep whole, stay unmarked. Replaying the same session with the flag set gives the phone the three exchanges it asked for (212 rows, 4.9 MB over three reads) instead of the last question and answer. * test(host): withdraw the FutureOS root too when a test needs "no home" `HomeGuard` now publishes `FUTURE_HOME` at `<temp>/.future` so that a fixture isolates the whole FutureOS root and not only its files. Eight host tests still produced "no home" by removing `HOME`/`USERPROFILE` under that guard, and the override kept answering with a real root: `pairing_path_requires_a_home` failed outright (`pairing_path()` resolved the fixture root), and the rest had silently degraded into their ordinary-case arm — `unpair` persisted when the persist was supposed to fail, `load_creds()` reported "no pairings" instead of an error, and the agent-credentials guard, the chat-scratch root and the preview-cache root all resolved. `HomeGuard::withdraw_home` withdraws every way to name a root — `HOME`, `USERPROFILE` and `FUTURE_HOME` — for the rest of the guard's life, and `restore` puts all of them back; `USERPROFILE` is saved now too, so a Windows run no longer leaves it cleared. The tests use it instead of one-off `remove_var` plumbing, and each asserts its premise (`future_dir()`, `chat_workspaces_root()` or `remote_previews_dir()` must fail), so none of them can pass while a root still resolves: dropping the `FUTURE_HOME` line from the fixture turns all nine red, the new guard self-test included. Left alone, because their subject is a guard's own restore arm rather than a product path resolution that needs "no home": `fixture_drop_removes_home_when_unset_before`, `channels::isolated_home_without_prior_home_removes_it`, and the `None => remove_var` arms themselves. Verified: `cargo test -p future-host --lib` 1847 passed / 0 failed / 11 ignored, `-- remote_host` 178 passed, `-- auth_store` 14 passed, `cargo fmt --all -- --check` and `cargo clippy -p future-host --all-targets -- -D warnings` clean. * test(agent,cli): a root the fixture owns and a port nothing else can take The agent fixture now moves the FutureOS root into its own home instead of dropping an inherited override, but `test_home_isolates_and_restores_an_inherited_future_home` still asserted the old semantics, so `TestHome::new()`'s own `FUTURE_HOME` failed the test on every platform. The test now asserts what the fixture does: the override is replaced by `<canonical home>/.future` and differs from the inherited value, `future_home()` follows it, and dropping the fixture restores the inherited override for both the env var and the resolver. The safari probe-budget test asked `bind("127.0.0.1:0")` for a free port and dropped the listener, which only proves the port was free at that instant: another fixture's `:0` bind can be handed it before the driver is asked to listen, and the poll then meets a stranger's mock instead of silence (`No sessionId in createSession response: {}` on CI). Test ports now come from `test_env::reserved_port`, a band below every supported platform's ephemeral range, proved free and handed out once per process, so no `:0` bind can claim it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Two threads that meet in the same recovery code. The TUI, the desktop settings and the docs now follow the reader's language, and the desktop picker gains a follow-the-system default. On the recovery side, a refused relay grant no longer ends recovery, an explicit restart-recovery fence replaces the implicit one that could deadlock, and the restart auto-resume machinery — plus the setting and the switch that existed only to feed it — is retired now that a shutdown reports the sub-step it is stuck in. A mobile reader keeps its scroll row across a re-ranking conversation list, and two tests are tightened so they assert an outcome rather than a race.
Commits
Verification
cargo fmt --all -- --check— clean.cargo clippy -p future-cli --all-targets -- -D warnings— clean.cargo test -p future-cli --test remote_start_refusal— 14 passed, six consecutive runs (the previous head was red on the race-sensitive assertion this branch now replaces).cargo test -p future-tui --lib— 1026 passed.tsc --noEmitandeslint— clean; the settings suites touched by the auto-resume removal pass.make check-docs— 327 docs OK (bilingual pairing, links, fences).CI for this head runs the full matrix.
Notes
future session unblockand the restart auto-resume setting are gone; nothing auto-resumes a session after a restart any more. A session that survives a restart is one that was never interrupted, and an interrupted one is reported rather than silently continued.