Skip to content

fix(agent): keep a read-only shell from fencing a session; build(make): install-local - #1326

Merged
huichen merged 18 commits into
mainfrom
pr/dev-huichen
Oct 23, 2026
Merged

huichen merged 18 commits into
mainfrom
pr/dev-huichen

Conversation

@huichen

@huichen huichen commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Two changes from two sessions, each verified in its own worktree and merged into
dev-huichen; this PR carries them to main. The rest of the branch's commits
are already on main (the remote-peer row editing landed as #1325), so the
effective diff here is agent/src/rpc/recovery_safety.rs and Makefile.

fix(agent): do not fence a session on an interrupted read-only shell

recovery_safety treated every tool call without a recorded result as an
unknown side effect, so pressing Stop during a git status fenced the whole
session permanently - no later mutation, ever, with no way out. It now asks
command_is_read_only() first, and skips the call from unresolved only when it
can prove there is nothing to repeat.

The proof is deliberately narrow. The default is false; a shell command counts
as read-only only when every segment of the chain matches a two-level
whitelist (program + subcommand), no redirection is present, and cd appears
nowhere but last. rm -rf build, git commit, cargo build, echo hi > f,
git status | tee f, git status; rm x, and anything run through an
interpreter still fence the session exactly as before, and write/edit keep
their existing apply-check - unknown is still unknown.

Known residual, kept on purpose: cd ...; git worktree list; git status still
fences, because cd is not last. Relaxing that is a separate change.

build(make): install-local for the LTO-free binaries

Same destinations as install-cli/install-desktop, so future on PATH and
the Desktop agent (which prepends its own directory to PATH) run the freshly
built pair. The Windows recipe copies through node rather than
copy/if not exist: make runs every recipe through SHELL, which is
sh.exe whenever Git for Windows is on PATH, and cmd builtins plus backslash
paths are not valid there.

make install* keep owning PREFIX for shipping builds; each target overwrites
the other. Windows cannot replace a running image, so start from PREFIX to
have a new binary take effect.

Commits

  • fix(agent): do not fence a session on an interrupted read-only shell
  • build(make): add install-local for the LTO-free binaries
  • feat(desktop): order shortcut sections by use; fold the Vibe panel's keys
  • feat(remote-peer): rename a machine from its row; grey out its settings -
    already on main as feat(remote-peer): rename a machine from its row, and grey out its settings #1325
  • build(make): add build-local for both binaries from one Cargo invocation -
    already on main
  • docs(guide): name the crash log beside the host log - already on main
  • test(host): prove a panicking process writes the report it could not show -
    already on main
  • fix(desktop): keep the rail's search row height when the field opens -
    already on main
  • build(make): add local-profile wrappers for the CLI and desktop binaries -
    already on main

Verification

  • cargo fmt -p future-agent --check, cargo clippy -p future-agent --all-targets -- -D warnings: clean
  • cargo test -p future-agent --lib recovery_safety: 12 passed. Four new tests:
    a table of 40 read-only and 43 mutating commands, a read-only unresolved call
    leaving pause_reason() empty and before_tool open, rm -rf build still
    fencing the session, and the exemption not extending to write.
  • cargo test -p future-agent --lib: 2505 passed, 4 failed - all four fail on
    the baseline too (three sandbox/service probes that pass when run alone, and a
    local-IPC serve_local bind test that fails alone as well).
  • make check-docs; .PHONY and make help both list install-local.
  • 17 files vs. the merge base, 1070 insertions; the branch's remaining
    difference from main is the two files named at the top.

Notes

  • Local quirks, not regressions: make -n here (GnuMake 3.81/GnuWin32) blanks
    every $(shell ...), so a dry run reports the POSIX branch, and
    install-cli/install-desktop themselves remain cmd-syntax under sh.exe,
    untouched by this PR.

huichen and others added 18 commits October 23, 2026 22:19
[profile.local] (added in 464b75b) keeps release optimisation but drops
ThinLTO and reuses the incremental cache. It had no make wrapper, so using it
meant remembering the exact cargo invocation and package name.

Add two targets that are pure additions; no existing target changes:

    build-cli-local:     cargo build --profile local -p future-cli
    build-desktop-local: cargo build --profile local -p futureos

They exist for local verification only and deliberately stay out of
`install*` and `package-desktop`: what ships must keep coming from the
unchanged `release` profile. They also do not wrap the frontend build or the
Tauri bundling `build-desktop` does — they produce the Rust binaries under
target/local/ only.

Measured in a fresh worktree (cold target directory, sccache warm):
build-cli-local 244 s cold, 4.5 s after a one-line edit; build-desktop-local
4 m 42 s cold, 20.6 s after a one-line edit. `cargo build --release` on the
same one-line edit takes ~137 s for the CLI, almost all of it ThinLTO.
The closed magnifier was 28px and the field that replaced it 32px, so clicking it grew the row 4px: the list below jumped and the compact device picker beside it re-centred 2px down. The field now takes the glyph's height, which is also the switch band's and the picker's.
…show

The crash-log unit tests render and append by hand, so a hook that is never
installed — or installed before the home can be resolved — still looked
covered. The new case runs this same test binary as a child with its own
`FUTURE_HOME`, panics in it, and asserts the file exists with `file:line`, the
payload, the startup step and exit code 101 — the code Windows reports as no
crash at all, and the reason the file has to be there.

Also fixes `the_crash_log_is_a_sibling_of_the_host_log`, which read the
process-global home twice: a sibling fixture publishing its own `HOME` between
the reads made it fail in the full suite while passing alone. It now holds
`HomeGuard`'s lock, the same way the other home-comparing fixtures do.
A launch that panics leaves `<root>/app/logs/crash.log`; the troubleshooting
section named only `desktop.log` and `desktop.prev.log`, so the file a reader
needs after "it never came up" was undocumented.
…ation

`make install` already builds `future` and `futureos` together — through
scripts/build/build-desktop.mjs, so they share one dependency graph and one
feature unification — but it runs the release profile, and release carries
`lto = "thin"`, which makes every edit recompile the graph under LTO.

`build-local` gives the same selection on the LTO-free `local` profile:

    cargo build --profile local -p future-cli -p futureos --bin future --bin futureos

One invocation matters for the same reason it matters in build-desktop.mjs:
selecting both packages at once keeps shared crates compiled once and keeps
feature unification aligned with the shipping build, instead of two runs that
disagree and recompile each other's dependencies.

It writes target/local/{future,futureos} only. It does not install into PREFIX,
stage the Desktop sidecar, build the frontend or bundle — `make install*` and
`make package-desktop` keep owning those, unchanged.

Measured in a fresh worktree: 327 s cold for both binaries; afterwards a
one-line CLI edit rebuilds both in 3.7-3.8 s and a one-line Desktop edit in
3.4 s.

No platform-specific syntax: the target is the same three lines on Windows,
macOS and Linux, and `profile.local` lives in the root Cargo.toml.
…ttings

The name and the icon are this machine's own record of a paired computer —
`remote_peer_set_label` writes the local credential book and never reaches
the desktop — so editing them belonged on the row that shows them, not on a
page that is otherwise entirely "read the host, write the host". There they
read as one more remote setting, and were unusable exactly when someone
renames a machine: while it is offline.

Edits now open from a pencil beside the name and save one patch with only
what changed, then re-read the list so the row shows it. The dialog is the
only place these two values are edited; the settings page's copy is gone, so
two surfaces can no longer disagree about one name.

With nothing local left on it, that page needs a live connection to be worth
opening at all, so the row's Settings button is also disabled when the
machine is not connected — with the reason on the wrapping span, the same way
the takeover hint works, because a disabled button receives no pointer events
of its own.
…keys

The shortcuts page listed seven categories in taxonomy order, three of them one
or two rows long, with the Vibe panel's thirty-odd keys in the middle of the
scroll. Sections now follow frequency instead: conversation and navigation
first, the small groups sharing a heading (panels + terminal; palette +
Settings), and the panel last, closed until asked for.

A section heading folds its rows and reports how many keys are behind it, and
how many of them have been changed — a folded section must not be able to hide
the customisation this page exists to report. A search opens every section
before it filters, so a match is never folded away and read as 'no matches'.

The cheat sheet walks the same sections, so the sheet and the page that edits it
list the keyboard in one order.
`build-local` writes target/local/{future,futureos} and stops there, so the
build is invisible to a shell: the Desktop agent prepends its own directory to
PATH (agent/src/tools/shell/execution.rs path_with_own_dir), which means skills
and shell tools resolve `future` next to whatever binary launched them. To use a
local-profile build from the app, both binaries have to sit in the same
directory the app runs from.

`install-local` builds both without LTO and copies them to PREFIX — the same
destinations `install-cli`/`install-desktop` use (`%USERPROFILE%\.future\bin`,
`/opt/homebrew/bin`, `/usr/local/bin`) — so launching the installed `futureos`
resolves `future` beside it.

It is deliberately not a release install: `make install*` keep owning PREFIX for
shipping builds and the two overwrite each other. Skills are untouched
(`make install-skills` remains separate), and no frontend build, sidecar staging
or bundling happens.

The Windows branch copies through node instead of `copy`. make runs every recipe
through SHELL, which is sh.exe whenever Git for Windows is on PATH — there the
cmd builtins (`if not exist`) are a syntax error and unquoted backslash paths are
eaten by bash, which is why the existing Windows recipes in this file cannot run
in that shell. node is already a build prerequisite (the TARGET probe uses it)
and handles quoting, path joins and directory creation in both shells. The POSIX
branch keeps `install -m 755`, whose fresh inode macOS taskgated needs.

Measured on Windows from a worktree: cold `make install-local` 498 s (same cold
build as build-local), an unchanged rerun 3.3 s, and a one-line CLI edit 8.3 s
through compile, install and both copies.
Recovery treated every tool call without a recorded result as an unknown
side effect, so pressing stop while a read-only command like git worktree
list was in flight fenced the whole session: every non-
ead tool was
refused for good.

Classify a shell call by whether its text can change anything observable
instead of by whether a result was recorded. command_is_read_only proves
it from the command text only (never from the model's claim), conservatively:
every chain, pipe and newline segment must be a whitelisted program with a
whitelisted subcommand, no segment may redirect, and command substitution,
grouping, stop-parsing, &, assignments and interpreters stay fenced.
write/edit verification is unchanged.
@huichen
huichen enabled auto-merge (squash) October 23, 2026 15:17
@huichen
huichen merged commit ff88186 into main Oct 23, 2026
25 checks passed
@huichen
huichen deleted the pr/dev-huichen branch October 23, 2026 15:32
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