Repository navigation
fix(cli,screenshots): a kept stop reason; a faithful terminal; doubao notes - #1354
Merged
Merged
Conversation
…eal TUI uses Capturing a second TUI (dsh-tui 0.17.0) as a style reference exposed four places where the renderer only understood how *our* UI draws. Each is a real terminal behaviour, not a special case for that app. - **Relative cursor movement.** dsh-tui skips with `CSI nC` and descends with `CSI nB` instead of writing spaces and newlines (445 `26C`, 1299 `1B` in one launch). Unknown sequences were consumed, so every glyph landed at the left margin — a picture that looks like the *application* rendered badly. CUB/CUF/CUU/CUD/CNL/CPL/CHA/VPA/HVP now move the cursor. - **Movement clamps to the screen.** A cursor cannot leave the grid. Without the clamp the column ran past the last one, and the next glyph then looked like an overflow, so an app that skips to the right edge tore its own frame apart. - **Wrapping and scrolling.** A terminal wraps at the right edge and scrolls when written past the bottom; both were silently dropped (444 wrapping writes and 89 scrolls in one dsh-tui launch). Dropping them left the banner in torn fragments and everything after the overflow in the wrong rows. - **Terminal interrogation.** A real terminal answers: DA1, DA2, XTVERSION, the OSC 10/11 colour queries, DECRQM for synchronized output, and device status. Our pty said nothing, so an app that asks stalled on a degraded first frame — measured: the same dsh-tui run drew a torn, left-aligned splash in the pty and a clean centred wordmark under tmux, which answers. `tui_capture` now replies. - The caret is exempt from the alignment check: it is an overlay on the cell the app parked the cursor at, and a translucent block over the background reads as a fully inked cell, which made a correct frame fail its own check. Verification, in order of strength: - every added behaviour has a self-test, and each was re-run with the behaviour removed to confirm the test fails; - `future tui`'s frame is cell-identical to **pyte**'s (0 of 38 rows differ); - dsh-tui's frame is row-identical to **tmux**'s for 37 of 38 rows, the remaining row being the workspace path (different cwd in the two runs).
Verified the fix on the wire against the live Future platform with two isolated agents built from the same recipe (FUTURE_VERSION pinned), one at 9b13e09 (pre-fix) and one at ab3dcc5: - new code: medium goes out as reasoning_effort "high", off goes out as thinking {"type":"enabled"} with no depth hint; medium/off/high all returned a normal reply; - deepseek-flash is byte-identical to the pre-fix request body at the same level, so the new compat flag did not spill over; - the committed 400 from 20:09 did NOT reproduce: six pre-fix calls with reasoning_effort "medium" (and one sending thinking disabled) all returned 200. The platform catalogue is field-identical to the 11:59 cache apart from the proxy BaseURL, so this is a server-side difference, not a client-side one. The record says so instead of claiming a reproduction. Also records that the platform catalogue still does not declare reasoning_effort_values for doubao, which is the alternative fix that needs a platform-side decision.
The record's reproduction steps pointed at two scratch worktrees that were removed after the merge; a reader following them would look for paths that no longer exist.
The foreground host `?`-ed the Agent shutdown before reading the serving loop's own result, so a cleanup that ran out of its budget replaced the whole report. Measured on a loaded host: the only line left was "Agent failed to stop: ... during admitted commands", with nothing saying what had stopped the entry in the first place - the run had quit because the Agent stopped answering, and that fact was dropped on the floor. Combine the two halves in `exit_outcome` instead: both are reported when both failed, cause first and the cleanup failure named as an additional complication; a single failure on its own stays exactly the message it was, so no ordinary exit gains a sentence about a shutdown problem it did not have. Exit status is unchanged: failure in either half is still a failure, and only a run where both succeeded is Ok. `until_shutdown`, `StopCause`, the signal handling and every shutdown timeout/budget are untouched. Tests: loop failure plus cleanup failure puts both reasons in the final message; a clean shutdown leaves the loop's reason alone; a failed cleanup on an ordinary exit is still a failure; both succeeding is success.
… modes The dsh-tui comparison I published was torn, and the cause was not the app: my tooling read its capture with a text-mode reader. `Path.read_text()` (like `open()` in text mode) applies universal newlines and turns every `\r` into `\n`. In a terminal stream those are different keys. dsh-tui writes bare CR to return to column 0 and steps rows with `CSI nB` itself, so the translation turned each "column 0, same row" into "next row": the banner came out in diagonal fragments and the whole frame looked scrambled. Measured on the same bytes: read as bytes -> 38/38 rows identical to tmux; read with read_text -> torn. - `read_stream(path)` reads bytes and decodes them, and the CLI entry uses it. `capture.py tui` already decoded bytes, so the harness path was sound; the damage was in scripts (and the render CLI) that went through `read_text`. - ED now honours its parameter. `CSI 3J` clears the scrollback and leaves the screen alone; wiping on it (as before) discards the frame just painted. A real terminal also does not move the cursor for any ED form, and 0/1 erase only the region around the cursor. Found while investigating the tearing; it is not what caused it, since dsh-tui follows `3J` with `2J` and a full redraw. Self-tests pin both: a bare CR survives `read_stream`, and `3J` keeps the screen while `2J` clears and `0J` clears from the cursor. Verification, this time printing both sides instead of a count: - replay of tmux's own `pipe-pane` bytes vs `capture-pane`: 38/38 rows; - our pty capture vs tmux at the same 30s: 38/38 rows, wordmark centred at rows 10-14 and 16-20 with nothing above them; - pyte agrees on both frames: 38/38 for dsh-tui and 38/38 for `future tui`.
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.
What and why
The screenshot capture path now models a real terminal instead of a plain byte stream, so a captured TUI frame matches what the UI actually draws. The CLI's headless entry point keeps the reason a run stopped even when the Agent also fails to shut down. The doubao thinking-level work is recorded as a live verification instead of staying in a conversation.
Commits
Verification
cargo fmt --all -- --check: clean for every tracked file. The single complaint comes from an untracked scratch file in the local checkout (tui/tests/perf_loop_probe.rs) that is not part of this branch.cargo clippy -p future-cli --all-targets -- -D warnings: clean.cargo test -p future-cli --lib: 1398 passed, 1 failed. The failure iscommands::mcp_client::tests::process::the_stderr_tail_keeps_the_last_lines_and_drops_the_oldestin a module this branch does not touch; it passes 3/3 when rerun on its own and is the stderr-tail flake previously reproduced onmain.cargo test -p future-cli --lib headless::: 27 passed.python3 -m py_compile scripts/screenshots/tui_capture.py scripts/screenshots/tui_terminal.py: clean.make check-docs: 328 docs OK (placement, bilingual pairing, links, script paths, code fences; provider matrix 13 rows).Notes