Skip to content

feat(desktop): localized quit confirmation; fix(host): keep a queued run queued - #1699

Merged
huichen merged 4 commits into
mainfrom
pr/huichen
Nov 26, 2026
Merged

huichen merged 4 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

What this does

This PR makes the desktop quit confirmation speak the window's language and say what it is actually about to interrupt, and stops a prompt the Agent accepted into its queue from being reported as a failed run (then revived as running) — the cause of a second, empty "thinking" bubble under one prompt.

Commits

  • feat(desktop): the quit confirmation reads in the window's language and counts what is generating — the window now pushes its resolved language (set_ui_language) and the native quit dialog is built from the bundled quit.* English/Chinese catalogues; it reports how many conversations are still streaming, distinguishes other work (queued runs, approvals, compaction, background), and says what quitting costs for an owned vs. attached agent. The prompt trigger itself is unchanged.
  • fix(host): keep a queued run queued instead of failing and reviving it running — run_prepared_prompt_inner no longer rewrites a run_queued ending to failed; settled-run reconciliation now revives a live row as running (executing) or queued (held), so a held turn no longer takes the latest-run seat and opens an empty live preview.

Verification

Local, on the branch tip 046fb82c7 with the pinned toolchain 1.99.1 from rust-toolchain.toml:

  • cargo fmt --all -- --check — clean
  • cargo check -p future-host -p futureos --all-targets — clean
  • cargo clippy -p future-host -p futureos --all-targets -- -D warnings — clean
  • cargo test -p future-host --lib — 2365 passed, 0 failed (15 ignored; 471.86s)
  • cargo test -p futureos --lib — 369 passed, 0 failed (66.33s); a first run hit one failure in commands::agent::tests::sandbox_maintenance_commands_parse_agent_results, a test this branch does not touch — it passes alone and on rerun, and the mock-agent tests share global script state
  • desktop: npx tsc --noEmit clean; npx eslint src/lib/nativeLanguage.ts src/lib/nativeLanguage.test.ts src/main.tsx clean; npx vitest run — 443 files / 6300 tests passed

User-visible changes

  • Quit confirmation. Before: a native dialog with hardcoded English copy saying only "Agent work is still active". After: the dialog follows the window language (English/Chinese), states how many conversations are still generating a reply, distinguishes other in-flight work, and explains whether quitting stops every run on the machine (owned agent) or only this Desktop's runs (attached agent). Trigger conditions are unchanged. Rollback: revert c1f8d5756.
  • Queued run status. Before: a prompt queued behind a running run was restamped failed and then revived as running, so the open conversation drew a second, empty "thinking" bubble for a turn that had not started. After: the row stays queued until the Agent executes it, and reconciliation restores a held row as queued rather than running. Rollback: revert 466d40f88.

Notes

None: no migrations, defaults, feature switches or permission changes.

…nd counts what is generating

The quit prompt was the last native dialog with hardcoded English copy, and
all it said was "Agent work is still active" — a user could not tell one
streaming conversation from a queue of background maintenance. Updates have
carried the window's language into their dialogs for months; this one is
raised from a window/run event and had no invoke to carry it.

The window now registers the language it resolved (`set_ui_language`, pushed
on start and on every switch, the same way the caption colors are handed
over), and the confirmation is built from the bundled `quit.*` catalogues in
both languages: how many conversations are still generating a reply, what
quitting costs for this agent's ownership, then the question. The count comes
from splitting the same activity snapshot the decision already read —
`running` is "still generating", everything else is "other work" — so the
total that decides Proceed/Confirm is unchanged, and a status that cannot be
read still says so instead of guessing.

The trigger is deliberately untouched: any agent work (queued runs,
approvals, compaction, background) still prompts, as does an unreadable one.
Narrowing that to local streaming sessions is a product decision still with
the user.
…nd counts what is generating (#task quit-dialog-locale)
…t running

A prompt the Agent accepts while another run is executing is *queued* behind
it. The prompt path wrote that status, and `run_prepared_prompt_inner` — the
wrapper the remote (mobile) prompt and scheduled-task paths go through — knew
only complete/incomplete, so it restamped the row `failed` a moment later. The
settled-run repair then read the Agent ledger, saw the run alive, and revived
it as `running`: the one status that wins the "latest run" read. The open
conversation therefore anchored its live preview on a run with no events and
drew a second, empty "thinking" bubble for a turn that had not started
(2026-11-26: two assistant bubbles under one prompt, the lower one counting
from the queued row's own start).

Measured on the affected conversation: the queued prompt's row was settled
`failed` (error_type `run_queued`) at 09:41:1x and revived `running` at
09:41:41, holding the latest-run seat until the executing turn ended at 09:54.

- `run_prepared_prompt_inner`: a `run_queued` ending no longer rewrites the
  row; it still returns Err, because the turn is owed and no caller may record
  a finished answer.
- `plan_settled_run_reconciliation` splits the live answer into Alive
  (executing) and Held (queued), and `revive_unverified_run` takes which shape
  to restore — `running` or `queued` (with the `queue_accepted` marker
  `mark_run_queued` writes).

Red-first: the wrapper test failed with status `failed` / error_type
`run_queued` before the fix; the revive tests failed with `running` where
`queued` was required.
@huichen
huichen enabled auto-merge (squash) November 26, 2026 03:33
@huichen
huichen merged commit 5c60078 into main Nov 26, 2026
21 checks passed
@huichen
huichen deleted the pr/huichen branch November 26, 2026 03:44
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