Skip to content

passthrough_max_chars truncates output silently (no marker) — git log shows 50 of 252 commits, misleads scope #2204

Open

Description

@sangzn34

Describe the bug

[limits].passthrough_max_chars (default 2000) caps passthrough command output, but truncates silently — no ... N more lines marker, no hint that output was cut. A consumer (human or LLM agent) reads the truncated output as complete.

This caused a real correctness failure: git log <base>..HEAD on a 252-commit branch returned only ~50 lines. An automated agent read "50 commits", planned a history rewrite (squash/rebase) on that wrong scope, and had to redo work once the true count (git rev-list --count = 252) surfaced. wc -l on the piped output also reads 50, so even a line-count sanity check is fooled.

To reproduce

  1. On a branch with >50 commits ahead of base
  2. Run git log <base>..HEAD through the RTK hook (rewritten to rtk git log)
  3. Output stops at ~2000 chars (~50 lines) with no indication it was truncated
  4. git rev-list --count <base>..HEAD shows the true (larger) number

Expected

Truncation should be visible. Any one of:

  • Append a marker when output is cut, e.g. … [rtk: truncated, N of M lines shown — full: rtk run git log …]
  • Exempt history-listing commands (git log, git rev-list) from the char cap by default — these are exactly the cases where completeness matters
  • Make the cap a line count rather than a char count for git log, and document it

Environment

  • rtk 0.42.0 (Homebrew, macOS)
  • Config at ~/Library/Application Support/rtk/config.toml — note: the README/docs reference ~/.config/rtk/. On macOS the active path is the Application Support one; might be worth documenting the platform difference.

Workaround

Added "git log" to transparent_prefixes so it bypasses the cap. Works, but the silent-truncation behavior is the real issue — a visible marker would have surfaced it immediately instead of after a wrong-scope history rewrite.

Activity

  1. added
    bug
    good first issue
    on Jun 1, 2026
  2. pszymkowiak commented on Jun 1, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 91%

    Summary

    passthrough_max_chars silently truncates command output with no marker, causing consumers to read partial output as complete — fix by appending a visible truncation notice when the limit is hit

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. mikeangstadt commented on Jun 2, 2026

    @mikeangstadt

    Analysis of current state:

    Already fixed:

    • The parser fallback path (truncate_passthrough/ truncate_output in src/parser/mod.rs) already appends the [RTK:PASSTHROUGH] marker when output exceeds passthrough_max_chars.

    Still affected (using silent truncate() without marker):

    • src/cmds/go/golangci_cmd.rs:274 — fallback when golangci-lint JSON parsing fails
    • src/cmds/python/ruff_cmd.rs:104 — fallback when ruff JSON parsing fails

    Separate but related (own line-capping, no character-level truncation marker):

    • src/cmds/git/git.rs — run_log / filter_log_output limits commit count without emitting a restorable hint

    Happy to submit a follow-up PR to fix the golangci and ruff fallback paths to use truncate_passthrough instead, and to add a recovery hint to git log's cap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliarea:configbuggood first issuepriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions