Repository navigation
feat(remote,tui,agent,mobile): download tiers; review overlays; one usage count; one reply - #1364
Merged
Merged
Conversation
A desktop saving a file from a paired host was measured against the phone's rules — 10 MiB and a type allow-list — so a 12.5 MB installer was refused with advice to use the desktop panel it was already using. The limits are a phone's, and right for a phone: previews decode inside 10 MiB, its reader acts on a fixed set of types, a tap can be metered. A desktop writes bytes to a path the user chose and shares none of that. `download_prepare`'s mode now names the client's intent: a new `download` variant carries the desktop tier (512 MiB, no type list), chosen as the pulling client's own `MAX_DOWNLOAD_BYTES` so the host never prepares what the client must refuse. The phone's variants, thresholds and wording are untouched, and an unimplemented mode is still refused before the file is judged. A host that predates the variant answers a matched refusal and the desktop asks again for `original` — today's request, today's outcome.
The split needs to be findable by the next session that wonders why a download has two ceilings: what each tier is for, where 512 MiB comes from, which refusals say which sentence, and what was measured on 2026-10-26 — including the network-scale test that was not run and the two costs that wait for it.
The Future gateway ends a streaming request with more than one usage block: a coarse frame it synthesizes itself (no cache breakdown, an estimated prompt) and then the provider's real block, which also arrives on the trailing empty-choices chunk. process_usage_event added every block to the session counters, so one request became two records: on a future/kimi-k3.1-pro session with 526,759 real prompt tokens and 526,336 served from cache, input summed to 1,133,921 and the hit rate read 46% instead of 99.9%. Tokens are now folded per call, like cost already was: process_usage_event merges the call's blocks (the block with the cache breakdown wins, the later one breaks ties, a missing field never overwrites a present one) and the call's total reaches the counters once, in charge_request_usage. The compaction summary observer follows the same rule, and a block that claims more cached bytes than prompt tokens now warns (and trips a debug assert), so a regression of this shape cannot pass unnoticed. Also add models::cache_hit_rate as the single definition of the ratio (cache_read / prompt, because prompt_tokens includes the cached subset) and report it as tokens.cacheHitRate in get_session_stats.
The live lane is at-most-once per event, so an `agent_end` can be dropped. A reply whose terminal never reached the client kept its generating flag — and its clock — until some later reconcile happened to settle the whole lane; once the next prompt's run started, the transcript drew two generating dots at once, one of them counting past three hours (reported on a phone, 2026-10-26). The Agent runs one turn per session, so a newer run's own events prove the older reply is over. Settle it the way the desktop labels a stream that ended without a terminal (`[RESPONSE_UNCONFIRMED]`), and drop the live clock with the flag. Only a reply stamped with a different run id is touched: two runs cannot interleave, and a compaction frame carries the surrounding run's identity rather than a write of its own. A call whose result never arrived keeps `status: "running"` in the projection — no event will ever say otherwise — so the reply now tells the row it has stopped: in a settled reply an unfinished call reads "interrupted" instead of "running" (the desktop's own RunsPanel rule).
huichen
enabled auto-merge (squash)
October 26, 2026 02:56
box_geometry was handed the window height when a list scrolled, so a tall terminal stretched the preference and shortcut boxes to almost the whole frame and left the rows pinned to its top edge. Pass the rows actually drawn, and fold the diff box's own title back inside it so it stays within the argument budget.
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.
Six changes land together through the integration branch: a desktop save-as gets its own remote download tier, the workbench's review overlays and pointer navigation are refined and its preference boxes sized to their content, an agent model request counts its usage once, a superseded mobile reply settles instead of streaming twice, and the download tiers are written down with the acceptance that proves them.
The branch also carries the work that landed on
dev-huichenwhile the PR was open, so the commit list below is the complete set of non-merge commits inorigin/main..origin/dev-huichenat the frozen headed012b3a9.What changed
host/src/remote_host/files.rsandhost/src/remote_peer/transfer.rscarry the tier through the prepare/pull side, including the refusal case;packages/remote-protocol/src/files.rsandpackages/remote-client/src/transfer.rsadd the wire field and its client half;desktop/src-tauri/src/commands/remote_peer.rsroutes a save-as through the new tier.tui/src/workbench/{mod,screen,i18n}.rsrefine the review overlays and pointer navigation, and fold the diff box's own title back inside it so the function stays within the argument budget;tui/examples/workbench_demo.rsanddocs/guide/tui.mdfollow.agent/src/agent/run_loop.rs,agent/src/llm/adapters/openai_chat.rs,agent/src/models/mod.rsandagent/src/types/mod.rsstop a single model request from being counted twice.mobile/src/features/chat/messages/*andpackages/remote-client/src/projection.tsmark the replaced reply finished instead of leaving two streaming rows.docs/architecture/remote-download-tiers.md(with its Chinese counterpart) records the tiers and how each was accepted;docs/README*.mdindex it.Commits
Seven merge commits sit on the branch as well (the
feat/dl-tiers,fix/two-streaming,feat/usage-double-count,feat/tui-visual-auditandfix/tui-overlay-box-heighttask-branch merges plus twoorigin/mainsyncs); they add no content of their own beyond the commits above and the landed main history.Verification
Run by the sweep at the earlier frozen tip
4981f4e99with rustc/clippy 1.97.0 from rustup, in a throwaway worktree sharing the repo target directory:cargo fmt --all -- --check→ cleancargo clippy -p future-host -p future-remote-protocol -p future-remote-client --all-targets -- -D warnings→ cleancargo test -p future-host --lib -- remote_host::files remote_peer::transfer→ 78 passedcargo test -p future-remote-protocol -p future-remote-client→ all passedcargo check -p futureos→ clean (the desktop command compiles against the new protocol field)Re-checked at the current frozen tip
ed012b3a9with rustc/clippy 1.99.1 (the toolchain pinned byrust-toolchain.tomlafter #1363):cargo clippy --locked -p future-tui -p future-cli --all-targets -- -D warnings→ cleancargo clippy --locked -p futureos --all-targets -- -D warnings→ cleancargo fmt -p future-tui -p future-cli -p futureos -- --check→ cleancargo test -p futureos --lib→ 364 passedNotes
packages/remote-protocolgains a field rather than reusing one, so an older peer keeps its existing single-ceiling behaviour.mainin chore: upgrade Tauri to 2.12.5 and Rust to 1.99.1 #1363; this branch mergedorigin/mainafterwards and builds with it.e3a137378failed thetui-clianddesktopclippy jobs ontoo_many_argumentsindiff_review_box; that call shape is fixed by the newest commit in this list, so the failure belonged to the stale head rather than to the branch.