Repository navigation
feat(choice-cards): put the recommended option first; fix(host): budget the fixture cleanup barrier - #1642
Merged
Conversation
Row order is a recommendation and nothing downstream re-sorts it: the renderer
draws `options` in the order the fence lists them, so row 1 is what the reader
takes as the model's pick. A card whose best option sits last makes them
re-rank a question the model already answered for them — in `multi` too, where
the first row is the one the others build on.
The rule goes in `choice.md`, next to the `option:` line's shape, so every card
carries it whichever mode it settles on. Reordering rows in a client instead
would disagree with the reply's own wording ("先做这个" pointing at a row that
moved).
The prompt budget moves 40 -> 42 because this changes what the model writes on
every card, unlike the rest of §4's prose.
huichen
enabled auto-merge (squash)
November 18, 2026 03:29
`cancel_test_tasks` waited a flat 5 s for process-lifetime work before a fixture publishes a new HOME. Tokio cannot stop a blocking closure that has already started (`run_blocking` stays registered for exactly that reason), so that number is not a spin timeout — it is the budget for the work the barrier waits for, and it has to outlast the longest blocking job the Host starts on purpose. 5 s was below that: `shadow_review::process::COMMAND_TIMEOUT` allows a shadow-review Git command (or its lock wait) 30 s, so healthy work could exceed the barrier by design. `Rust Windows test / host-core` failed two headless tests on it (run 44230694304, job 134554848559). Their Run ended with an error, so `agent_prompt` deferred `review::materialize_changeset` — two store reads that take 40-70 ms on a developer machine, and 0.69 s in the same run's *passing* `run_prepared_prompt_completes_a_clean_run` — and that job was still running when the fixture dropped: cleanup timed out and panicked at `runtime.rs:190`. Store work is genuinely variable on that runner (its `initialize_app_store` took 20-24 s), and the repo's test lane already refuses to fail slow-but-passing work (nextest adds no per-test deadline). Derive the fixture budget from the shadow-review deadline (2×, 60 s) instead of a literal, so the two cannot drift apart, and keep the barrier: a task that really hangs still fails the `expect` in `cancel_test_tasks` and still names where it was registered. Two tests pin that — the budget outlasts the longest blocking deadline, and the barrier still waits out blocking work that does finish inside it (the shape of the leak above, reproduced locally by slowing that job past the old 5 s).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The model now puts the option it recommends first on every choice card, in both modes, and the host's test fixture cleanup no longer fails slow-but-passing work on a loaded Windows runner. Both changes are small and independent; they travel together because both landed on
dev-huichenwhile this PR was in flight.Commits
feat(choice-cards): put the recommended option first— row order is the only recommendation signal a card carries: the parser, the desktop card and the phone all drawoptionsin the order the fence lists them and nothing re-sorts them, so a card whose best option sat last made the reader re-rank a question the model had already answered. The rule lives inchoice.mdnext to theoption:line's shape, so it applies whichever mode a card settles on; re-sorting rows in a client instead would silently disagree with the reply's own wording ("do this one" pointing at a row that moved).prompt_teaches_the_choice_card_fencepins it and the prompt budget moves 40 → 42 lines;docs/design/choice-cards.mdand itszh-CNpair record why the rule belongs in the prompt rather than in the renderers.fix(host): budget the fixture cleanup barrier by the work it waits for—cancel_test_taskswaited a flat 5 s for process-lifetime work before a fixture publishes a new HOME, but Tokio cannot stop a blocking closure that has already started, so that number is the budget for the work, not a spin timeout.shadow_review::process::COMMAND_TIMEOUTallows such a job 30 s, so healthy work could exceed the barrier by design;Rust Windows test / host-corefailed two headless tests on exactly that. The budget is now derived as twice that deadline instead of a literal, the barrier itself is unchanged (a task that really hangs still fails theexpectand still names where it was registered), and two tests pin both halves.Verification
Local, on the pinned toolchain (rustc 1.99.1,
ulimit -n 8192):cargo fmt --all -- --checkclean;cargo clippy -p future-agent --all-targets -- -D warningsclean;cargo test -p future-agent --lib3110 passed, 5 failed:sandbox::tests::add_session_allow_maps_read_op,sandbox::tests::enabled_gates_writes_outside_workspace,sandbox::tests::session_allow_takes_effect,sandbox::windows_plan::tests::allow_write_rule_lands_in_writable_allow_read_does_not,sandbox::windows_plan::tests::writable_roots_are_minimized_by_ancestor. The same five fail identically on unmodifiedorigin/mainin a clean worktree and all five pass when run in isolation, so they are pre-existing and load-sensitive, not caused by this branch.make check-docs423 docs checked, 0 pairs pending bilingualization.4291715d4on the same pinned toolchain:cargo test -p future-host --lib runtime::tests21 passed, 0 failed (includes both new tests,the_fixture_stop_budget_outlasts_the_longest_blocking_deadlineandthe_fixture_barrier_waits_for_blocking_work_that_still_finishes), andcargo test -p future-host --lib agent_bridge::headless::tests::run_prepared_prompt3 passed — the two tests that failed on the Windows runner among them. This PR's own CI re-runs the full matrix on that head.User-visible changes
Choice cards (with the
choiceCardssetting on) now list the recommended option first, insingleandmultialike: the first row is what the reader takes as the model's pick, and inmultiit is the row the others build on. Before, the model was free to put its pick anywhere and often wrote the best option last — the same waste as a prose list the reader has to re-rank. No setting, default value, permission or performance characteristic changes; clients already rendered rows in file order, so nothing needed to change in them. Revert3b5b3371f.The host change is test-infrastructure only (
cancel_test_tasksis#[cfg(any(test, feature = "test-support"))]), so it is not user-visible. Revert79739ea45.Notes
dev-huichenwas re-frozen onto this branch once, at4291715d4, to bring the host fix into the PR after the Windows failure above.