Repository navigation
fix(host,tui): an idempotent Agent channel runtime; one row per keypress - #1366
Merged
Merged
Conversation
Pressing `down` in a list overlay skipped an entry: the state machine advanced by one, but a record was drawn by wrapping its data, so a real session title (title) — workspace — id) folded into two rows and the marker travelled two rows down the screen per press. At a narrower box it could be three. A record is now composed to occupy exactly one row (`workflows::record_line`): pieces after the first are dropped whole when they no longer fit — a workspace cut mid-path reads as a different directory — and only the leading title is shortened, with a visible ellipsis. Two more places had the same shape: * the worktree list used the arrow for the *current* checkout, so the overlay had no visible selection at all and `down` looked dead; `●` now marks the current one and `›` is only ever the selection; * the diff navigator drew its arrow from the file whose patch had loaded, which is a reload behind the key, so the cursor did not move until the driver came back; the arrow follows the cursor and `·` marks the loaded patch. The regression test asserts the painted marker sits on the row its own hit region reports and that four presses move it exactly four rows, for all five list overlays.
Three installers share one process — the Desktop entry, the CLI entry, and the shared test fixture that `desktop`'s dev-dependencies enable — and all three registered the process-wide channel driver runtime by `set`ting a `OnceLock` *and* wrapping the "already configured" error in `expect` inside a `Once` of their own. The second installer therefore panicked, and because the panic happened inside its `Once`, that `Once` was poisoned: every later install in the process then failed for a reason unrelated to the first. One run of the Desktop suite turned that into 38 failing tests out of 364, and the fixture's own "is it installed?" guard did not help because it is not atomic with `set`. `configure_channel_runtime` is replaced by an idempotent port whose two outcomes are both successes (`RuntimeInstall::Installed` / `AlreadyInstalled`), so the ordinary second-install case can no longer be unwrapped into a panic. `CHANNEL_RUNTIME` is the only arbiter: a caller-side `Once` in front of it was the second state machine that disagreed with it. `provide_channel_runtime` is the shape every installer now uses, and it owns the keep/discard pairing the design rests on: the winner parks its runtime on a thread that never returns (so the shared channel's h2 driver task survives), and a loser shuts its own down through `Runtime::shutdown_background`, which is safe in the async contexts the port is reachable from. A losing call does not even build a runtime. Production semantics are unchanged: future-host still refuses to construct a fallback runtime, and `agent_channel_runtime()` still errors when no entry installed one. Tests: `the_first_install_wins_and_the_second_reports_already_installed` and `a_losing_installer_neither_builds_nor_parks_a_runtime` (host, private slot, deterministic) plus `a_second_installer_is_a_normal_outcome_not_a_panic` (Desktop entry, real process slot). All three were red against the pre-fix semantics and are green now. The contract they pin is installation, not thread scheduling — see docs/testing/agent-channel-runtime-install-2026-10-26.md for the measurements, the falsification runs and what is deliberately not covered.
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.
Installing the Agent channel runtime twice used to disturb the instance already running; it is now idempotent. Alongside it, a workbench overlay's highlight moves exactly one row per keypress instead of jumping, and the acceptance record for the runtime fix is added under
docs/testing/.Commits
fix(host): make the Agent channel runtime install idempotentfix(tui): move an overlay's highlight one row per keypressVerification
Local self-test at
e4763a1dbwith rustc/clippy1.99.1(rustup toolchain; the Homebrew 1.96 install shadows it onPATH), in the main checkout:cargo fmt --all -- --check— cleancargo clippy -p future-host -p future-cli -p future-tui --all-targets -- -D warnings— cleancargo clippy -p futureos --all-targets -- -D warnings— cleancargo test -p future-tui --lib— 1229 passed, 0 failedcargo test -p future-host --lib -- agent_client— 10 passed, 0 failedcargo test -p future-cli --lib -- headless— 27 passed, 0 failedmake check-docs— 346 docs OK (placement, bilingual pairing, links, fences); provider matrix 13 rowsThe desktop (
futureos) library test suite was not run locally because its full lib run poisons a sharedOnceagainst the host test support in this environment;clippy --all-targetscompiled it, and CI runs the suite.Notes
docs/testing/agent-channel-runtime-install-2026-10-26{,.zh-CN}.mdis the acceptance record for the runtime fix.