Skip to content

feat(desktop,mobile,host): shared machine icons; release stuck deletion intents; scoped workspace - #1314

Merged
huichen merged 15 commits into
mainfrom
pr/huichen
Oct 23, 2026
Merged

huichen merged 15 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

A paired machine was drawn with an emoji, so the same machine looked like three different machines depending on the platform's colour-emoji font (Apple on macOS, Noto on Android, Segoe on Windows, a monochrome glyph when the stack fell through). Both clients now draw the mark from the line-icon set each already ships, over one shared id list in a new workspace package @future-os/peer-icons; every surface that showed the emoji shows the drawn mark, and desktop and phone finally agree on the picker, the row, the settings header and the chat top bar.

This branch also fixes a host leak and the workspace control the device filter used to hide. A deletion intent enqueued without ownership evidence was refused by every delivery pass while its fence kept the session out of every import, so the conversation stayed in the Agent database for good (measured 2026-10-23: 176 such intents hid 180 conversations). And with the picker narrowed to a paired machine, the workspace section's "+" disappeared — it now opens the form for the machine whose workspaces are on screen.

Commits

  • feat(peer-icons): draw a machine's mark from one icon set, not emoji — one shared id/label list in @future-os/peer-icons, one typed id-to-picture table per client, and the emoji removed from every surface.
  • feat(peer-icons): paint each machine mark in its own colour — the mark carries the accent tint on both clients instead of inheriting a font colour.
  • fix(host): release deletion intents the GUI can never deliver — the 60s discovery pass releases only intents a delivery already refused, with no ownership evidence and a session the Agent still reports present; the predicate is re-checked inside its write transaction so an intent that becomes deliverable in between survives.
  • docs(desktop-host): explain a tmux or SSH launch that shows no window — records what was measured (both session probes report the same in a working session) and the three ways out.
  • fix(desktop): draw a paired machine's icon the way the phone does — both clients share PeerIconChip: 36px box, 12px radius, surfaceSubtle backing, 20px glyph.
  • fix(desktop): draw the remote-desktop icon picker like the phone's — the same grid, tile size and accent tint instead of a dense 32px square.
  • fix(ci): give @future-os/peer-icons the shared TypeScript pipeline — the new source package is registered in scripts/ci/typescript-checks.mjs's shared list (otherwise the test matrix asks it for a typecheck script it does not have), and it carries real assertions on the shared id list; a source package now fails loudly rather than being inferred from a missing script.
  • feat(desktop): create a workspace on the host the list is filtered to — the rail's "+" stays under a paired-machine filter and opens that machine's create form, offered only by a host advertising workspace_create_v1.

Verification

Local, on the branch tip before freezing:

  • cargo fmt --all -- --check → clean
  • cargo clippy -p future-host --all-targets -- -D warnings → clean
  • cargo test -p future-host --lib → 1785 passed, 0 failed, 10 ignored (484s)
  • desktop: npm run lint (eslint + tsc --noEmit) → 0 errors (1 pre-existing jsdoc warning in recentOrder.ts); npx vitest run src → 374 files / 5198 tests passed
  • mobile: npm run typecheck clean; npx jest --runInBand src/screens/__tests__ src/remote/__tests__ src/features/chat/__tests__ src/features/settings/__tests__ → 2131 passed
  • node scripts/tests/ci-plan.test.mjs → 23 of 24 pass; the one failure (install-apt-packages.sh --self-test) reproduces on an unmodified origin/main checkout and is macOS-local, not from this branch
  • CI itself, after the repair commit: the @future-os/peer-icons typecheck/build/test/lint phases run green via scripts/ci/typescript-checks.mjs

Notes

  • packages/peer-icons is a new npm workspace package (@future-os/peer-icons); npm install at the repo root is required before the desktop/mobile builds and package-lock.json carries the new link.
  • The host change alters behaviour: an intent that no delivery can ever satisfy and whose session the Agent still holds is now released instead of fencing that session out of every import. Intents that named their database keep their fence, so a user delete is never undone.
  • The desktop workspace control now targets the filtered host; a host that does not advertise workspace_create_v1 still gets no button.

The paired machine's icon grid was a dense 32px square with a 16px glyph on
the desktop and a 44px tile with a 20px one on the phone, so the same control
read as two different ones. Match the phone's tiles: 44px, 12px radius, 20px
glyph, 8px gap, `line` border on `surface` for the rest and `accent` on
`accent-soft` for the machine's own.
The phone puts a machine's glyph on a soft chip — 36px, 12px radius,
`surfaceSubtle` behind, a 20px glyph — in its deskop list and on a machine's
settings page. The desktop drew the same machine as a bare 12–18px emoji, so
the one mark a user picks to recognise a machine looked smaller and unbacked
here than on the phone. Both now share `PeerIconChip`: the same box, radius,
backing and glyph size as the phone's `desktopIcon`/`deviceIcon`.
A `futureos` started from a tmux pane whose server came from an SSH login
creates its window at the right size and reports it on screen, but the
process never registers with LaunchServices: no Dock icon, no Command-Tab
entry, and nothing can raise it above the app already on screen, which reads
as "no window opened". Both `CGSessionCopyCurrentDictionary()` and
`launchctl managername` report the same in a session that works, so the guide
states what was measured instead of offering either as a diagnosis, and lists
the three ways out (`tmux -L gui`, `open -a FutureOS`, restarting the server
from a desktop terminal) plus the silent one-second exit of a second launch.
An intent enqueued without ownership evidence — no `agent_delete_sources`
row and no `thread_sources` row — is refused by every delivery pass, while
`is_agent_session_tombstoned` keeps fencing its session out of every import.
The conversation stays in the Agent database and no pass may mirror it again:
a permanent leak no later tick can repair on its own (measured 2026-10-23:
176 such intents hid 180 conversations).

The 60s discovery pass now releases only intents that a delivery already
refused (`attempts > 0`), hold no ownership evidence at all, and whose
session the Agent still reports `present`. Everything else keeps its fence,
so a user delete that named its database is never undone, and a session the
Agent no longer holds is left alone. The release predicate is re-checked
inside its write transaction, so an intent that becomes deliverable between
the probe and the write survives.

Debug ▸ Reset keeps its intents' fences until the drainer refuses them; for
sessions it cannot attribute to a database the purge was already
undeliverable, so those conversations now return instead of leaking.
An emoji is drawn by whichever colour-emoji font the platform ships: Apple's
picture on a Mac, Noto's on Android, Segoe's on Windows, and a monochrome text
glyph wherever the stack fell through to one. One machine therefore looked like
three different machines depending on what you were holding, and the picker
promised a picture it could not keep.

Both clients now draw the mark from the line-icon set each already ships
(`lucide-react`, `lucide-react-native`), over one shared id list in a new
workspace package `@future-os/peer-icons`: ids, order and label keys live there
and nowhere else, and each app keeps only its own id-to-picture table, typed as
a complete `Record` so a new id fails the build until it is drawn.

Every surface that showed the emoji shows the drawn mark now — the picker, a
machine's row, its settings header, the rail's source marks, the device
selector, the chat top bar, and the phone's lists and pickers. The selected
picker tile tints its glyph in the accent colour on both clients, so the choice
reads as something the app drew rather than something the OS supplied.
A line icon fixed the shape mismatch between clients but lost what the emoji
had given for free: colour. Twenty monochrome outlines in one grid are hard to
tell apart at 20px, and the picker read as a settings table rather than as a
set of pictures.

Each id now carries a hue and, derived from it, a low-alpha wash. Both live in
`@future-os/peer-icons` for the same reason the ids do: a colour chosen per
client would put the rocket orange in one list and red in the other, which is
the mismatch the shared set exists to remove. The hues are mid-tones, legible
on the light and the dark surface alike, since neither client swaps them per
theme.

The glyph is painted in its hue and the chip a machine sits on takes the same
hue at 14% — the phone's lists and pickers, the desktop's rows, headers and
picker, so one machine is one colour on both. The chosen picker tile is marked
by its frame rather than by recolouring its glyph: the glyph's colour is what
the choice is about.
@huichen
huichen enabled auto-merge (squash) October 23, 2026 03:27
`packages/peer-icons` is a source-only workspace library — TypeScript sources,
no scripts of its own — but it never made it into the `shared` list in
`scripts/ci/typescript-checks.mjs`. The affected planner selects it, so every
phase fell through to `script(...)` and died on `${pkg.name} must define
typecheck` (and `test`, and `lint`), turning
`TypeScript test / @future-os/peer-icons` and
`TypeScript check / @future-os/peer-icons` red.

Register the package alongside markdown, thread-projection and json-preview so
it gets the same pipeline: `tsc --noEmit`, a declaration emit into RUNNER_TEMP,
the shared vitest project and the shared ESLint config.

The shared test phase runs `vitest ... peer-icons/src/`, and a positional
filter with no matching file exits non-zero, so the package also gains a test
of what only it can break: ids unique and storable in a label file, every id
round-tripping through `peerIconId` while unknown/hand-edited/prototype-key
values fall back to the default, and each mark painted with a wash derived from
its own hue. The glyph tables are not imported — `Record<PeerIconId, …>` in each
app already fails that app's typecheck when an id lacks a picture.
With the device picker narrowed to a paired machine, the workspace
section's "+" disappeared: the only control there opened this machine's
create form, and under another machine's filter it was withheld because a
workspace made here is one the reader cannot see. That left no way to add
a workspace on the machine whose workspaces are on screen — which the
phone's workspace tab can do.

The control stays and is addressed to the host instead: the picker has
already answered "which machine", so the create dialog opens for it
directly, the same answer the chat section's own "+" gives under that
filter. Only offered by a host that advertises `workspace_create_v1`, so
an older build does not get a button the host would refuse.

Covered at the component boundary (whose control appears, and where it is
addressed), through the rail (the handler receives the host's id), in the
shell (no device dialog on that path), and as a screenshot scenario that
walks the real UI: pick the machine, click its "+", land on its form.
@huichen huichen changed the title feat(desktop,mobile,host): one shared machine icon set; release undeliverable deletion intents feat(desktop,mobile,host): shared machine icons; release stuck deletion intents; scoped workspace Oct 23, 2026
@huichen
huichen merged commit 75ea334 into main Oct 23, 2026
49 checks passed
@huichen
huichen deleted the pr/huichen branch October 23, 2026 04:49
huichen added a commit that referenced this pull request Oct 23, 2026
The size scale's floor (10px, #1317/#1318) is only visible in two places: a
pending attachment's byte size in the composer (the 10 design size) and an
approval card's own label (the 11 design size). Neither state was reachable from
the demo catalogue — the composer's draft is empty in every capture, and the
demo conversation never carries an approval — so the only evidence those two
labels clear 10px was a rendering of the numbers, not of the screens.

Two opt-in fixtures, both reproducing state the shipping code reads:

  ?draft=attachments  seeds `draftStorage`'s record for the new-conversation
                      slot, which the composer restores through
                      `loadSessionDraft` exactly as after a visit.
  ?approval=1         feeds a real `approval_request` event through the
                      shipping projection, so the card and its label are the
                      ones the app draws.

Nothing under `src/` is replaced or bypassed, and `leanRender.ts` is untouched:
both hooks are the query-param pattern the mock already uses for `?recent`,
`?held` and `?compactionDelay`.

Two scenarios capture them at the smallest text size and assert what the
capture is for: both sizes are ≥ 10px and neither label overflows its box.
Without the floor they fail (`[9,9]` and `9`) — checked by removing it.

One thing the captures show that is not changed here: the approval label reads
"SHELL 命令" — `textTransform: uppercase` only affects the Latin half of the
localised string, so the zh label is not uniformly uppercase. Cosmetic, and
out of scope for a fixture.

Pre-existing, unrelated: `capture-mobile chat` fails on the base commit too
("the badge carries no glyph: 实验室的 MacBook Pro"), since #1314 moved machine
icons from emoji to components. Not touched here.
huichen added a commit that referenced this pull request Oct 23, 2026
)

The size scale's floor (10px, #1317/#1318) is only visible in two places: a
pending attachment's byte size in the composer (the 10 design size) and an
approval card's own label (the 11 design size). Neither state was reachable from
the demo catalogue — the composer's draft is empty in every capture, and the
demo conversation never carries an approval — so the only evidence those two
labels clear 10px was a rendering of the numbers, not of the screens.

Two opt-in fixtures, both reproducing state the shipping code reads:

  ?draft=attachments  seeds `draftStorage`'s record for the new-conversation
                      slot, which the composer restores through
                      `loadSessionDraft` exactly as after a visit.
  ?approval=1         feeds a real `approval_request` event through the
                      shipping projection, so the card and its label are the
                      ones the app draws.

Nothing under `src/` is replaced or bypassed, and `leanRender.ts` is untouched:
both hooks are the query-param pattern the mock already uses for `?recent`,
`?held` and `?compactionDelay`.

Two scenarios capture them at the smallest text size and assert what the
capture is for: both sizes are ≥ 10px and neither label overflows its box.
Without the floor they fail (`[9,9]` and `9`) — checked by removing it.

One thing the captures show that is not changed here: the approval label reads
"SHELL 命令" — `textTransform: uppercase` only affects the Latin half of the
localised string, so the zh label is not uniformly uppercase. Cosmetic, and
out of scope for a fixture.

Pre-existing, unrelated: `capture-mobile chat` fails on the base commit too
("the badge carries no glyph: 实验室的 MacBook Pro"), since #1314 moved machine
icons from emoji to components. Not touched here.
huichen added a commit that referenced this pull request Oct 23, 2026
`capture-mobile chat` had been failing with "the badge carries no glyph" since
#1314 replaced the emoji machine marks with the shared icon component
(`PeerIconGlyph`). The assertion looked for `💻` in the badge's text, which is
where an emoji would have been — the picture changed, the check kept reading
text. The same assertion in `capture-desktop remote-conversation` looked for
`💻` too and was still passing only by accident: the desktop badge's emoji had
already become an icon, so it was one glyph away from the same failure.

Both now check the fact the assertion was ever about: that the mark rendered.
The badge must contain an `<svg>` at least 8x8 carrying at least one shape. That
still fails when the icon stops drawing — verified by removing it, which turns
both captures red ("draws no machine icon") — and no longer cares whether the
mark is an emoji, a line icon, or something else later.

The two spots are the only glyph lookups in the scenario table; the remaining
single-character assertions all match real copy (中 / 你 / 接管 / 本机 / …), so
nothing else changed. `scripts/screenshots/scenarios.json` is the only file,
two lines replaced.

Not in scope, for the record: the shot scripts run in no workflow, which is why
this assertion could rot from #1314 until now with nothing noticing. Whether to
put them in CI is a cost decision for the product side, not something this
change should slip in.
huichen added a commit that referenced this pull request Oct 23, 2026
… rows and the last log tail (#1321)

* feat(desktop-shot): render the two sub-`text-xs` labels on demand

The size scale's floor (10px, #1317/#1318) is only visible in two places: a
pending attachment's byte size in the composer (the 10 design size) and an
approval card's own label (the 11 design size). Neither state was reachable from
the demo catalogue — the composer's draft is empty in every capture, and the
demo conversation never carries an approval — so the only evidence those two
labels clear 10px was a rendering of the numbers, not of the screens.

Two opt-in fixtures, both reproducing state the shipping code reads:

  ?draft=attachments  seeds `draftStorage`'s record for the new-conversation
                      slot, which the composer restores through
                      `loadSessionDraft` exactly as after a visit.
  ?approval=1         feeds a real `approval_request` event through the
                      shipping projection, so the card and its label are the
                      ones the app draws.

Nothing under `src/` is replaced or bypassed, and `leanRender.ts` is untouched:
both hooks are the query-param pattern the mock already uses for `?recent`,
`?held` and `?compactionDelay`.

Two scenarios capture them at the smallest text size and assert what the
capture is for: both sizes are ≥ 10px and neither label overflows its box.
Without the floor they fail (`[9,9]` and `9`) — checked by removing it.

One thing the captures show that is not changed here: the approval label reads
"SHELL 命令" — `textTransform: uppercase` only affects the Latin half of the
localised string, so the zh label is not uniformly uppercase. Cosmetic, and
out of scope for a fixture.

Pre-existing, unrelated: `capture-mobile chat` fails on the base commit too
("the badge carries no glyph: 实验室的 MacBook Pro"), since #1314 moved machine
icons from emoji to components. Not touched here.

* fix(screenshots): check the machine mark rendered, not for an emoji

`capture-mobile chat` had been failing with "the badge carries no glyph" since
#1314 replaced the emoji machine marks with the shared icon component
(`PeerIconGlyph`). The assertion looked for `💻` in the badge's text, which is
where an emoji would have been — the picture changed, the check kept reading
text. The same assertion in `capture-desktop remote-conversation` looked for
`💻` too and was still passing only by accident: the desktop badge's emoji had
already become an icon, so it was one glyph away from the same failure.

Both now check the fact the assertion was ever about: that the mark rendered.
The badge must contain an `<svg>` at least 8x8 carrying at least one shape. That
still fails when the icon stops drawing — verified by removing it, which turns
both captures red ("draws no machine icon") — and no longer cares whether the
mark is an emoji, a line icon, or something else later.

The two spots are the only glyph lookups in the scenario table; the remaining
single-character assertions all match real copy (中 / 你 / 接管 / 本机 / …), so
nothing else changed. `scripts/screenshots/scenarios.json` is the only file,
two lines replaced.

Not in scope, for the record: the shot scripts run in no workflow, which is why
this assertion could rot from #1314 until now with nothing noticing. Whether to
put them in CI is a cost decision for the product side, not something this
change should slip in.

* feat(host): keep the previous run's log tail and timestamp host reports

`app/logs/desktop.log` is a 1000-line ring buffer, so a launch that never came
back was evicted within minutes of the next ordinary session: the only evidence
left for "what went wrong?" was gone.

`start_logging` now copies the newest 1000 lines left by the previous run to
`desktop.prev.log` beside it, before the live log is opened and trimmed. The
tail is located by scanning backwards in 8 KiB reads (no whole-file buffer),
written through a staging file and renamed into place, and best effort: a copy
that cannot be made never costs this launch its log. The live file keeps its
name, format and retention unchanged.

`report()` output now leads with a UTC stamp shaped like the tracing rows in the
same file (`2026-10-23T12:41:16.186523Z`), on stderr and in the log. Without it,
two launches twenty minutes apart read as one simultaneous pair.

* fix(desktop): keep a remote host's rows through a catalogue read it did not answer

The merged list is built from the hosts' catalogues, and every 5 s poll replaced them wholesale: a connected host whose list_sessions read failed (a store busy serving the page the user had just opened, one round trip timing out over a live socket) had its entry dropped, so its conversations left the sidebar and came back on the following poll - which is the reported 'the session disappears, then reappears a while later' when clicking a remote conversation. The phone already keeps its last snapshot on a failed read.

A host that is asked and silent keeps the snapshot it last sent, for one round only: refresh reads the peer list first, so a host that is genuinely gone is not connected next time, is not asked, and loses its rows then. A host that is not asked at all (disconnected, stopped, in standby, unpaired) keeps the old rule.

* feat(desktop): name this machine on the Remote page

The host section listed only pair ids, which name a connection, so a user holding a phone that had just paired had nothing on either screen to match the two by: the id the phone recorded is this machine's own, and no surface rendered it.

One line under the switch, only while the switch is on, with the same copy affordance the pairing code uses.
huichen added a commit that referenced this pull request Oct 23, 2026
…om plain text (#1322)

* fix(screenshots): check the machine mark rendered, not for an emoji

`capture-mobile chat` had been failing with "the badge carries no glyph" since
#1314 replaced the emoji machine marks with the shared icon component
(`PeerIconGlyph`). The assertion looked for `💻` in the badge's text, which is
where an emoji would have been — the picture changed, the check kept reading
text. The same assertion in `capture-desktop remote-conversation` looked for
`💻` too and was still passing only by accident: the desktop badge's emoji had
already become an icon, so it was one glyph away from the same failure.

Both now check the fact the assertion was ever about: that the mark rendered.
The badge must contain an `<svg>` at least 8x8 carrying at least one shape. That
still fails when the icon stops drawing — verified by removing it, which turns
both captures red ("draws no machine icon") — and no longer cares whether the
mark is an emoji, a line icon, or something else later.

The two spots are the only glyph lookups in the scenario table; the remaining
single-character assertions all match real copy (中 / 你 / 接管 / 本机 / …), so
nothing else changed. `scripts/screenshots/scenarios.json` is the only file,
two lines replaced.

Not in scope, for the record: the shot scripts run in no workflow, which is why
this assertion could rot from #1314 until now with nothing noticing. Whether to
put them in CI is a cost decision for the product side, not something this
change should slip in.

* feat(host): record a panicking launch in a crash log

A Windows GUI launch has no console, so a panic prints to a stderr nobody
reads and exits 101 — a code Windows Error Reporting does not record, which
is why the 2026-10-23 failed restart left no event-log entry and no dump.
Append the panic (time, thread, file:line, payload, startup step) to
<future home>/app/logs/crash.log, which is never trimmed, so a later launch
can say what killed the earlier one.

Also report each startup step as it is entered: the stall watchdog only
speaks after 20s, so a launch that dies sooner left no step name at all.

* fix(desktop): name a new conversation from plain text, not reference markdown

The placeholder title the Desktop mints for a fresh conversation was cut from
the composer's raw markdown source, so a first message carrying a picked
conversation read as '[关闭应用未清理锁文件](futureos:...' in the sidebar --
brackets and a URL instead of a topic.

Add plainTitleText to @future-os/markdown, the TypeScript sibling of
uture_rpc::title::plain_title_text which the Agent, the host prompt path and
the importer already apply: a conversation reference contributes nothing (its
label is the *other* conversation's name), any other link contributes its
label, an image its alt text, whitespace collapses to one line, and a message
that is nothing but a reference keeps the label it points at. Derive the seed
title through it.

* build(cargo): add an LTO-free `local` profile for fast iteration

[profile.release] sets `lto = "thin"`, so every edit re-runs whole-graph
ThinLTO even when a single crate changed. Measured on this 20-thread Windows
machine, touching one line of `future-cli` and rebuilding `--release` takes
~137 s, of which the linker accounts for ~1.5 s (which is why swapping in LLD
gains almost nothing). The same edit with LTO off and the incremental cache
reused takes 2.8-3.6 s, after one 236 s cold build.

[profile.local] inherits `release`, so it stays optimised, but sets
`lto = false`, `incremental = true`, `debug = 0` and `strip = false`.

This is a local-iteration profile, not a release profile: nothing selects it
implicitly, and `cargo build --release`, `make build` and CI keep building the
unchanged `release` profile, so shipped binaries cannot drift from it. Use it
with `cargo build --profile local -p future-cli`.
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