Repository navigation
fix(tui,agent): the rail yields its keys; a backward history page keeps its exchanges - #1416
Merged
Merged
Conversation
The fence lane is worth its one open connection only because the cost is bounded and compensated: a read that does not queue behind the ordered writer cannot see a write that is still queued, so a session whose placeholder commit is waiting reads missing. This asserts that lag directly — the fence answers while the writer is held, the queued create is not visible yet, and the same question answers present once it commits — so a later change that puts the fence back on the writer lane, or a caller that trusts missing without confirming it, has a test to fail. The desktop half of that contract is covered by agent_bridge::tests::presence_fence_tests (missing asked twice, deleted and present once).
recovery_is_ordered_after_already_accepted_appends asserts the order of two entries, not the latency of the commit between them, but it waited only 5 s for that commit to land. Every writer commits with `synchronous = FULL`, so a suite running 32 databases at once can spend longer than that in fsync alone: the full `cargo test -p future-agent` at 32 threads failed here with `Timeout` on 2026-10-29 while the same suite at 8 threads (CI-like) was green twice. The wait stays bounded — a real deadlock still fails — but at 60 s it measures scheduling rather than the disk. No assertion changed.
Four tests register a reset-race hook, and the registry held exactly one. Under parallel execution the last registration replaced the others, so a reset found no hook for its own id and succeeded where the test expected `history_changed` — the id gate was there, the storage was not. Measured 2026-10-29: the full `cargo test -p future-agent` failed here with 32 test threads and passed with 8. The registry is now a map keyed by session id, and the hook is removed before it runs: it writes through the same manager, so holding the registry across that work would serialize every other test's reset. Test-only (`#[cfg(test)]`); no production path changes.
A focused rail kept the keys while printable characters, pastes and the clipboard chord still reached the draft, so the `enter` that followed one of them opened the rail's selected conversation instead of sending the prompt. On the launchpad that read as "the first message was never sent — the screen jumped to somebody else's streaming session". Editing chords and a second `escape` now blur the rail too, so the keys land where the typing did. The search line keeps its own `escape`: the first one clears the filter, the next one leaves the rail.
A focused rail answered the plain left/right arrows by switching between 最近 and 工作区. The rail can hold the keys while the prompt is still on screen — a click on a tab, a conversation opened from a row, `ctrl+d` — and a reader standing in the draft reads those two keys as the caret's, so the rail moved under a caret that never did. The tabs are now `shift+left`/`shift+right` alone (`Action::PanelPrev` / `PanelNext`), which already worked from anywhere. Inside a focused rail the plain arrows are swallowed rather than handed to the editor: that caret is not the reader's, and moving one they cannot see is the same surprise one layer down.
`get_session_entries` counts a backward `limit` in user exchanges, but the canonical branch of `read_display_page` capped the row range at 64 on top of that window. One busy run is far more than 64 display rows on its own (an assistant step and a tool entry per call), so a ten-exchange tail page came back as whatever fitted, the client's missing-user-prefix fetch pulled that run's question in, and the transcript opened on the newest exchange alone — everything above it looked like it had been lost, with no page of it loaded and no sign that any existed. A backward read now takes the window it named. The row ceiling stays on the forward branch, where `limit` counts rows and `nextOffset` resumes them. The canonical page is still bounded: its rows carry no bodies, so the bound moves to the materializer that reads them — the same eight-megabyte budget every other page has, which happens to be exactly what the compatibility branch was already using for its inline bodies. Measured on a real 784-row session: a `limit: 10` tail read returned 64 rows (one exchange) before and 783 rows across all ten exchanges after.
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 workbench rail was swallowing typing, pasting and
esconce it had focus, and its tabs answered to plain arrows; this branch routes those keys back to the composer and leaves the tabs to shift+left/right. Alongside it, three agent tests stop depending on a loaded disk: a backward history page keeps the exchanges it asked for, the reset race hook is keyed by session instead of one global slot, and two deadline-shaped waits now have room to finish.Commits
fix(agent): keep the exchanges a backward history page asked forfix(tui): leave the rail's tabs to shift+left/right onlyfix(tui): typing, pasting andesctake the keys back from the railtest(agent): key the reset race hook by session instead of one slottest(agent): give the ordered-recovery wait room for a loaded disktest(agent): assert the fence lag a negative answer has to surviveVerification
Local pass with rustc/clippy 1.99.1 from
~/.rustup(Homebrew shadowsPATH),ulimit -n 8192, in the main checkout atbf96a2eb5(the first five commits):cargo fmt --all -- --check→ cleancargo clippy -p future-tui -p future-agent --all-targets -- -D warnings→ clean (3m09s)cargo test -p future-tui --lib→ 1512 passed, 3 ignoredcargo test -p future-agent --lib -- session::persistence session::reset→ 47 passedDelta at the frozen tip
3aa2394b3, after the history-paging commit landed:cargo test -p future-agent --lib -- session::history→ 51 passedcargo fmt -p future-agent -- --check→ cleanNotes
The two tui commits change key handling in
tui/src/workbench/mod.rsandstate.rs: plain arrows over a focused rail no longer switch its tabs, and text input plus paste andescare routed to the composer.docs/guide/tui.mdanddocs/tui/workbench-spec.zh-CN.mddescribe the new behaviour.