Skip to content

feat(choice): put choice cards behind an off-by-default switch; fix remote transcripts - #1639

Merged
huichen merged 18 commits into
mainfrom
pr/huichen
Nov 17, 2026
Merged

huichen merged 18 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Choice cards — the single/multi-pick card a reply can close with — become opt-in, and the remote lane stops guessing: a transcript draws what that host allows and shows a reply the host is still writing as unfinished. Every silent way the remote lane can stop drawing a reply now names itself in the console, and the card's row mark carries its mode.

Commits

  • b0a710ad4 test(agent): poll the serving future before a stop can close admission — the bounded-shutdown case let select! poll the serving future for the first time only after a client had connected, so a stop that won the race to that first poll made serve refuse with "Agent service is stopping" and the case reported it as a failed serving future. It now polls once before the client connects, as every host does, keeping the assertion that the future is still running. Test only, no product code.
  • 84d9856e1 fix(cli): list the choice-card switch in the desktop settings help — choiceCards was added to the settings table without its line in help::DESKTOP_HELP; one line added, which is what the TUI/CLI help test checks.
  • 6f23fa0d1 fix(desktop): order the choice-card imports lint expects — three import lines moved to the path order perfectionist/sort-imports requires; no behaviour change.
  • 6a5f661a1 feat(remote): expose the choice-card switch on a remote desktop, and draw its cards — Remote → that computer → Automation gains a "Choice cards" switch written to the host's own app.db through update_desktop_settings; a remote transcript reads that machine's value (one cached command per connection, following app_settings_changed) instead of this machine's, and treats a host that does not answer as on. The phone mirrors the same rule.
  • eed201f4e docs(settings): list the choice-card switch in the Settings reference — the new row in the English and Chinese Settings wiki pages.
  • e6189e2a3 feat(desktop): say why a remote reply stopped being drawn live — warnRemoteLane logs, once per conversation, reason and run, which of the four silent stops happened (a fragment dropped at its terminal frame, a failed content lane, a refused or failed run log, a settled record over a run the host still has in flight), with the error attached. Console only, no UI.
  • 7a8ffc3cb feat(settings): gate choice cards behind a switch, off by default — Settings → General gains a "Choice cards" switch persisted as choice_cards in app.db (packages/app-settings, default off). Off drops the card node and the fence itself on both renderers (malformed-fence fallback included), hides the conversation list's "waiting on your choice" mark, and leaves choice.md out of the system prompt through the per-run set_choice_cards / PromptOptions.choice_cards path. Stored history is never rewritten; the card format and its single/multi semantics are untouched.
  • 60e1bdfd9 fix(desktop): draw a remote run the host is executing as unfinished — the timeline exposes the run get_state.activeRun names and the transcript marks that row in flight, so a running reply is no longer folded as settled or offered copy and fork; a settled record, an idle state read older than the run's last frame, or a low-frequency recheck ends a run whose terminal frame was lost on at-most-once NATS.
  • f6457ec40 test(shot): capture the multi-choice card's checkbox marks — ?choiceMode=multi swaps the fence's mode line, and choice-card-multi asserts the box by computed border-radius so a regression to a circle fails the capture.
  • c3bb4dd69 fix(choice): draw multi-choice rows with a checkbox mark — a 3px-rounded square on desktop (card and edit popover), a 4px box with a check on the phone; the single card keeps its ring.

Verification

Local, at 921738869 (this head), pinned Rust 1.99.1 with the Homebrew 1.96.0 shadowed off PATH, ulimit -n 8192:

  • cargo fmt --all -- --check → clean
  • cargo clippy -p future-agent --all-targets -- -D warnings → clean
  • cargo test -p future-agent --test shutdown_bounded → 3 passed, run three times

Local, at af21e1e89 (the tree of this branch apart from the three import lines reordered in 6f23fa0d1):

  • cargo check -p future-agent -p future-host -p future-app-settings -p future-rpc --all-targets → clean
  • cargo clippy -p future-agent -p future-host -p future-app-settings -p future-rpc --all-targets -- -D warnings → clean
  • cargo test -p future-rpc --lib → 286 passed
  • cargo test -p future-app-settings → 23 passed
  • cargo test -p future-host --lib → 2289 passed / 0 failed / 15 ignored (455.7s)
  • cargo test -p future-agent --lib → 3104 passed / 0 failed / 7 ignored (146.0s)
  • make check-docs → 423 docs OK, 0 pairs pending, provider matrix 13 rows
  • desktop: npx tsc --noEmit clean; the CI-exact npx --no-install eslint 'src/**/*.{ts,tsx}' 'shot/**/*.{ts,tsx}' vite.shot.config.ts → 0 errors at this head (three sort-imports errors at af21e1e89 are fixed by 6f23fa0d1; the remaining jsdoc/no-multi-asterisks warning in liveRunProjection.ts predates this branch); npx vitest run on the 14 touched suites → 297 passed
  • mobile: npx tsc --noEmit clean; npx eslint on the touched files clean; npx jest on the 3 touched suites → 64 passed

