Skip to content

tui: draw scrollback composer borders with the fullscreen layout - #1944

Merged
zjywill merged 8 commits into
mainfrom
pinacode/scrollback-composer-layout
Nov 20, 2026
Merged

zjywill merged 8 commits into
mainfrom
pinacode/scrollback-composer-layout

Conversation

@zjywill

@zjywill zjywill commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1894

Summary

Scrollback draws the composer with the same layout as fullscreen. The run status, the status slot (esc interrupt, notices, permission required, answer required, disconnect) and context usage sit on the composer's bottom border, left side. The place and unread badge sit on its right side. The model label moves to the top border's right side. The shell-mode title (! shell mode) keeps the top-border title. frame.model_label stays fullscreen-only. The footer line keeps only the permission mode.

The design change is in CLI current activity, confirmed by the maintainer in #1894. The scrollback examples, the Chinese copies, CLI commands, Timeline UI and the CLI README are updated to match.

Code: crates/dim-cli/src/ui/tui.rs removes the scrollback special case and the scrollback footer copies of the slot, usage, goal and background-task segments. Both modes build the borders through the shared dock_status, composer_place and label.fitted path.

Replaced composer (review follow-up)

When a prompt replaces the composer (approval, question, effort, exit, upgrade, fork, timeline, queue, export or report), the composer's bottom border is not drawn. A notice or disconnect now draws once on muted rows above the footer, wrapped to the terminal width so the text stays whole. The footer stays permission-only. Only a notice or a failure gets this row.

Tests: a_replaced_composer_still_shows_the_disconnect_and_keyboard_notices_once opens a real approval prompt through sync_prompt, applies Update::Failed without clearing app.prompt, presses Enter and Ctrl+C, and asserts each notice shows once in both modes. a_replaced_composer_keeps_a_narrow_notice_whole checks the 32-column wrap.

Retry status on the border (review follow-up)

The bottom border used to clip the whole status corner from the right, so a long retry reason pushed esc interrupt off the border. The corner now tries these candidates in order and takes the first that fits:

  1. the full run status (phase and retry reason) with every optional part;
  2. the phase with the slot and the optional parts, dropping context, then goal, then background tasks;
  3. the optional parts with the slot and without the phase, dropped the same way;
  4. the slot alone, clipped from its end when it is wider than the border.

The retry reason goes before the phase. The slot outranks every optional part. Fullscreen shares this path, so both modes follow the same rule.

At 24 columns the phase drops so the slot can stay whole. The previous test expected the phase at that width, and I changed it. Please confirm that priority.

Test: a_retry_keeps_the_stop_shortcut_on_the_border_before_its_reason checks widths 100, 60, 48 and 40 in both modes: esc interrupt on the bottom border, the long reason dropped at 60 and below, and the phase kept at 48 and above. The 60-column case in scrollback_composer_handles_notices_approvals_questions_retry_disconnect_shell_and_unread also asserts esc interrupt.

Verification

  • ./dev check: passed.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: passed.
  • cargo test -p dim-cli --locked: 749 passed, 0 failed.
  • node scripts/adr-check.mjs --base origin/main: passed.
  • node scripts/tui-tmux/run.mjs --area approvals: approval_panel_allows_one_command and question_panel_answer_reaches_the_next_request passed.
  • node scripts/tui-tmux/run.mjs composer_borders_match_in_scrollback_and_fullscreen: passed.
  • Full tmux suite, run on fa178cd before the review fixes: 25 of 27 passed. prompt_suggestion_offers_and_takes_the_next_message failed once on timing and passed on two reruns. npm_launcher_streams_and_passes_interrupts fails on this machine because mise asks to trust the user's config. That is an environment issue.
  • TUI: task strip disappears while a tasks prompt is open; tmux suite fails on tmux 3.6a #1890 (the tmux 3.6a harness fix) is on main via TUI: keep the task strip under an open tasks prompt; fix tmux suite on 3.6a #1896 (8882453). This branch contains it.

Design rule checklist

  • Scope, commands, handover, Timeline before, batch, context, cross-language faces, business configuration: n/a. The change is in the native TUI renderer and adds no plugin, part, service or event.
  • Infrastructure unchanged. Core mechanisms gain no plugin-specific handling.
  • No accepted ADR is modified or deleted. No other module's design is changed.

Scrollback put the run status on the composer's top border and the slot,
context usage and model on the footer line. Both modes now use the
fullscreen layout: status, slot and usage on the bottom border's left
side, place and unread badge on its right side, model label on the top
border's right side, and only the permission mode on the footer line.

Refs #1894

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Scrollback 弹窗替换输入框时,断线提示消失。 Update::Failed(tui.rs:3120–3127)保留大部分当前弹窗,只记 failure;slot() 会据此生成 Disconnected · draft kept。现在提示只在输入框边框里,但审批、Ask、队列、Timeline 等会走 replaced(:6341–6359),整个输入框不渲染;:6512 又只追加权限 footer。结果是在 scrollback 看着一个仍像能操作的旧审批/队列面板,却没显示已经断线。旧的 scrollback footer 有这条状态。请在 replaced 时将断线/重要通知交给替代面板或独立状态行,正常输入框不重复显示。新增测试应保留真实打开的审批或队列弹窗,再触发 Update::Failed,而不是先把 app.prompt 清空。基于渲染与状态路径的静态核对,未本地跑 tmux。

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the full main...head diff at fa178cd. The unification works and matches the maintainer-approved direction in #1894: the model label and the shell title fit the top border, the dock, place and unread badge fit the bottom border, and the footer keeps the permission preset and its hint. I ran cargo fmt --all -- --check --config error_on_line_overflow=true, node scripts/adr-check.mjs --base origin/main, git merge-tree origin/main HEAD (clean, no conflicts) and the full cargo test -p dim-cli --lib (741 passed). I could not run the tmux suite because tmux is not installed here; the new scenario parses and is listed by run.mjs --list.

P2: a panel in place of the composer hides the status slot, so the disconnect and keyboard notices vanish in scrollback. I agree with eric8810 on this.

Problem: dock_status is now the only live carrier of slot() and self.notice (crates/dim-cli/src/ui/tui.rs:6312, :8303-8332), but it is drawn only into composer_box, and composer_box is dropped when a panel replaces the composer through replaced (crates/dim-cli/src/ui/tui.rs:6341-6359). The only live row that survives is status_line (crates/dim-cli/src/ui/tui.rs:6512), which now renders just the permission preset and hint (crates/dim-cli/src/ui/tui.rs:8368-8382). Update::Failed deliberately keeps the open prompt (crates/dim-cli/src/ui/tui.rs:3120-3127), so a Permission, Ask, Queue, Timeline, Effort, Exit or Fork panel stays on screen with no disconnect state.

Failure scenario: in scrollback, a permission request is open and the daemon disconnects. The panel still offers Allow once / Reject and the footer reads only ⏵⏵ Workspace write (shift+tab to cycle). Pressing Enter takes the failure branch, which sets Disconnected; draft kept. Exit and resume this Session. (crates/dim-cli/src/ui/tui.rs:3254-3259), but that notice is not drawn either, so the key gives no feedback. Pressing Ctrl+C over the panel sets Interrupt requested; Ctrl+C again to exit (crates/dim-cli/src/ui/tui.rs:3866-3874), also invisible. The old scrollback footer rendered the slot in both cases, so this is a scrollback regression; fullscreen already had the gap, and the unification makes scrollback match the worse side.

I verified both paths with a local probe on this head: a real Prompt::Permission opened by the approval snapshot plus Update::Failed yields the panel and the permission footer but no Disconnected · draft kept, and pressing Enter sets the notice while the frame still lacks it. The one-time Error: ... and Disconnected; draft kept... blocks are still committed to scrollback (crates/dim-cli/src/ui/tui.rs:5946-5985), so the disconnect is not entirely lost, but the persistent live indicator and all later keyboard feedback are.

Test gap: scrollback_composer_handles_notices_approvals_questions_retry_disconnect_shell_and_unread makes the slot visible by assigning app.prompt = None (crates/dim-cli/src/ui/tui.rs:12223, :12234) and tests failure with no prompt open (crates/dim-cli/src/ui/tui.rs:12260-12267), so it never exercises the replaced-composer state that loses the message.

Fix: when replaced, draw the slot (notice, failure, approval/question, interrupt) on a separate muted live row above status_line, or hand it to the replacement panel; keep the footer permission-only. Add a test that leaves the Prompt::Permission that sync_prompt opens in place, sets failure, asserts the live rows contain Disconnected · draft kept, then presses Enter and asserts the failure notice.

P2: the goal and model-preview docs still describe the old scrollback footer, so cli-commands contradicts itself.

Problem: docs/design/cli-commands.md:682-696 still shows the scrollback example with ◎ goal active 1.8K / 256K on the footer and says Fullscreen draws the same element in the composer's bottom border at :689. The updated paragraphs in the same file say both modes put goal and context on the bottom border and leave only the permission preset and hint on the footer (docs/design/cli-commands.md:3109-3117, :3277-3282). The Chinese copy has the same split (docs/zh/design/cli-commands.md:360-373 against :1870-1875 and :1952-1957). Also, "the footer's preview" (docs/design/model-configuration.md:581, docs/design/cli-commands.md:1493) is now wrong: the Home preview sits on the top border in both modes (docs/design/model-configuration.md:560-565).

Failure scenario: an implementer following the goal section would put goal and context back on the scrollback footer, reintroducing the split this PR removes; a reader cannot tell which of the two statements is the contract.

Fix: update the goal example and the "Fullscreen draws..." sentence in both languages to the unified borders, and replace "footer's preview" with the top-border label.

P3: two new assertions do not test what their comments claim.

  • crates/dim-cli/src/ui/tui.rs:12175-12178 asserts bottom.contains('…') to prove the place is shortened, but the run status already ends in thinking…; the assertion passes even if the place is dropped entirely. Assert the shortened tail (for example …robe) or that the full workspace is absent.
  • scripts/tui-tmux/scenarios.mjs:919-922 waits for widest <= 60; a tmux pane capture is wrapped at the pane width, so that condition can only pass. The content assertions carry the check; if the intent is to prove no wrapping, assert the composer border row is at most 58 cells (the two-side margin) or ends with ╮ / ╯.

CI at this head: changes, dependencies, web and windows-cli pass, verify is pending, acp-registry is skipped. git merge-tree against origin/main is clean, and open PR #1881 also touches tui.rs but only in the report-reply code, away from the composer regions.

Verdict: REQUEST_CHANGES, blocking on the P2 slot visibility and the P2 docs contradiction (docs-only fix).

A prompt that replaces the composer (approval, question, queue, timeline
and similar) hides the composer's bottom border, which was the only place
the status slot was drawn. A disconnect or a required answer then showed
nowhere in scrollback, and in fullscreen too. While the composer is
replaced, the footer line now carries the slot, once; the composer keeps
drawing it on its bottom border when it is shown.

Refs #1894
@zjywill

zjywill commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks, the review is right. Both modes had the gap: fullscreen also skips the composer's bottom border while a prompt replaces it.

Fixed in cf6198e. While the composer is replaced, status_line puts the status slot on the footer line, once, in both modes. When the composer is shown, the slot stays on its bottom border only, so nothing is drawn twice. I updated the rule in the CLI current activity and CLI commands design docs and in the CLI README.

The new test a_disconnect_stays_visible_once_while_a_prompt_replaces_the_composer keeps a real open approval and a real open queue prompt, applies Update::Failed without clearing app.prompt, and asserts the disconnect shows exactly once in both modes. A normal-composer case checks the slot is on the bottom border and not the footer. With the footer rule disabled, the test reports 0 instead of 1.

Checks: ./dev check, workspace Clippy, cargo test -p dim-cli (747 passed), the approvals tmux area and the composer tmux scenario all pass.

I also corrected the PR body: #1890 is on main via #1896 (8882453), and this branch contains it.

…laces the composer

While a prompt replaces the composer, the composer's bottom border is not
drawn, so a disconnect, an Enter notice over a stale panel, or a Ctrl+C
notice was drawn nowhere in either mode. A replaced composer now shows its
notice or disconnect once, on a muted row above the footer. The footer
stays permission-only, and the composer shows the slot only when drawn.

Also corrects the goal example and Home preview wording in the CLI
commands, model configuration and Chinese docs to the unified borders, and
tightens two weak assertions (place tail at 60 columns, composer border
corners in tmux).

Refs #1894
@zjywill

zjywill commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed in 43dae25, covering both reviews.

Slot visibility (eric8810's P2 and yyhhyyyyyy's first P2, both modes). A replaced composer now draws its notice or disconnect once, on a muted row above the footer. That covers the disconnect, the Enter notice over a stale panel, and the Ctrl+C notice. The footer stays permission-only. The test opens a real approval prompt through sync_prompt, applies Update::Failed without clearing app.prompt, presses Enter, and presses Ctrl+C. Each assertion checks the text appears once in the live rows. The existing scrollback test keeps its app.prompt = None cases and adds a replaced case.

Docs. The goal example in cli-commands.md now shows the unified bottom border in one example, and the sentence above it is fixed. The Chinese copy matches. The footer-preview wording in model-configuration.md and cli-commands.md now says the top border. The replaced-composer rule is updated in the activity doc, CLI commands, and the CLI README.

P3. The 60-column place assertion now checks the cut tail …robe and that the full path is absent. The tmux composer check now asserts each border row ends in its corner, so a wrapped border fails it.

Checks: ./dev check, workspace Clippy, cargo test -p dim-cli (747 passed), adr-check, the approvals tmux area, and the composer tmux scenario all pass.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified the shared composer layout and the replacement-panel follow-up on 43dae2532852d9f5af0eb0ac24f862bc771402ae. The Linux TUI suite passed all 167 selected tests and all four targeted tmux scenarios passed. A separate 32-column tmux check showed the disconnect exactly once above /queue in each layout. One scrollback regression remains in the normal composer during a provider retry.

Comment thread crates/dim-cli/src/ui/tui.rs Outdated
let end = MARGIN + outer - 3;
frame.model_label = Some((box_top, end - width_of(model)..end));
}
let docked = self.dock_status(status.as_deref()).and_then(|text| {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Keep the stop shortcut visible when retry details fill the border. In a 60-column scrollback tmux pane, a fixture returning HTTP 503 rendered Retrying 2/8 in 1 s · The provider reported a ser on the bottom border and the permission-only footer. Both Esc stops and esc interrupt were absent, although pressing Escape still stopped the retry. The base renderer kept esc interrupt on a separately fitted footer for the same width in the render comparison. The new clip fits the retry description first, so it can consume every cell before the stop hint or subsequent keyboard notice. Please reserve space for the actionable text before fitting the optional retry detail, and assert that the stop shortcut remains visible in the existing 60-column retry case.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7bdf5aa.

The bottom border no longer clips the whole status corner from the right. It fits its parts in order: full run status, then the run status without the retry reason, then the slot beside the phase, then the slot alone. The optional parts go first, and the slot always stays whole. Fullscreen shares this path, so both modes follow the same rule.

At 60 columns with a long retry reason, esc interrupt stays on the border. a_retry_keeps_the_stop_shortcut_on_the_border_before_its_reason covers 100, 60, 48 and 40 columns in both modes. The 60-column case in the existing scrollback test also asserts esc interrupt.

One decision to confirm: at 24 columns the phase now drops so the slot can stay whole. Both cannot fit at that width, and the old test expected the phase there. I changed that assertion.

Checks: ./dev check, workspace Clippy, cargo test -p dim-cli (749 passed), adr-check, the approvals tmux area and the composer tmux scenario all pass.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7bdf5aa: dock_status now fits the full run status, then the phase with the slot, then the slot alone, and a_retry_keeps_the_stop_shortcut_on_the_border_before_its_reason asserts esc interrupt at 100, 60, 48 and 40 columns in both modes. At 24 columns the phase is dropped so the slot stays whole.

The bottom border clipped the whole status corner from the right, so a
long retry reason pushed esc interrupt off the border. The corner now
fits its parts in order: full run status, essential run status (the
phase without the reason), then the slot alone beside the phase; the
optional parts go first, and the slot always stays whole. The same rule
applies in fullscreen, which shares this path.

A replaced composer's notice or disconnect wraps onto rows instead of
being clipped, so a narrow terminal keeps the whole text.

Refs #1894
@zjywill
zjywill requested a review from zerob13 November 20, 2026 09:01

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the full main...head diff at 7bdf5aa against current origin/main (14cc130). The PR unifies scrollback with fullscreen: the model label on the top border's right, run status, status slot, background count, goal and context on the bottom border's left, place and unread badge on its right, and only the permission preset and hint on the footer.

Previous P2s are fixed. A replaced composer still draws its notice or disconnect above the footer (crates/dim-cli/src/ui/tui.rs:8438-8455, pushed at :6539), now wrapped instead of clipped, and the disconnect/notice test still passes (:12179-12250). The docs contradiction from my first review remains fixed (docs/design/cli-commands.md:677-690, :3101-3114, docs/design/model-configuration.md:558-565, :581, docs/zh/design/cli-commands.md:358-367, :1861-1866, crates/dim-cli/README.md:1155).

zerob13's P2 is fixed, verified by execution. dock_status now fits candidates (crates/dim-cli/src/ui/tui.rs:8333-8380), and a_retry_keeps_the_stop_shortcut_on_the_border_before_its_reason (:12300-12334) asserts esc interrupt on the bottom border at 100, 60, 48 and 40 columns, and the phase at 48 and above. That test, a_replaced_composer_keeps_a_narrow_notice_whole and the full cargo test -p dim-cli --lib (744 passed) all pass. A temporary in-crate probe confirmed the notice wrapping at 32 columns and the status-corner behavior described below.

P2: an idle session with a background task, an active goal and context drops the whole left status corner at 60 columns.

Problem: when run and slot are both absent, the candidate list (crates/dim-cli/src/ui/tui.rs:8370-8375) has only join(None, &optional) (the whole optional string) and join(None, &[]) (nothing). If the joined background count, goal and context exceed max_border, find returns None and the fallback join(essential, &[]) is also None (:8377-8379). frame then draws the border with no left label (:6309, :6330-6342).

Failure scenario: a 60-column pane with one unfinished task, an active goal and 98.3K / 256K. The labels are 1 in background · /tasks (24 cells), ◎ goal active (13) and 98.3K / 256K (12); joined with two spaces that is 53 cells. outer = 57 and max_border = 51, so the border renders ╰───────────────────────────── /private/tmp/dima-probe ─╯ in both scrollback and fullscreen. The background count, goal and context are all gone, and the place label takes their space. The status only appears at budget 53, which is 62 columns.

I confirmed this with a temporary in-crate probe on this head: composer_chrome(60) in both modes prints the place-only border above, dock_status(None, 51) and dock_status(None, 52) are None, and dock_status(None, 53) returns the full string. The previous head clipped the same 53-cell string to 51 cells and showed its prefix; the new candidate fitting drops it whole. This contradicts docs/design/cli-commands.md:3104-3108 ("keep ... background task count, goal and context information on the left side of the composer's bottom border") and docs/design/cli-current-activity.md:33-39 ("Shorten the status within its existing space by terminal cell width"). It is also a regression from 43dae25, which returned the joined string and let frame clip its prefix.

Fix: add candidates that drop optional parts one at a time before returning None (for example join(None, &optional[1..]) and join(None, &optional[2..]), or the same suffixes beside the run status), so the corner shortens instead of vanishing and keeps the context reading or goal when either fits. Add a 60-column test with a background task, an active goal and context in both modes.

P3: the replaced-composer docs still say the notice is drawn on one row, but it now wraps. replaced_notice emits wrap_words rows (crates/dim-cli/src/ui/tui.rs:8438-8455); at 32 columns my probe got two rows, Disconnected; draft kept. Exit and and resume this Session.. crates/dim-cli/README.md:1155, docs/design/cli-commands.md:3110-3111, docs/design/cli-current-activity.md:41 and docs/zh/design/cli-commands.md:1866 still say "a row"; say "above the footer" or "rows above the footer".

Optional: the dock_status comment says "The slot always stays whole" (crates/dim-cli/src/ui/tui.rs:8330), but a notice wider than max_border is still clipped by frame (:6330-6342); for example Interrupt requested; Ctrl+C again to exit is 41 cells at 40 columns, where max_border is 31. Either wrap the slot like replaced_notice or soften the comment.

Verification: git diff --check origin/main...HEAD, git merge-tree --write-tree origin/main HEAD (clean against 14cc130), cargo fmt --all -- --check --config error_on_line_overflow=true, node scripts/adr-check.mjs --base origin/main (10 changed files) and cargo test -p dim-cli --lib (744 passed) all pass. The temporary probe worktree was removed. tmux is not installed, so the tmux suite did not run; node --check scripts/tui-tmux/scenarios.mjs and node scripts/tui-tmux/run.mjs --list parse and list the new scenario. CI: changes, dependencies, web and windows-cli pass, verify is queued, acp-registry is skipped.

Verdict: REQUEST_CHANGES, blocking on the 60-column status-corner loss.

Comment thread crates/dim-cli/src/ui/tui.rs Outdated
join(full, &optional),
join(essential, &optional),
join(essential, &[]),
join(None, &[]),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Fitting the optional parts as one string erases the left status corner at 60 columns. When run and slot are both absent, the candidates above are the whole optional string or nothing. A 60-column session with one unfinished task, an active goal and 98.3K / 256K joins 1 in background · /tasks (24), ◎ goal active (13) and 98.3K / 256K (12) with two spaces to 53 cells, while max_border is 51 (crates/dim-cli/src/ui/tui.rs:6309). find returns None and this fallback returns None too (:8377-8379), so the border shows only the place label and loses the background count, goal and context. I confirmed this with an in-crate probe in both scrollback and fullscreen: dock_status(None, 51) and (None, 52) are None, and the status appears only at budget 53. This contradicts docs/design/cli-commands.md:3104-3108. It is a regression from 43dae25, which returned the joined string and let frame clip its prefix. Fix: add candidates that drop the optional parts one at a time (for example join(None, &optional[1..])) so the corner shortens instead of disappearing, and test 60 columns with a background task, an active goal and context.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 18c5edf.

dock_status now tries these candidates in order and takes the first that fits: the full run status with every optional part; the phase with the slot and optional parts, dropping the context first, then the goal, then the background task count; the optional parts without a run status, dropping from the end the same way; and the slot alone. The slot is kept whole, and it outranks every optional part. If even the first optional part does not fit alone, it is clipped instead of dropped.

The new test a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first covers 60 and 40 columns in both modes with one background task, an active goal and context. At 60 columns the corner keeps the task count and goal and drops the context. At 40 columns only the task count is left.

The design text now lists this order in both languages (docs/design/cli-commands.md, docs/zh/design/cli-commands.md).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c1bc3c6.

I did not wrap the slot. A border is one row. The contract is now stated accurately: the slot outranks every other part and is kept whole when it fits the border. It is clipped from its end only when the slot alone is wider than the border. The dock_status doc comment and the matching sentences in docs/design/cli-commands.md and docs/zh/design/cli-commands.md say this.

The narrow corner test now also sets a 40-column notice, Interrupt requested; Ctrl+C again to exit. It asserts the border starts with ╰─ Interrupt requested; Ctrl+C aga, so the slot is clipped from its end and starts at the corner's left edge. It also asserts that no exit, background count, goal, workspace path or place is drawn beside it.

Checks: ./dev check passed and cargo test -p dim-cli --locked passed (745 lib tests, 0 failed).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optional-drop P2 is fixed. dock_status now tries the phase with optional parts one at a time and the optional-only prefixes before the slot (crates/dim-cli/src/ui/tui.rs:8375-8387), and a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first (:12308-12355) passes in both modes: at 60 columns with one task, an active goal and context the border keeps 1 in background · /tasks ◎ goal active and drops 98.3K, and at 40 columns it keeps only the task count. I withdraw this P2.

The slot comment added in c1bc3c6 still describes a clip that does not happen when a run status is present. Every candidate fails when the slot alone is wider than the border, and frame gets join(essential, &[]) from :8386, so it clips phase + slot; at 24 columns the notice is gone and at 32 columns only Interr follows the phase. I agree with eric8810 on 5990492253; returning the slot alone from that fallback would make the comment true. Also, "The optional parts go first, then the run status's reason" inverts the candidate order at :8375-8377, where the reason is dropped before any optional part.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at e54529a: when the slot exists and no candidate fits, dock_status returns the slot alone (crates/dim-cli/src/ui/tui.rs:8395-8401), so frame clips only the slot. a_slot_wider_than_the_border_is_not_replaced_by_the_phase covers a running retry plus the long notice at 40 columns in both modes, and a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first adds a running case; a probe at 24 to 100 columns starts at the notice. Withdrawing the over-wide slot P2.

Comment thread docs/design/cli-commands.md Outdated
information on the left side of the composer's bottom border, leaving only the permission
preset and its shortcut hint on the footer line. While a prompt replaces the composer
(permission, question, effort, exit, upgrade, fork, timeline, queue, export or report),
the composer is not drawn, so a notice or the disconnect state is drawn once on a row

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] This says "a row", but the replaced-composer notice now wraps. replaced_notice returns wrap_words rows (crates/dim-cli/src/ui/tui.rs:8438-8455); at 32 columns the resume notice is two rows (Disconnected; draft kept. Exit / and resume this Session.). Say "above the footer" or "rows above the footer" here, and in crates/dim-cli/README.md:1155, docs/design/cli-current-activity.md:41 and docs/zh/design/cli-commands.md:1866.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 18c5edf. The four places now say the notice is drawn on "rows above the footer" (or "the rows just above the footer" in the English CLI commands doc): crates/dim-cli/README.md, docs/design/cli-current-activity.md, docs/design/cli-commands.md and docs/zh/design/cli-commands.md. The notice wraps, so it can take more than one row.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All four places now say rows: crates/dim-cli/README.md:1155 ("rows above the footer"), docs/design/cli-commands.md:3114-3115 ("rows just above the footer"), docs/design/cli-current-activity.md:41 ("rows above the footer") and docs/zh/design/cli-commands.md:1866 ("页脚上方的若干行"). a_replaced_composer_keeps_a_narrow_notice_whole passes at 32 columns in both modes. I withdraw this P3.

…anishes

When no run status and no slot are shown, the corner had only the whole
optional string as a candidate, so at 60 columns it vanished when the
background task count, goal and context did not fit together. The corner
now tries the run status and then fewer and fewer optional parts (context
first, then goal, then background tasks), then the optional parts without a
run status, and the slot alone. The slot always stays whole; if even the
first optional part does not fit, it is clipped rather than dropped.

Refs #1894
…oo wide

The bottom corner keeps the slot whole when it fits the border and clips
it from its end only when the slot alone is wider. The dock_status comment
and the CLI commands design (English and Chinese) now say so, and the
narrow corner test asserts a 40-column notice starts at the corner's left
edge with nothing beside it.

Refs #1894
@zjywill
zjywill requested a review from yyhhyyyyyy November 20, 2026 09:26

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审 c1bc3c6f:最初的弹窗断线提示已修复;60 列的普通重试也有 esc interrupt 覆盖。还有一个窄窗边界与这次声明的优先级不一致。

[P2] 当会话还在运行、且通知本身比底边宽时,fallback 仍先显示运行阶段,再裁通知。 tui.rs:6164 在正常运行且无弹窗时仍生成 phase;:8385–8387 在所有候选都放不下时先返回 join(essential, &[]),结果是 phase + slot,所以 :6330–6340 从末尾裁剪时,低优先级的 phase 会占掉通知的位置。现有 a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first 最后虽加了长通知,但 snapshot 没有 running: true,无法覆盖这条分支。建议 slot 存在时在 fallback 直接返回 slot 本身,让外层只裁它;加一条正在运行(最好重试中)且有超宽通知的用例,两种布局都应从通知开头显示,不应先显示 phase。静态路径已核对,未本地运行 Rust。

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the full main...head diff at c1bc3c6 against origin/main 44af122, the ref named for this review. origin/main advanced to b623ac6 during the review; the merge base is still 68043df, the diff is unchanged, and git merge-tree is clean against both. The PR unifies scrollback with fullscreen: the model label on the top border's right, the run status, status slot, background count, goal and context on the bottom border's left, the place and unread badge on its right, and only the permission preset and hint on the footer.

My two earlier findings are fixed.

  • The 60-column idle corner loss is gone. dock_status now tries the full status, then the essential phase with fewer and fewer optional parts, then the optional-only prefixes, then the slot (crates/dim-cli/src/ui/tui.rs:8375-8387); the only None left is the empty corner with no run status, no slot and no optional part. a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first (:12308-12355) covers both modes with one unfinished task, an active goal and 98.3K / 256K: at 60 columns the border keeps 1 in background · /tasks ◎ goal active and drops the context; at 40 columns it keeps the task count. I confirmed the 60-column output in a probe, and the test passes.
  • The replaced-composer docs now say rows in all four places: crates/dim-cli/README.md:1155, docs/design/cli-commands.md:3114-3115, docs/design/cli-current-activity.md:41 and docs/zh/design/cli-commands.md:1866. replaced_notice wraps at crates/dim-cli/src/ui/tui.rs:8446-8462, and a_replaced_composer_keeps_a_narrow_notice_whole passes. I withdraw that P3.

P2: the fallback still lets the phase take an over-wide slot's cells. I agree with eric8810 on 5990492253. When a run status is present and the slot alone is wider than the border, every candidate fails, so frame gets join(essential, &[]) from crates/dim-cli/src/ui/tui.rs:8386 and clips phase + slot from its end at :6330-6342. In a 24-column pane with a running turn and Interrupt requested; Ctrl+C again to exit, the border renders ╰─ · working… <1s ─╯ and the notice is gone; at 32 columns only Interr follows the phase. The slot does not outrank the phase there, and the comment added in c1bc3c6 (:8330-8333) says the caller clips the slot from its end when it alone is wider, which is not what the border shows. The bottom border is built once for both modes (:6327-6358), so fullscreen takes the same fallback. Fix: when the slot exists, return it alone from the fallback so frame clips only the slot, as eric8810 suggested; add a running case with that notice to a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first, whose snapshot at :12317-12326 has no running: true.

P3 (optional): the priority prose still does not match the candidate order. docs/design/cli-commands.md:3110 says "The retry reason and the run status head go before the optional parts", and crates/dim-cli/src/ui/tui.rs:8333 says "The optional parts go first, then the run status's reason". The first candidate already drops the reason before any optional part (:8375-8377), and the head is not universally ahead either: with a retry phase, esc interrupt, an active goal and 98.3K / 256K, a probe renders the phase with the slot at 48 columns (optional parts dropped) and esc interrupt ◎ goal active at 40 columns (phase dropped). The zh copy at docs/zh/design/cli-commands.md:1866 has the same wording, and the PR description still lists the order without the optional-only step. Reword all three to the actual order: full status; phase with optional parts, dropping context, then goal, then background; phase with the slot; optional parts with the slot; slot alone.

Verification: git diff --check origin/main...HEAD, git merge-tree --write-tree origin/main HEAD (clean against 44af122, tree 50beeb33bd, and against b623ac6, tree f9780aaf), cargo fmt --all -- --check --config error_on_line_overflow=true, node scripts/adr-check.mjs --base origin/main (10 changed files) and cargo test -p dim-cli --lib (745 passed) all pass. The six new composer tests pass by name in both modes. node --check scripts/tui-tmux/scenarios.mjs passes and run.mjs --list lists composer_borders_match_in_scrollback_and_fullscreen. tmux is not installed, so the tmux suite did not run. The temporary probe worktree was removed. Cross-PR: open #1881 changed other tui.rs regions (report reply and its tests), away from dock_status and the composer border. CI at this head: changes, dependencies, web and windows-cli pass, verify is pending, acp-registry is skipped.

Verdict: REQUEST_CHANGES, blocking on the over-wide slot fallback.

Comment thread crates/dim-cli/src/ui/tui.rs Outdated
/// The composer's bottom-left status corner: the run status, the slot (a
/// notice in the highlight colour), background task count, goal and
/// context use, fitted to `budget` cells. The slot outranks every other
/// part and is kept whole when it fits the border; the caller clips it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Agree with eric8810 on 5990492253; this comment still overstates the clip contract. When a run status is present and the slot alone is wider than the border, every candidate fails and frame gets join(essential, &[]) from the fallback at :8386, so it clips phase + slot from its end. At 24 columns the phase fills the 15-cell budget and Interrupt requested; Ctrl+C again to exit is gone; at 32 columns only Interr follows the phase. The slot prefix is not what remains, so the slot does not outrank the phase and "clipped from its end only when the slot alone is wider" is not what the border shows. A scrollback probe on this head confirmed this at 24, 32, 40 and 48 columns; the border path is shared with fullscreen at :6327-6358. Fix: when the slot exists, return it alone from the fallback so the caller clips only the slot, or state that the phase keeps the prefix. Add a running case with that notice to a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first; its snapshot at :12317-12326 has no running: true. Also, "The optional parts go first, then the run status's reason" inverts the candidate order: the reason is dropped at :8375-8377, before any optional part.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2dca175, and the running case you asked for is in e54529a.

2dca175: when the slot exists and no candidate fits, dock_status returns the slot alone, so the outer clip shortens the slot and the phase no longer takes its cells. The test a_slot_wider_than_the_border_is_not_replaced_by_the_phase sets running: true with a retry and the notice Interrupt requested; Ctrl+C again to exit at 40 columns, in both modes, and asserts the border starts with the notice and has no phase.

e54529a: a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first now also covers the running case. With running: true, a retry, and that notice at 40 columns, the border starts with the notice and has no Retrying. A second check at 40 columns without a notice shows esc interrupt and ◎ goal active, with no phase, which is the order from the doc.

The dock_status comment and the design docs now state the real candidate order.

Comment thread docs/design/cli-commands.md Outdated
information on the left side of the composer's bottom border, leaving only the permission
preset and its shortcut hint on the footer line. When the corner is too narrow, its parts
go in this order: first the context usage, then the goal, then the background task count.
The retry reason and the run status head go before the optional parts. The slot outranks

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] This priority sentence does not match dock_status. The reason is dropped before any optional part: the first candidate carries the full status and every optional part, and the next one already drops the reason (crates/dim-cli/src/ui/tui.rs:8375-8377). The run status head is not universally ahead of the optional parts either: with a retry phase, esc interrupt, an active goal and 98.3K / 256K, a probe renders the phase with the slot at 48 columns (optional parts dropped) and esc interrupt ◎ goal active at 40 columns (phase dropped). Reword to the actual candidate order: full status; phase with optional parts, dropping context, then goal, then background; phase with the slot; optional parts with the slot; slot alone. The zh copy at docs/zh/design/cli-commands.md:1866 has the same wording.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e54529a. The comment in dock_status, docs/design/cli-commands.md and docs/zh/design/cli-commands.md now list the real candidate order:

  1. the full run status (phase and retry reason) with every optional part;
  2. the phase with the slot and the optional parts, dropping context, then goal, then background tasks;
  3. the optional parts with the slot and without the phase, dropped the same way;
  4. the slot alone, clipped from its end if it is wider than the border.

The reason goes before the phase. The code order is unchanged. The new 40-column check in a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first shows esc interrupt ◎ goal active with no phase, as the doc describes.

When the slot alone was wider than the border, the fallback put the phase
beside it, and the outer clip cut the slot from its end. The fallback now
returns the slot alone, so the notice leads the corner and the outer clip
shortens it. Without a slot the phase and the first optional part still
fall back in that order.

Refs #1894
@zjywill

zjywill commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed in 2dca175.

When the slot exists and no candidate fits, dock_status now returns the slot alone. The outer clip shortens it from its end, so the notice leads the corner and the phase no longer takes the cells. Without a slot, the fallbacks are unchanged: the phase alone, then the first optional part clipped. The candidate list is unchanged.

New test a_slot_wider_than_the_border_is_not_replaced_by_the_phase sets running: true with a retry, so both the full and essential run status exist. It then sets the notice Interrupt requested; Ctrl+C again to exit at 40 columns, in both modes. It asserts the border starts with the notice and contains no Retrying, server error or esc interrupt.

Checks: ./dev check passed, workspace Clippy passed, and cargo test -p dim-cli --locked passed (750 tests, 0 failed).

The corner drops the retry reason first, then the phase, then optional
parts (context, goal, background tasks). The comment and the design docs
described the order incorrectly. The comment, the English and Chinese
CLI commands design now list the real order. A test covers the running
retry with a long notice leading the corner, and that at 40 columns the
goal stays when the phase does not fit.

Refs #1894

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the full main...head diff at e54529a against current origin/main b623ac6. The merge base is still 68043df. git diff --check origin/main...HEAD and git merge-tree --write-tree origin/main HEAD are clean (tree 644d24a5362d9fbdbabadc0ea0ff52f9e37d63de). The PR is open, not draft, and GitHub reports MERGEABLE; checks are still running. The PR unifies scrollback with fullscreen: the model label on the top border's right, the run status, status slot, background count, goal and context on the bottom border's left, the place and unread badge on its right, and only the permission preset and hint on the footer.

The over-wide slot P2 is fixed. When the slot exists and no candidate fits, dock_status returns the slot alone (crates/dim-cli/src/ui/tui.rs:8394-8401), so frame clips only the slot (:6330-6342). I ran an in-crate probe with a running retry, a background task, an active goal, context and Interrupt requested; Ctrl+C again to exit at 24, 32, 40, 48, 60 and 100 columns in both modes. Every width starts at the notice: 24 columns ╰─ Interrupt reque ─╯, 32 ╰─ Interrupt requested; Ct ─╯, 40 ╰─ Interrupt requested; Ctrl+C aga ─╯, 48 ╰─ Interrupt requested; Ctrl+C again to ex ─╯, 60 the whole notice plus the place tail, and 100 the phase with the slot and the background count. a_slot_wider_than_the_border_is_not_replaced_by_the_phase (:12322-12358) and the running case in a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first (:12408-12436) cover both modes and pass. I withdraw this P2, and eric8810's 5990492253 with it.

The priority prose P3 is fixed. The dock_status comment (crates/dim-cli/src/ui/tui.rs:8328-8342), docs/design/cli-commands.md:3108-3116 and docs/zh/design/cli-commands.md:1866 now give the same order as the candidate list: full status with all optional parts; phase with the slot and optional parts, dropping context, then goal, then background tasks; optional parts with the slot and without the phase; slot alone. A 40-column probe without a notice and without a background task renders esc interrupt ◎ goal active with no phase, which is the third candidate. I withdraw this P3.

Earlier findings remain fixed. The 60-column idle corner keeps the background count and goal and drops the context. The replaced-composer notice still wraps above the footer. a_bottom_corner_without_run_or_slot_drops_its_lowest_parts_first and a_replaced_composer_keeps_a_narrow_notice_whole pass.

Optional, not blocking: the PR description still gives the shorter order ("full run status, then the run status without the reason, then the slot beside the phase, then the slot alone") and omits the phase-with-optional and optional-only candidates. The new running case lives in a test named for the no-run, no-slot corner and checks 40 columns; the fallback is width independent and the probe covers 24 through 100, so this is naming and coverage only.

Verification: git diff --check origin/main...HEAD, git merge-tree --write-tree origin/main HEAD (clean, tree 644d24a5), cargo fmt --all -- --check --config error_on_line_overflow=true, node scripts/adr-check.mjs --base origin/main (10 changed files), cargo test -p dim-cli --lib (746 passed, 0 failed), and all seven named composer tests pass by exact name. node --check scripts/tui-tmux/scenarios.mjs passes and node scripts/tui-tmux/run.mjs --list lists composer_borders_match_in_scrollback_and_fullscreen. tmux is not installed, so the tmux suite did not run. Cross-PR: no other open PR touches crates/dim-cli/src/ui/tui.rs or the changed design docs; open #1881 changes other tui.rs regions (report draft at crates/dim-cli/src/ui/tui.rs:2295 and :2538, tests at :19211 and later), away from dock_status and the composer tests. The temporary probe worktree was removed.

CI at this head: changes and dependencies pass, web and windows-cli are in progress, verify is queued and acp-registry is skipped.

Verdict: APPROVE.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I independently verified the retry and notice fixes on e54529a7f7d497b82eb176914f3cebfb24dff3eb using the GitHub merge tree 8c48c0516ee25b730bc9baa7d24b0881d90f4cdc. In both fullscreen and scrollback, a provider retry kept its countdown and esc interrupt at 60 columns, and 24 columns kept the interrupt hint. The long /settings usage notice led the bottom border at 32 and 40 columns while the retry was active, and Escape stopped it with the notice still displayed. The /queue disconnect appeared once above the footer in both modes at 32 columns.

All 171 selected Linux TUI tests, four targeted tmux scenarios, and 691 Windows CLI tests passed. The macOS verify job is still queued and the aggregate ci-ok check is pending.

@codoggy codoggy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

I reviewed the merge-base diff for e54529a7f7d497b82eb176914f3cebfb24dff3eb, including the latest status-candidate ordering correction. I found no blocking issues in the shared composer border paths reviewed.

The current dock_status implementation at crates/dim-cli/src/ui/tui.rs:8327-8347 documents and applies the candidate order used by the code: full run status first, then phase with optional parts, then optional parts without phase, and finally the status slot alone. The added coverage at crates/dim-cli/src/ui/tui.rs:12404-12465 checks a long notice during a running retry and the 40-column goal fallback; the English and Chinese design descriptions now match that order.

Checks: For this exact head, GitHub reported changes, dependencies, web, and windows-cli passed; acp-registry was skipped and verify was still queued. Static review only; I did not run Rust or tmux tests locally.

@zjywill
zjywill merged commit 6e65d41 into main Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: scrollback places run status, slot and model differently from fullscreen; unify on the fullscreen layout

5 participants