Skip to content

feat(agent): tolerate choice-card spellings models emit; fix(desktop): save dialogs ignore Enter - #1692

Merged
huichen merged 6 commits into
mainfrom
pr/huichen
Nov 25, 2026
Merged

huichen merged 6 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

The choice-card fence is the one block whose escaping the reader depends on, and live replies have been reaching it in other spellings. This branch makes the agent state the fence outright and teaches both readers (the desktop renderer and the agent's badge) to accept the near-miss spellings that previously landed as raw source, without turning an untagged fence into a card. It also stops save dialogs from committing on Enter, so a half-typed name can no longer be written by a stray keypress.

Commits

  • feat(agent): nail the card's spelling in the prompt, and read the spellings it still gets wrong
  • fix(desktop): save dialogs only through their button, never on Enter

Verification

  • cargo fmt --all -- --check → passed
  • cargo clippy -p future-agent --all-targets -- -D warnings → passed
  • cargo test -p future-agent --lib → 3146 passed, 0 failed, 7 ignored
  • npx vitest run (desktop, the five touched test files) → 126 passed
  • npx vitest run --config ../packages/markdown/vitest.config.ts (from desktop/) → 793 passed
  • npx tsc --noEmit (desktop) → passed
  • npx jest src/screens/__tests__/DesktopLabelDialog.test.ts --runInBand (mobile) → 9 passed

User-visible changes

  • Save dialogs no longer save on Enter. The thread/workspace rename, remote conversation rename, machine label, approval rule editor and workspace modal keep the key inside the field and write only from their save button; the mobile rename and machine-label dialogs likewise no longer treat the keyboard's return key as the save button. Before: Enter committed a half-typed name. After: only the button writes. Rollback: revert 8ad34bd.
  • Choice-card parsing accepts more spellings. A <futureos-choice> tag pair that shares a paragraph with the preceding prose is now split off and drawn as a card; an opening tag that ends the reply is read as a card whose closer was forgotten; the fence language folds case, surrounding space and -/_. Before: those shapes rendered as source text with the tags left in the reply. An untagged fence stays a code block on purpose. Rollback: revert 79a82bd.
  • The agent prompt now states the fence spelling outright, and the choice section's line budget grows 53 → 58. Rollback: revert 79a82bd.

A text field in a save dialog is the reader's own workspace: Enter there
was wired to commit, so a half-typed name landed as the saved value. Every
dialog that carries its own save button now keeps the key inside the field
and writes only from the button.

- thread / workspace rename, remote conversation rename, machine label,
  the approval rule editor and the workspace modal: Enter in the field no
  longer submits (the workspace modal also cancels the browser's implicit
  form submission).
- mobile rename and machine-label dialogs: the keyboard's return key no
  longer stands in for the save button either.
- tests assert the inert key and the button's write, instead of the old
  Enter-saves contract.
…llings it still gets wrong

Three live replies from `future/deepseek-flash` wrote the choice card some
other way than its fence — an untagged fence (2026-11-25), then a
`<futureos-choice>` tag pair twice (2026-11-24, 2026-11-25), the second one
sharing a paragraph with the sentence before it. The reader got the card's
source: tags left in the text, `title:`/`option:` run together on one line.

Prompt: the fence was only shown, never stated. It now says the block is a
fence with the language on the opening line, alone in its own paragraph, and
names the three spellings that reach the reader as source instead of a card.
The section's line budget goes 53 → 58 for it.

Client tolerance, mirrored in the renderer and the agent's badge so one block
cannot draw a card on one reader and a code block on the other:

- a tag pair that shares its paragraph with the prose before it is split off:
  the sentence keeps its marks, the pair becomes the card (a fence interrupts
  a paragraph there, so this is the same attempt);
- an opening tag that ends the reply is read as the card whose closer was
  forgotten — nothing follows it, and the body must be card fields with two
  option rows; the same shape mid-reply still stays text and is logged as
  `choice card syntax without a card`;
- the fence language folds case, surrounding space and `-`/`_`
  (`FutureOS-Choice`, `futureos_choice`); `futureos-choice-x` is still some
  other language.

An untagged fence stays a code block on purpose: that is the one shape that
can also be a quotation of the syntax, and the design's older-client
degradation depends on it staying text.
@huichen
huichen enabled auto-merge (squash) November 25, 2026 09:26
…ounds

PR #1692's Windows `tui-cli` lane failed four tests, none of them in code this
branch touches (`git log origin/main..dev-huichen -- cli/` is empty). All four
failed on an inner wall-clock budget while the same job ran 15m53s against
8m52s for the previous run of it, and the job's own evidence says the runner
was ~200x slower at one thing: `launch_ok_when_powershell_exits_zero` has no
bound at all and *passed*, after 201.100s, in the same run where its sibling
(`launch_reports_a_powershell_failure_without_starting_anything`, 180s budget)
timed out. A real cold `powershell.exe` takes 2s on that lane normally. So the
cold start, not the launcher and not the assertion, was the slow part.

`scripts/ci/rust-checks.mjs` already states the rule these budgets broke:
nextest adds no per-test deadline on purpose, "so a loaded runner cannot fail a
slow-but-passing test where `cargo test` would not". A bound is still worth
keeping for the local `cargo test` runs, so each one stays and says what it is:

- `POWERSHELL_TEST_BUDGET` (600s) is one documented guard shared by the three
  Windows launcher tests across `browser/windows_process.rs` and
  `commands/browser_tools.rs`; raising 180s -> 600s only because 180s was
  measured on a real run. The assertions are untouched.
- The two `configure` hand-off tests proved "fails against the local fixture,
  not the network" with a 5s deadline, and 5s is a latency assertion: the same
  call took 26s on that runner. The proof is now the error itself — it must name
  the fixture's endpoint (`http://127.0.0.1:1`, i.e. `Connection refused` from
  the fixture) — which is stricter than "returned an error inside 5s": a flow
  that reached the real platform either succeeds or names that platform, and
  both fail. The deadline becomes `LOGIN_HANDOFF_BUDGET` (300s), a hang guard.

No assertion was weakened, nothing is skipped, and `-D warnings` is untouched.
`cargo nextest run -p future-cli` on macOS: 1713 passed, 0 failed.
@huichen
huichen merged commit c20bde1 into main Nov 25, 2026
29 checks passed
@huichen
huichen deleted the pr/huichen branch November 25, 2026 11:19
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