Skip to content

fix(cli): make SkillInboxDialog fit and scroll in alternate buffer#26455

Merged
SandyTao520 merged 2 commits intomainfrom
st/fix/skill-inbox-dialog-overflow
May 4, 2026
Merged

fix(cli): make SkillInboxDialog fit and scroll in alternate buffer#26455
SandyTao520 merged 2 commits intomainfrom
st/fix/skill-inbox-dialog-overflow

Conversation

@SandyTao520
Copy link
Copy Markdown
Contributor

@SandyTao520 SandyTao520 commented May 4, 2026

Summary

/memory inbox overflowed the alternate screen buffer in two ways: the
diff preview rendered every line at full natural height with no
scrollback to recover them, and the list phase used a hard-coded
maxItemsToShow=8 with rows that wrapped to 3-5 lines for long
descriptions, pushing the dialog footer off the bottom of the screen.

Details

demo.webm
  • Scrollable diff viewport — the skill-preview and patch-preview
    phases now wrap the diff in a fixed-height ScrollableList of diff
    lines. PgUp/PgDn, Shift+arrows, and Ctrl/Shift+Home/End
    move the viewport over arbitrarily long diffs. The
    DialogFooter's existing navigationActions slot surfaces the
    affordance to the user.

  • Predictable list-row height — every list row (skill, patch) now
    renders at exactly height={2} with wrap="truncate-end". Previously
    long descriptions used wrap="wrap" and were rendered as siblings
    of the date in a flexDirection="row" box, causing each item to
    occupy 3-5 rows and visibly interleaving the date into the
    description's word wrap (e.g. · May 4,\nmode2026).

  • Terminal-aware list windowingmaxItemsToShow is now derived
    from terminalHeight minus a documented chrome budget (border,
    padding, title/subtitle, footer, scroll arrows, DefaultAppLayout's
    alt-buffer paddingBottom). The dialog footer remains visible on
    shorter terminals.

The scrollable diff viewport follows the same ScrollableList
primitive used by MainContent and DetailedMessagesDisplay. The
list-row truncation pattern matches the height-budgeting approach
established in FooterConfigDialog and RewindViewer.

Related Issues

Related to #18007

How to Validate

  1. Run npm run start in alternate buffer mode (the default).
  2. Run /memory inbox with a populated skill inbox containing at least
    one skill with a long description.
  3. List phase: confirm the dialog footer (Esc to close) is
    visible and that no list row wraps onto a third line.
  4. Select a skill or patch with a tall SKILL.md or multi-file diff.
  5. Preview phase: confirm only the top of the diff is visible, the
    Apply/Dismiss (or destination) action list is below it, and the
    footer shows Enter to confirm · PgUp/PgDn to scroll · Esc to go back.
  6. Press PgDn (or Shift+Down) — the diff scrolls; the action list
    and footer stay in place.
  7. Repeat in normal-buffer mode (useAlternateBuffer: false in
    settings) to verify nothing regressed.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@SandyTao520 SandyTao520 requested a review from a team as a code owner May 4, 2026 18:01
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses UI overflow issues in the /memory inbox dialog when running in the alternate screen buffer. By implementing a scrollable viewport for diffs and enforcing strict height constraints on list items, the changes ensure that the dialog footer and action lists remain accessible even on smaller terminals or with long content.

Highlights

  • Scrollable Diff Viewport: Introduced a fixed-height ScrollableDiffViewport component that allows users to scroll through long diffs using PgUp/PgDn, preventing the dialog from overflowing the alternate buffer.
  • Predictable List Layout: Standardized list row heights to exactly two lines with truncation, ensuring the dialog footer remains visible regardless of description length.
  • Dynamic List Budgeting: Implemented terminal-aware calculation for maxItemsToShow, ensuring the dialog adapts its content density based on the available terminal height.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli Bot commented May 4, 2026

Hi @SandyTao520, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a ScrollableDiffViewport to the SkillInboxDialog to handle large diffs and implements dynamic height calculations to prevent terminal buffer overflows. It also adds row truncation for long descriptions and navigation affordances for scrolling. Feedback identifies a security vulnerability in how origin tags are determined from file paths and a performance issue where diff sections are not memoized, leading to expensive re-renders.

