Skip to content

fix(tools): preserve shell command headline details#2387

Open
Pluviobyte wants to merge 1 commit into
MoonshotAI:mainfrom
Pluviobyte:fix/shell-headline-command-display
Open

fix(tools): preserve shell command headline details#2387
Pluviobyte wants to merge 1 commit into
MoonshotAI:mainfrom
Pluviobyte:fix/shell-headline-command-display

Conversation

@Pluviobyte
Copy link
Copy Markdown

@Pluviobyte Pluviobyte commented May 28, 2026

Related Issue

Resolve #2142

Description

This addresses the CLI/UI part of #2142: long Used Shell (...) headlines currently go through the generic shorten_middle(..., width=50) path, so the terminal often shows commands like:

Used Shell (grep -n "class Decompress...press_submission.py -A 10)

That hides the exact path and arguments users need when debugging repeated, failed, or suspicious shell calls.

Fix

  • Keep Shell key arguments untruncated so the full command string is available in the headline.
  • Leave other tools on the existing generic 50-character shortening path, so long file paths in ReadFile, WriteFile, etc. remain compact.

Scope

This PR intentionally does not attempt to solve the agent-loop/hard-cap part of #2142. It only fixes the user-visible command truncation regression.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue.
  • I have added tests that prove my fix is effective.
  • I have updated CHANGELOG.md (manual Unreleased entry, following the existing one-line-per-bullet style; make gen-changelog not run because this is a focused bug fix).
  • make gen-docs not run — N/A: no user-facing docs/config change.

Test plan

  • UV_PYTHON=3.12 uv run ruff check src/kimi_cli/tools/__init__.py tests/tools/test_extract_key_argument.py → clean
  • UV_PYTHON=3.12 uv run ruff format --check src/kimi_cli/tools/__init__.py tests/tools/test_extract_key_argument.py → clean
  • UV_PYTHON=3.12 uv run pytest tests/tools/test_extract_key_argument.py -q11 passed

Proof of fix

New tests cover both sides:

  • test_shell_long_command_keeps_path_and_arguments asserts Shell headlines retain the full long command and contain no ....
  • test_readfile_long_path_still_shortens asserts non-Shell tools still use the existing truncation behavior.

Made with Cursor


Open in Devin Review

Shell tool headlines previously reused the generic key argument shortening,
so long commands hid important paths and flags behind a middle ellipsis.
Keep Shell command arguments intact while leaving other tool headlines on
the existing compact display.

Fixes MoonshotAI#2142

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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.

Agent loops on same shell command; output truncated

1 participant