Notes

  • desktop/src/components/layout/AppShell.tsx shows ~945 changed lines because the new ChoiceCardsProvider wraps the shell's JSX and re-indents it; the whitespace-insensitive diff is 13 added lines.
  • f6457ec40 is screenshot-fixture only, eed201f4e is documentation only, and b0a710ad4 is test only.

User-visible changes

  1. Choice cards are off by default. Before: a reply's futureos-choice card drew, and the system prompt taught the model the fence. After: Settings → General → "Choice cards" starts off, so nothing draws — not the card node, not a code-block fallback — the conversation list's "waiting on your choice" mark is hidden, and the prompt section is left out so nothing produces a card. Turning it on restores both halves; stored history is never rewritten. Revert 7a8ffc3cb.
  2. A remote desktop's choice-card switch is now reachable and authoritative. Before: the switch existed only in this app's Settings, so a headless host had no surface to turn it on, and remote transcripts drew by this machine's value. After: Remote → that computer → Automation writes the host's own app.db; a remote transcript draws by that machine's value, an older host that does not answer counts as on (its cards keep drawing), and an unreachable host falls back to this machine's switch. Revert 6a5f661a1.
  3. Multi-choice rows carry a checkbox mark. Before: a multi card's row used the same circle as a single card's radio, leaving an 11px mode label to tell them apart. After: a 3px-rounded square on desktop (card and edit popover) and a 4px box with a check on the phone. Revert c3bb4dd69.
  4. A remote reply the host is still writing is shown as unfinished. Before: the history page folded it as settled — the work behind "show process", copy and fork offered over words still arriving, no generating dot — and a lost terminal frame could leave streaming and Stop set for ever. After: the row is marked in flight from get_state.activeRun, and a settled record, a stale idle read, or a periodic recheck ends a stranded run. Revert 60e1bdfd9.
  5. Console diagnostics only, no UI: a remote lane that stops drawing a reply now logs which of the four reasons applied, once per conversation, reason and run, with the error attached. Revert e6189e2a3.

huichen and others added 15 commits November 17, 2026 22:21
The multi card's row mark was the same circle as a single card's radio:
the only thing telling the two apart was the 11px mode label in the
corner. Shape now carries the mode — a 3px-rounded square on desktop
(card and edit popover), a 4px-rounded box with a check on the phone —
while the single card keeps its ring.

Co-Authored-By: FutureOS <[email protected]>
`th_choice` only ever asked a single-choice question, so nothing in the
screenshot harness could show the multi card's square mark — the state
this shape rule exists for. `?choiceMode=multi` swaps the fence's mode
line and nothing else, and `choice-card-multi` asserts the boxes by
computed border-radius (3px) rather than by class name, so the capture
fails if the mark ever goes back to a circle.

Co-Authored-By: FutureOS <[email protected]>
A history page cannot say a reply is still being written: the projector
folds an exchange into a complete (or ailed) turn, so the page's copy
of a running reply arrived looking settled and MessageBlock did what it does
with a settled reply — folded the work behind 'show process', offered copy
and fork over words that were still arriving, and dropped the generating
dot. The host's own answer is the only statement about 'now' in the
picture, so the timeline now exposes the run get_state.activeRun names and
the transcript wears it on the row (markInFlightReply).

The same identity fixes the other half: a run whose terminal frame was lost
on at-most-once NATS left streaming set for ever, with the composer still
offering Stop. A settled record, an idle state read older than the run's
last frame, or a low-frequency recheck while streaming now ends it.
A reply's `futureos-choice` card becomes the reader's choice, not the
product's default:

- Settings -> General gains a "Choice cards" switch, persisted as
  `choice_cards` in `app.db` (packages/app-settings) and defaulting to off.
- Off means *no trace*: the desktop and phone renderers drop the card node
  and the fence itself, the malformed-fence fallback included, so the block
  never resurfaces as a code block. The conversation list's "waiting on your
  choice" mark follows the same switch.
- Off also means the fence is not taught: the host pushes
  `set_choice_cards` before every run (best-effort — an agent that predates
  the command still accepts the prompt), the session keeps it, and
  `PromptOptions.choice_cards` decides whether `choice.md` enters the system
  prompt. `grep futureos-choice` finds nothing in a prompt built with the
  switch off.
- The card format, its fields and its single/multi semantics are untouched,
  and stored history is never rewritten: an existing card renders per the
  current switch.
- The phone mirrors the desktop instead of holding its own value
  (`get_desktop_settings.choiceCards` / `SettingsPatch.choice_cards`).
- The phone's card test mock only stubbed `ListChecks`, so
  `ChoiceCard.test.ts` was already red on `origin/dev-huichen` once the
  multi-choice rows began drawing their `Check` mark; the mock now lists both
  icons (test-only, no product change).
- `set_choice_cards` is registered in the shared command policy; without that
  the agent answers `unknown command`.

Tested: desktop `ChoiceCardsToggle.test.tsx` (off: zero card nodes and no
`futureos-choice` in the text; on: rows, pick, answer), mobile
`ChoiceCardsToggle.test.ts`,
`prompt_omits_the_choice_card_fence_when_cards_are_off`,
`choice_cards_switch_adds_and_removes_the_prompt_section`,
`choice_card_switch_is_pushed_from_the_store`,
`settings_patch_accepts_the_choice_card_toggle`, and the default-off
assertions in `future-app-settings`. Falsified by forcing the renderer to
always draw, always pushing the prompt section, and shipping the default as
on: each turns exactly those assertions red.
Every way the remote lane can stop drawing a reply was silent: a fragment
dropped at its terminal frame, a content lane that failed and took the frames
still in it, a run log the host refused or a read that errored, and a record
that settled a run the host still had in flight. From outside all four read
the same — 'my answer stops halfway' / 'this conversation looks finished and
it isn't' — so a report arrives without the fact that decides where the
defect is.

warnRemoteLane says which one happened, once per conversation, reason and
run, with the error passed through. It follows the shape this app already
uses for its own runs (warnLivePreviewFallback): a bracketed prefix, no UI,
and the conversation named so a line out of a window with several remote
conversations open is still addressable.
The General page gained the off-by-default `Choice cards` switch in 7a8ffc3,
and the Settings wiki page is what enumerates that page's rows. Adds the row in
both languages, matching the switch's own copy: while off the card is not drawn
and the agent is not told the format exists.
…draw its cards

The switch shipped only in this app's own Settings, which left a headless
host stuck: its value decides whether *its* agent is taught the
`futureos-choice` fence, and a machine with no window of its own had no
surface to turn it on. So:

- Remote -> that computer -> Automation gains a "Choice cards" switch,
  written to the host's own `app.db` through `update_desktop_settings`
  (`SettingsPatch.choice_cards`, already accepted by the host).
- A remote transcript now draws cards on **that machine's** value, not on
  this one's: `useRemoteChoiceCards` reads `get_desktop_settings.choiceCards`
  through the cached per-host catalogue (the same read the skill row uses,
  so it costs one command per connection and follows
  `app_settings_changed`). The value is passed into `RemoteConversationView`
  from the shell, and its own switch is the fallback only for a caller that
  has not read it.
- A host that does *not* answer the question (a build older than the
  switch, which teaches the fence unconditionally) counts as **on** for
  drawing: hiding its cards would delete the closing question it
  legitimately asks, source included. Only an explicit `false` — the
  shipped default — hides. A refused read falls back to this machine's own
  switch, because an unreachable host is not a host that said no.
- The phone's mirrored value follows the same rule: only `false` from that
  desktop hides anything, so an older desktop's cards keep drawing.

Tested: `useRemoteChoiceCards.test.tsx` (host off wins over local on; host
on wins over local off; an older host's silence is on; a refused read falls
back to local; no machine, no opinion), `RemoteChoiceCards.test.tsx` (off:
no card node and no `futureos-choice` in the text, prose intact; on: rows
and title; omitted: this machine's switch),
`RemotePeerSettings.test.tsx` (the row shows the host's value and writes
only `choiceCards`). Falsified by ignoring the host's answer in the hook,
by ignoring the prop in the transcript, and by reading a missing key as
off: each turns the matching assertion red.
perfectionist/sort-imports flagged three imports that landed out of
path order when the choice-card switch was wired into the layout:
ChoiceCardsContext before PeerIconGlyph / agentStateCache, and
useRemoteChoiceCards before useRemoteSkillCatalog. Moves the three
lines; no behaviour change.
@huichen
huichen enabled auto-merge (squash) November 17, 2026 15:32
The shutdown_bounded case connected a client and let `select!` poll the
serving future for the first time only afterwards. `RunningAgent::serve`
enters the service's admission on its first poll, while
`AgentHandle::request_shutdown` closes that admission synchronously, so a
stop that won the race to the first poll made `serve` refuse with
"Agent service is stopping" and the case reported that refusal as a failed
serving future, with the stop itself reporting Stopped. Measured in CI run
44114695942 (job 134149753884), and reproduced locally by composing the same
two steps in that order.

Every host polls `serve` before it can ask for a stop; poll it once here as
well, before the client connects. The ordering is then explicit instead of
scheduler-dependent, and the assertion that the serving future is still
running is kept.
@huichen huichen closed this Nov 17, 2026
auto-merge was automatically disabled November 17, 2026 18:42

Pull request was closed

@huichen huichen reopened this Nov 17, 2026
@huichen
huichen enabled auto-merge (squash) November 17, 2026 18:43
@huichen huichen closed this Nov 17, 2026
auto-merge was automatically disabled November 17, 2026 20:37

Pull request was closed

@huichen huichen reopened this Nov 17, 2026
@huichen
huichen enabled auto-merge (squash) November 17, 2026 20:38
@huichen
huichen merged commit 154669d into main Nov 17, 2026
332 of 350 checks passed
@huichen
huichen deleted the pr/huichen branch November 17, 2026 21:00
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