Comment thread packages/cli/src/ui/components/SkillInboxDialog.tsx Outdated
Comment thread packages/cli/src/ui/components/InboxDialog.tsx
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Size Change: +6.67 kB (+0.02%)

Total Size: 34 MB

Filename Size Change
./bundle/chunk-3TA7ABEG.js 0 B -12.5 kB (removed) 🏆
./bundle/chunk-C52H6PVG.js 0 B -3.8 kB (removed) 🏆
./bundle/chunk-FKWCCDSN.js 0 B -658 kB (removed) 🏆
./bundle/chunk-KJRUYIXW.js 0 B -3.43 kB (removed) 🏆
./bundle/chunk-MTBOT65F.js 0 B -19.5 kB (removed) 🏆
./bundle/chunk-NFZSHKTJ.js 0 B -14.7 MB (removed) 🏆
./bundle/chunk-SNCJHJLP.js 0 B -2.73 MB (removed) 🏆
./bundle/chunk-XE56NE4Z.js 0 B -49.2 kB (removed) 🏆
./bundle/core-R5EFF3ZC.js 0 B -48.7 kB (removed) 🏆
./bundle/devtoolsService-KEO2PHDP.js 0 B -28 kB (removed) 🏆
./bundle/gemini-2DBVF4FF.js 0 B -583 kB (removed) 🏆
./bundle/interactiveCli-2S76OQSV.js 0 B -1.33 MB (removed) 🏆
./bundle/liteRtServerManager-KJ63D5GD.js 0 B -2.11 kB (removed) 🏆
./bundle/oauth2-provider-P5P7JD2W.js 0 B -9.16 kB (removed) 🏆
./bundle/chunk-3BXHWU5J.js 3.8 kB +3.8 kB (new file) 🆕
./bundle/chunk-5UNA4FQS.js 658 kB +658 kB (new file) 🆕
./bundle/chunk-C6N6TARN.js 49.2 kB +49.2 kB (new file) 🆕
./bundle/chunk-FUALXELW.js 3.43 kB +3.43 kB (new file) 🆕
./bundle/chunk-GUBHD5TJ.js 2.78 MB +2.78 MB (new file) 🆕
./bundle/chunk-XLKEI2LK.js 19.5 kB +19.5 kB (new file) 🆕
./bundle/chunk-YP4XSYTU.js 14.7 MB +14.7 MB (new file) 🆕
./bundle/chunk-YWXD7UO7.js 12.5 kB +12.5 kB (new file) 🆕
./bundle/core-LCX4ULXF.js 48.7 kB +48.7 kB (new file) 🆕
./bundle/devtoolsService-4OSAGSUD.js 28 kB +28 kB (new file) 🆕
./bundle/gemini-DBPILEAI.js 583 kB +583 kB (new file) 🆕
./bundle/interactiveCli-2XHLSLYX.js 1.29 MB +1.29 MB (new file) 🆕
./bundle/liteRtServerManager-M3KIDOIK.js 2.11 kB +2.11 kB (new file) 🆕
./bundle/oauth2-provider-EZMGDUJU.js 9.16 kB +9.16 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./bundle/bundled/third_party/index.js 8 MB 0 B
./bundle/chunk-34MYV7JD.js 2.45 kB 0 B
./bundle/chunk-5AUYMPVF.js 858 B 0 B
./bundle/chunk-5PS3AYFU.js 1.18 kB 0 B
./bundle/chunk-664ZODQF.js 124 kB 0 B
./bundle/chunk-DAHVX5MI.js 206 kB 0 B
./bundle/chunk-ECNYAST2.js 1.97 MB 0 B
./bundle/chunk-IUUIT4SU.js 56.5 kB 0 B
./bundle/chunk-RJTRUG2J.js 39.8 kB 0 B
./bundle/cleanup-C6P67AGK.js 0 B -932 B (removed) 🏆
./bundle/devtools-36NN55EP.js 696 kB 0 B
./bundle/dist-T73EYRDX.js 356 B 0 B
./bundle/events-XB7DADIJ.js 418 B 0 B
./bundle/examples/hooks/scripts/on-start.js 188 B 0 B
./bundle/examples/mcp-server/example.js 1.43 kB 0 B
./bundle/gemini.js 5.1 kB 0 B
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB 0 B
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB 0 B
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB 0 B
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB 0 B
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB 0 B
./bundle/memoryDiscovery-FB7MMKTA.js 980 B 0 B
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 222 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 229 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 13.4 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B
./bundle/src-QVCVGIUX.js 47 kB 0 B
./bundle/start-7ZVKCGLR.js 0 B -652 B (removed) 🏆
./bundle/tree-sitter-7U6MW5PS.js 274 kB 0 B
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB 0 B
./bundle/cleanup-WVIEN5K2.js 932 B +932 B (new file) 🆕
./bundle/start-UUFLRCVY.js 652 B +652 B (new file) 🆕

compressed-size-action

@gemini-cli gemini-cli Bot added the area/unknown Triage automation assigns this label to issues that it is unable to classify label May 4, 2026
The /memory inbox dialog overflowed the alternate screen buffer in
two ways: the diff preview rendered every line at full natural
height with no scrollback to recover them, and the list phase used
a hard-coded maxItemsToShow=8 with rows that wrapped to 3-5 lines
for long descriptions, pushing the dialog footer off the bottom of
the screen.

Diff rendering branches on `useAlternateBuffer`:

- Alt-buffer (no terminal scrollback): the skill-preview,
  patch-preview, and memory-preview phases wrap the diff in a
  fixed-height ScrollableList of diff lines.
  PgUp/PgDn/Shift+arrows move the viewport over arbitrarily long
  diffs. The DialogFooter advertises "PgUp/PgDn to scroll".

- Non-alt-buffer: the codebase's standard bounded DiffRenderer +
  ShowMoreLines + Ctrl+O pattern (matches FolderTrustDialog and
  ThemeDialog). Clipped content lands in terminal scrollback when
  the user expands via Ctrl+O. The Ctrl+O hint is surfaced inline
  by ShowMoreLines above the footer.

The dialog is wrapped in OverflowProvider so ShowMoreLines can
detect MaxSizedBox overflow inside DiffRenderer.

List rows now render at exactly height={2} with wrap="truncate-end"
so long descriptions no longer wrap unpredictably. This also fixes
a visible artifact where the date sibling broke the description's
word wrap. maxItemsToShow is derived from terminalHeight using a
documented chrome budget so the dialog footer stays visible on
shorter terminals.
Address PR #26455 review feedback. Each ScrollableDiffViewport call
site previously built its sections array as a fresh literal on every
render of InboxDialog. ScrollableDiffViewport memoizes its expensive
parseDiffWithLineNumbers + renderDiffLines work on `sections`, so
the literals defeated the memo and re-colorized the diff on every
parent re-render (e.g. each feedback toggle).

Hoist the per-phase preview data (skill, patch, memory) into a
single useMemo keyed on `selectedItem`. The memo also subsumes the
memory-patch grouping logic so both the alt-buffer and non-alt-buffer
memory-preview branches read the same stable references. The hook
lives above the dialog's loading / empty-state early returns to
satisfy React's rules-of-hooks.
@SandyTao520 SandyTao520 force-pushed the st/fix/skill-inbox-dialog-overflow branch from 9baf3d8 to b1e9dc4 Compare May 4, 2026 20:29
Copy link
Copy Markdown
Contributor

@Samee24 Samee24 left a comment

Choose a reason for hiding this comment

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

LGTM

@SandyTao520 SandyTao520 added this pull request to the merge queue May 4, 2026
Merged via the queue into main with commit 56809d7 May 4, 2026
28 checks passed
@SandyTao520 SandyTao520 deleted the st/fix/skill-inbox-dialog-overflow branch May 4, 2026 22:08
kimjune01 pushed a commit to kimjune01/gemini-cli-claude that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/unknown Triage automation assigns this label to issues that it is unable to classify

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants