Skip to content

gh pr diff silently truncates multi-file PRs (max_lines=100) #8

@PLNech

Description

@PLNech

Summary

rtk gh pr diff calls compact_diff(&raw, 100) which silently drops output after 100 compacted lines. For multi-file PRs (3+ files with non-trivial changes), this truncates the diff without any signal to the caller — no exit code change, no stderr warning.

Impact

  • Agents doing PR review receive incomplete diffs and miss findings in later files
  • Silent truncation: agent has no signal to retry or fallback
  • Workaround: gh pr view --json files,additions,deletions,body works but requires knowing about the limitation

Root cause

src/gh_cmd.rs:1070compact_diff(&raw, 100) hard-caps at 100 lines total output. This was likely inherited from the local git diff path where 100 lines is reasonable. PR diffs are structurally larger.

Fix

Raised max_lines from 100 to 500 in pr_diff(). Regression test added with synthetic 5-file PR diff asserting all files appear in output.

Fixed in commit 859143c on feature/agentic-fuzzing branch.

Upstream candidate

This is likely an upstream bug too (default value error, not a design choice). The compact_diff function's max_lines parameter was designed to be configurable per-caller, but pr_diff just used the same low default as local diffs. Could be a straightforward cherry-pick to rtk-ai/rtk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions