feat(kimi-code): two-line collapsed tool cards with width-aware headers - #3539
feat(kimi-code): two-line collapsed tool cards with width-aware headers#3539RealKai42 wants to merge 17 commits into
Conversation
Collapsed cards now show the call on line one and a single dim outcome row on line two: a Bash command's last output line (the live tail while running) with a line-count chip, a Grep/Glob path sample, or a generic tool's first output line. Read groups stay header-only and honor the global expand state; failed calls keep their preview. Headers split into head / flexible / tail segments so a long command fills the terminal width before the chip.
🦋 Changeset detectedLatest commit: 341ebbb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2d1ce8eb6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Collapsed cards now show up to three output lines before falling back to a single outcome row, the Grep chip counts files or matches according to output_mode, and the tools' pagination and empty-result notices no longer count as results. While the recent turns hold tool output that ctrl+o would reveal or hide, the footer shows ctrl+o expand or ctrl+o collapse.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b090435cd5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A collapsed Bash card's chip now counts the hidden lines (`N more lines`), its last-line outcome row carries a leading ellipsis, a generic tool's first-line row a trailing one, and the Grep glance keeps its "+N more" count in the fixed tail so width cuts drop samples, never the count. Background Bash results identify the task by their first metadata line instead of trailing internal hints, and header truncation now treats ANSI escapes as atomic zero-width units and stays bounded by the terminal width for huge arguments.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6870f348bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Glob's timeout, truncation, and warning lines no longer inflate the file count or pose as glance samples, and unnumbered Grep content with context flags falls back to an exact file count instead of claiming matches it cannot distinguish. The footer's ctrl+o hint now also appears when an outcome row is cut by the terminal width — one to three very long lines hide the remainder that ctrl+o reveals wrapped.
The Edit check now uses the same clustered diff render as the preview (context rows and inter-hunk separators count toward the cap), and an ExitPlanMode outcome card no longer reports hidden content — the plan is fully rendered by the call preview and its result body is expansion-independent. OUTCOME_MAX_LINES moves to the TUI constant directory with the other shared rendering limits.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44d8107373
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Outcome rows drop terminal control sequences before they are cut, a failed Bash card leaves the hidden-line count to its preview trailer, an unnumbered Grep glance lists each file once, a solo subagent card never reports hidden content, and the glance sample cap joins the other collapsed-card limits in the rendering constants.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a332a8eef9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…s as hidden The Grep chip and glance use the tool's count-mode summary and pagination total instead of the current page, Windows drive letters stay inside unnumbered content paths, Glob's ripgrep stderr continuation lines no longer count as files, a background question follows the line-count rule, and an error preview whose long line wraps past its row cap keeps the footer's ctrl+o hint on.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 987e4c3cb4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
An oversized result reaches the TUI as agent-core's truncation envelope; cards now render its first line as the outcome row and carry no chip instead of counting its metadata as files or lines. The Grep chip keeps the count-mode totals on an empty page, and the Bash chip counts rows the way the outcome rows do, so whitespace-only rows never claim hidden lines.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 261f520666
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…d ! cards A paginated content search reports the tool's match total, a capped Edit or Write preview counts as hidden even when the call failed, and a user-run ! command card tells the footer about its running tail or capped result.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac687568b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ut-off cards Grep and Glob counts read as lower bounds (`12+ files`) when the tool reports a timeout or output cap, a header too narrow for its fixed parts drops the middle and cuts the head before the chip, and a call whose arguments were cut off by max_tokens no longer claims hidden content.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 779b39d265
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…d paginated context A pagination total only stands in for the match count when no context flag is set, a ! command card that finished while expanded still counts its rows past the preview cap, parsed goal snapshots and bodiless goal updates report nothing to expand, header fitting measures graphemes instead of trusting code-unit length, and the escape pattern and tail window join the rendering constants.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f3a38f526
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ap exactly A Grep call with -A/-B/-C set to zero produces no context rows, so its matches stay countable; the Edit hidden-content check now renders the preview capped and uncapped and compares them, so a body that fills the cap exactly no longer counts as cut.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c24562bbe7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… window Toggling ctrl+o off collapses every expanded card, including one that slid before the three-turn cutoff since it was expanded, so the footer now keeps offering collapse while any expanded card hides content. Grep context detection follows the backend's -C precedence, where a defined -C makes -A and -B moot.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5c0edffab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ates Their one-line success acknowledgements repeat what the header, chip and preview already show, so they render in neither state; any other successful output shows as an outcome row in both. The footer's expand hint therefore depends only on the capped preview for these cards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 481944d5ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The finished header is three segments — label, line count, `· N failed` tail — so a narrow row drops the line count before the failure count, which is the only sign of partial failure while the per-file body is collapsed.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c8a170a4f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…a status command A Grep or Glob the tool cut short before any row renders its notice instead of an exact-looking empty result and carries no chip, a ReadMediaFile result that is not a media envelope follows the line-count rule, and the footer's ctrl+o hint moves to line 2 when a status_line.command owns line 1.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 261a440848
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…d stop hinting on notice-only searches A Glob that skipped unreadable directories reports its file count as a lower bound, and a search cut short before any row — which renders only the tool's notice, the same way in both states — no longer makes the footer offer ctrl+o.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 341ebbb3b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const remaining = Math.max(0, width - leftWidth - 2); | ||
| const rightText = this.buildRightText(tipCandidates, remaining, colors); |
There was a problem hiding this comment.
Let the Ctrl+O hint displace inline tips
When status_line.items explicitly contains tips and the terminal is narrow, the rotating tip has already been included in leftWidth, while buildRightText() receives no tip candidate that it can discard. The resulting remaining can be zero, so the footer truncates the inline tip and omits ctrl+o expand even at widths where removing that tip would leave enough room for the fixed hint; exclude or replace the inline tip whenever the shortcut needs its space.
Useful? React with 👍 / 👎.
| default: | ||
| return nonEmptyLines(result.output).length > OUTCOME_MAX_LINES; |
There was a problem hiding this comment.
Account for compact WaitFor results before using the line cap
For a successful WaitFor result such as wait_status: no_tasks\nwaited_ms: 0\ntimeout_ms: 30000, the dedicated renderer emits no collapsed body but adds the raw result when expanded. Because WaitFor falls through to this generic three-line threshold, hasHiddenContent() returns false and the footer omits the expand hint even though Ctrl+O visibly reveals those fields; classify parsed WaitFor results according to their renderer rather than their raw line count.
Useful? React with 👍 / 👎.
Related Issue
No linked issue; internal UX change, the problem is described below.
Problem
Finished tool calls dominate the transcript, and their collapsed bodies (three output lines, command previews, glance lines) are rarely what the user reads. Long Bash headers also wrap to several rows because the header was built as one string and cut only by the terminal. Scanning a turn, the user wants two things per call: what ran, and what came of it. And when output is collapsed, the user should be able to tell that something is hidden and how to reveal it.
What changed
Two-line collapsed cards. Line one identifies the call; below it, dim width-truncated outcome rows state what came of the call. Output of three lines or fewer is shown whole; longer output contributes one telling line and the rest waits for
Ctrl+O. Cards may grow between streaming, running and done, but never shrink.$ <command>; the outcome row is the command's last output line (marked with a leading…when earlier lines are hidden), or the newest live line while it runs, and a· N more lineschip counts what is hidden. A failed command keeps its three-line preview and its own… (N more lines, ctrl+o to expand)trailer, so it carries no chip.Ctrl+Oshows the full command and output., +N morecount in the fixed tail so a width cut drops samples, never the count; unnumbered Grep content lists each file once (a Windows drive letter stays part of the path), and a paginated result counts the tool-reported totals rather than the current page (a paginated content search reports its match total and leaves the file count out, since only the page's files are known); when the tool reports an incomplete set (timeout, output cap), every count reads as a lower bound (12+ files), and a search cut short before any row shows the tool's notice instead of an exact-looking empty result. The raw output appears afterCtrl+O. The Grep chip readsN files,N matches across K files, or the summed count according tooutput_mode, and the tools' pagination and empty-result notices no longer count as results.…when more follows. Outcome rows drop terminal colour sequences, so a colour left open past the width cut cannot bleed into the row's ellipsis or tail. An oversized result arrives as agent-core's truncation envelope; cards render its first line ("Tool output exceeded … saved to a file") as the outcome row and carry no chip, instead of counting the envelope's metadata as results.Ctrl+O; a group created while the global expand toggle is on starts expanded, and its· N failedcount is a fixed header tail that survives a narrow row.Replaced N occurrences in …,Wrote N bytes to …) no longer render in either state since the header and preview already say it; any other successful output shows as an outcome row in both states.Width-aware headers.
TruncatedHeaderLinerenders a header as head / flexible / tail segments: the flexible part (a command, a path) is cut with an ellipsis to whatever width remains after the fixed parts, keeping the head of a command and the tail of a path, so a long command fills a wide terminal and the chip survives on a narrow one; when the row is too narrow even for the fixed parts, the middle is dropped first and the head is cut before the chip. The rendered array is cached while content and width are unchanged, so an unchanged header costs nothing per frame.Footer
ctrl+ohint. While the recent turns hold tool output thatCtrl+Owould reveal, the footer's first line shows a fixedctrl+o expandhint (it wins over the rotating tip when space runs out); once expanded it readsctrl+o collapse, and it disappears when there is nothing to toggle. Width-dependent hiding counts too: an outcome row cut to the terminal width, or an error preview whose long line wraps past its row cap, keeps the hint on. A capped Edit or Write preview counts even when the call failed, and a user-run!command card reports its running tail or capped result the same way. The hint lives in the footer because it knows the expand toggle and the turn window, so it is never shown for cardsCtrl+Ocan no longer reach. When astatus_line.commandowns line 1, the hint moves to the left of line 2 (transient and warning hints still take precedence there).Docs and changesets. One
patchchangeset; no doc update needed,Ctrl+Obehaves as documented.Tests. Renderer tests for the outcome rows per tool family, the Grep output parsing per mode, the Bash chip, the Read group, and the header segments (wide and narrow, path tail, cache identity); card tests for the collapsed and live states and for
hasHiddenContent; footer tests for the hint; an end-to-end test drives a Bash result through the event handler and watches the footer offerctrl+o expandthenctrl+o collapse; the activity viewer test follows the collapsed rule. The CLI app suite, typecheck and lint pass.The
NotifyUserupdate panel (#3524) is stacked on this branch.Checklist
/approve). Internal change, no issue.gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.