Skip to content

fix(web): compact terminal tool cards by default#601

Merged
tiann merged 4 commits into
tiann:mainfrom
junxin367:fix/web-terminal-tool-card-display
May 9, 2026
Merged

fix(web): compact terminal tool cards by default#601
tiann merged 4 commits into
tiann:mainfrom
junxin367:fix/web-terminal-tool-card-display

Conversation

@junxin367
Copy link
Copy Markdown
Contributor

@junxin367 junxin367 commented May 8, 2026

Summary

  • restore compact terminal-related tool cards by default
  • add a chat setting to switch terminal tool cards between compact and detailed modes
  • keep the current inline output preview behavior behind detailed mode only

Reason

The mobile regression comes from #544 (e76738aa, fix(codex): improve web rendering for Codex events), which changed CodexBash cards from always-minimal to showing inline stdout / stderr whenever output exists. That makes terminal-related cards much taller on narrow screens.

This PR keeps the useful detailed preview, but moves it behind an explicit setting and restores the compact default.

Scope

  • web chat tool cards only
  • terminal-related cards only: Bash, CodexBash, shell_command
  • dialog details are unchanged

Test

  • bun run test -- src/hooks/useTerminalToolDisplayMode.test.ts src/components/ToolCard/ToolCard.test.ts src/routes/settings/index.test.tsx
  • bun run typecheck

Risk / Rollback

  • Risk: low; behavior is isolated to client-side card presentation and a new localStorage-backed setting
  • Rollback: revert this PR to restore the current always-detailed inline preview

Release Request

This issue is especially visible on mobile screens and directly hurts chat readability in active versions. If review passes, please publish a patch release as soon as practical so users can get the compact default back quickly.

Screenshot

Current mobile issue before this fix:

Current mobile issue before fix

Reviewer Notes

- restore compact terminal-related tool cards by default\n- add a chat setting to switch between compact and detailed display\n- keep detailed mode for the current inline output preview
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Major] Detailed mode still cannot show Bash/shell_command output previews — shouldShowInlineToolCardBody still requires !presentationMinimal, but knownTools marks Bash and shell_command as minimal: true, so choosing “Detailed (show output preview)” only affects non-minimal CodexBash results and leaves Claude/Gemini terminal cards compact. Evidence: web/src/components/ToolCard/ToolCard.tsx:40, with Bash/shell_command included in the new terminal set. Suggested fix:
    export function shouldShowInlineToolCardBody(
        toolName: string,
        presentationMinimal: boolean,
        terminalToolDisplayMode: TerminalToolDisplayMode
    ): boolean {
        if (isSubagentToolName(toolName)) return false
        if (TERMINAL_RELATED_TOOL_NAMES.has(toolName)) {
            return terminalToolDisplayMode === 'detailed'
        }
        return !presentationMinimal
    }

Summary

  • Review mode: initial
  • One behavior regression found: the new setting advertises detailed terminal previews, but the helper keeps two terminal tool types permanently minimal.

Testing

  • Not run: bun is not installed in this runner (/bin/bash: bun: command not found).

HAPI Bot

presentationMinimal: boolean,
terminalToolDisplayMode: TerminalToolDisplayMode
): boolean {
return !presentationMinimal
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MAJOR] Detailed mode still cannot show Bash/shell_command output previews. This helper still requires !presentationMinimal, but knownTools marks Bash and shell_command as minimal: true, while this PR adds both names to the terminal-related set. As a result, selecting “Detailed (show output preview)” only restores inline output for non-minimal CodexBash results and leaves Claude/Gemini terminal cards compact.

Suggested fix:

export function shouldShowInlineToolCardBody(
    toolName: string,
    presentationMinimal: boolean,
    terminalToolDisplayMode: TerminalToolDisplayMode
): boolean {
    if (isSubagentToolName(toolName)) return false
    if (TERMINAL_RELATED_TOOL_NAMES.has(toolName)) {
        return terminalToolDisplayMode === 'detailed'
    }
    return !presentationMinimal
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Detailed mode now bypasses the minimal gate for terminal-related cards, so Bash and shell_command restore inline output previews too instead of only CodexBash.

Added helper coverage for:

  • Bash detailed mode
  • shell_command detailed mode
  • non-terminal minimal cards still staying compact

Re-ran:

  • bun run test -- src/hooks/useTerminalToolDisplayMode.test.ts src/components/ToolCard/ToolCard.test.ts src/routes/settings/index.test.tsx
  • bun run typecheck

- let detailed mode bypass minimal rendering for terminal-related cards\n- cover Bash and shell_command helper behavior in tests
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings
No findings.

Summary
Review mode: follow-up after new commits
No issues found in the latest full diff. The prior bot finding about detailed Bash / shell_command previews is addressed in this head. Residual risk: local validation could not run because bun is unavailable in this runner.

Testing
Not run (automation): bun is not installed in this runner (/bin/bash: bun: command not found).

HAPI Bot

- add current mobile screenshot for terminal tool card overflow\n- reference it from the PR description for reviewer context
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Major] run_shell_command remains outside the compact terminal-tool set, so the new compact default and detailed toggle do not apply to Gemini ACP shell cards. The repo already treats run_shell_command as a shell tool with a command subtitle in web/src/components/ToolCard/knownTools.test.tsx:49, but TERMINAL_RELATED_TOOL_NAMES only includes Bash, CodexBash, and shell_command at web/src/components/ToolCard/ToolCard.tsx:29.
    Suggested fix:
    const TERMINAL_RELATED_TOOL_NAMES = new Set(['Bash', 'CodexBash', 'shell_command', 'run_shell_command'])

Summary
Review mode: follow-up after new commits
One issue remains in the full current diff: compact/detailed terminal-card behavior misses the Gemini shell tool path. No other high-confidence regressions found.

Testing
Not run (review-only automation).

HAPI Bot

import { isSubagentToolName } from '@/chat/subagentTool'

const ELAPSED_INTERVAL_MS = 1000
const TERMINAL_RELATED_TOOL_NAMES = new Set(['Bash', 'CodexBash', 'shell_command'])
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Major] run_shell_command is already exercised as a shell-like tool in the web tests (knownTools.test.tsx expects it to surface a command subtitle), but it is not included here. That means Gemini ACP shell cards keep bypassing the new compact/detailed terminal-card setting, leaving a real terminal path with the old behavior.

Suggested fix:

const TERMINAL_RELATED_TOOL_NAMES = new Set(['Bash', 'CodexBash', 'shell_command', 'run_shell_command'])

Add a matching regression expectation too:

expect(shouldUseCompactTerminalToolCard('run_shell_command', 'compact')).toBe(true)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. run_shell_command is now treated as a terminal-related card too, so the compact default and detailed toggle cover the Gemini shell path instead of only Bash / CodexBash / shell_command.

Added regression coverage for:

  • shouldUseCompactTerminalToolCard('run_shell_command', 'compact')
  • shouldShowInlineToolCardBody('run_shell_command', true, 'detailed')

Re-ran:

  • bun run test -- src/components/ToolCard/ToolCard.test.ts src/routes/settings/index.test.tsx src/hooks/useTerminalToolDisplayMode.test.ts
  • bun run typecheck

- add run_shell_command to terminal-related tool cards\n- cover compact and detailed helper behavior for that path
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • No high-confidence findings.

Summary
Review mode: follow-up after new commits
No issues found in the current full diff. The previous bot finding about run_shell_command is addressed in the current head; residual risk is limited to UI behavior that was not exercised here because this review did not run the untrusted PR code.

Testing
Not run (review-only automation).

HAPI Bot

@tiann tiann merged commit 3a6574f into tiann:main May 9, 2026
3 checks passed
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.

2 participants