Skip to content

rtk gh issue view --comments silently drops comments, misleading AI agents #720

Closed

Description

@cderv

rtk gh issue view --comments and rtk gh pr view --comments silently discard all comments. The output shows only the issue/PR body with no comments section, which causes Claude Code to conclude "no comments" — a false claim when comments exist.

This is worse than truncation (#354, #188) because the data is never fetched at all.

Reproduction

On any issue with comments:

# Raw gh — shows 2 comments
gh issue view 187 --repo Dicklesworthstone/beads_rust --comments

# Through rtk — no comments visible
rtk gh issue view 187 --repo Dicklesworthstone/beads_rust --comments

Claude Code with the rtk hook sees the second output and reports:

No comments at all — the maintainer never responded.

The issue actually has 2 comments including a maintainer reply.

Cause

view_issue hardcodes --json number,title,state,author,body,url — comments is not in the field list:

rtk/src/gh_cmd.rs

Lines 688 to 689 in 4792008

"--json",
"number,title,state,author,body,url",

The --comments flag is appended as an extra arg, but in --json mode gh ignores it and only returns the listed fields. The formatting code then only processes those 6 fields, so comments are structurally absent from the output.

view_pr has the same issue — its JSON fields don't include comments either.

For PR view, should_passthrough_pr_view triggers passthrough on --json, --jq, and --web, but not --comments:

rtk/src/gh_cmd.rs

Lines 286 to 289 in 4792008

fn should_passthrough_pr_view(extra_args: &[String]) -> bool {
extra_args
.iter()
.any(|a| a == "--json" || a == "--jq" || a == "--web")

view_issue has no passthrough check at all.

Impact

With the rtk hook active, Claude Code has no way to know it's running through rtk. It trusts the output and makes false conclusions about issues having no responses. This is particularly harmful when triaging issues or following up on bug reports — the agent acts on incorrect information.

Suggestion

The simplest fix would be to treat --comments as a passthrough trigger (like --json/--jq/--web), for both issue view and pr view. When a user explicitly asks for comments, correctness matters more than token savings.

Related

Environment

  • rtk 0.30.1 (master, commit 48e53cb)
  • gh 2.74.1
  • Claude Code
  • Windows 11

Activity

  1. cderv commented on Mar 20, 2026

    @cderv
    Author

    For now, we've worked around this by excluding gh from the rtk hook entirely via config.toml:

    [hooks]
    exclude_commands = ["gh"]

    This ensures gh runs unproxied, so --comments works correctly. Still worth fixing the filter — both for users who don't configure exclusions, and so we can re-enable rtk's token optimization on gh commands that do work well.

  2. added
    bug
    effort-small
    filter-quality
    good first issue
    on Mar 20, 2026
  3. pszymkowiak commented on Mar 20, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 95%

    Summary

    rtk gh issue/pr view --comments silently drops all comments because the JSON field list omits 'comments' and --comments isn't a passthrough trigger; fix by adding --comments to passthrough checks for both issue and PR view.

    💡 This looks like a simple fix that could be auto-resolved. Use /wshm fix to attempt it.

    📁 Relevant files
    • src/gh_cmd.rs

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

  4. added a commit that references this issue on Mar 21, 2026
    fdeb09f
  5. mvanhorn commented on Mar 21, 2026

    @mvanhorn
    Contributor

    Implemented in #775 - added --comments to passthrough triggers in both view_pr and view_issue, so gh returns full comment data instead of silently dropping it.

  6. aeppling commented on Mar 21, 2026

    @aeppling
    Contributor

    Hello, #775 has been merged and will be available in next release.
    Next release should come by the end of the weekend or on Monday.

    Closing this issue, thanks for this clean report

  7. added a commit that references this issue on Mar 29, 2026
    69839ce
  8. added a commit that references this issue on Apr 10, 2026
    81b9329
  9. added 2 commits that reference this issue on May 14, 2026
    345333a
    c0db70e
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

    bugeffort-smallfilter-qualitygood first issuepriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions