fix: gh run view drops --log-failed, --log, --json flags#159
Merged
pszymkowiak merged 1 commit intortk-ai:masterfrom Feb 17, 2026
Merged
fix: gh run view drops --log-failed, --log, --json flags#159pszymkowiak merged 1 commit intortk-ai:masterfrom
pszymkowiak merged 1 commit intortk-ai:masterfrom
Conversation
view_run() only passed the run ID to `gh run view`, silently dropping all subsequent args. This made it impossible to inspect CI failure logs when the rtk-rewrite hook was active. Add should_passthrough_run_view() to detect flags that produce output incompatible with the summary filter, and pass through to gh directly when found. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shadowofdoom
added a commit
to shadowofdoom/rtk
that referenced
this pull request
Feb 18, 2026
view_pr() assumed args[0] was always a PR number, so `gh pr view --json fields` treated "--json" as the PR identifier and appended its own --json, causing `Unknown JSON field: "--json"`. The v0.21.1 fix (should_passthrough_run_view) only covered `gh run view`. This generalizes it with has_output_format_flags() and applies it to all handlers that hardcode --json fields: list_prs, view_pr, pr_status, list_issues, view_issue, list_runs, and run_repo. Also fixes view_pr to handle omitted PR number (gh defaults to current branch). Closes rtk-ai#159 (broader fix) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 tasks
edsai
pushed a commit
to edsai/rtk
that referenced
this pull request
Feb 19, 2026
view_pr() assumed args[0] was always a PR number, so `gh pr view --json fields` treated "--json" as the PR identifier and appended its own --json, causing `Unknown JSON field: "--json"`. The v0.21.1 fix (should_passthrough_run_view) only covered `gh run view`. This generalizes it with has_output_format_flags() and applies it to all handlers that hardcode --json fields: list_prs, view_pr, pr_status, list_issues, view_issue, list_runs, and run_repo. Also fixes view_pr to handle omitted PR number (gh defaults to current branch). Closes rtk-ai#159 (broader fix) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 tasks
edsai
pushed a commit
to edsai/rtk
that referenced
this pull request
Feb 19, 2026
view_pr() assumed args[0] was always a PR number, so `gh pr view --json fields` treated "--json" as the PR identifier and appended its own --json, causing `Unknown JSON field: "--json"`. The v0.21.1 fix (should_passthrough_run_view) only covered `gh run view`. This generalizes it with has_output_format_flags() and applies it to all handlers that hardcode --json fields: list_prs, view_pr, pr_status, list_issues, view_issue, list_runs, and run_repo. Also fixes view_pr to handle omitted PR number (gh defaults to current branch). Closes rtk-ai#159 (broader fix) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
edsai
pushed a commit
to edsai/rtk
that referenced
this pull request
Feb 19, 2026
view_pr() assumed args[0] was always a PR number, so `gh pr view --json fields` treated "--json" as the PR identifier and appended its own --json, causing `Unknown JSON field: "--json"`. The v0.21.1 fix (should_passthrough_run_view) only covered `gh run view`. This generalizes it with has_output_format_flags() and applies it to all handlers that hardcode --json fields: list_prs, view_pr, pr_status, list_issues, view_issue, list_runs, and run_repo. Also fixes view_pr to handle omitted PR number (gh defaults to current branch). Closes rtk-ai#159 (broader fix) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
heAdz0r
added a commit
to heAdz0r/rtk
that referenced
this pull request
Feb 28, 2026
Upstream 0.22.2 sync (all previously missing fixes verified applied): - fix(lint): propagate linter exit code (rtk-ai#207) — CI false-green fix - feat: add rtk wc command for compact word/line/byte counts (rtk-ai#175) - fix(playwright): JSON parser (specs layer) + binary resolution (rtk-ai#215) - fix(grep): propagate rg exit codes 1/2 (rtk-ai#227) - fix(git): branch creation not swallowed by list mode (rtk-ai#194) - fix(git): support multiple -m flags in git commit (rtk-ai#202) - fix(grep): BRE \| translation + strip -r flag (rtk-ai#206) - fix(gh): smart markdown body filter for issue/pr view (rtk-ai#214) - fix(gh): gh run view --log-failed flag passthrough (rtk-ai#159) - feat(docker): docker compose support (rtk-ai#110) - feat: hook audit mode (rtk-ai#151) - feat: tee raw output to file (rtk-ai#134) Version bump: 0.21.1-fork.19 → 0.22.2-fork.1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the
rtk-rewritehook is active (configured in~/.claude/settings.json), allgh runcommands are transparently rewritten fromgh run view <id> --log-failedtortk gh run view <id> --log-failed.The
view_run()function ingh_cmd.rsonly extractsargs[0]as the run ID and passes it togh run view— all subsequent arguments are silently dropped:This means:
gh run view <id> --log-failed→ returns only a summary header, not the actual failure logsgh run view <id> --log→ same, no logsgh run view <id> --json jobs→ no JSON output, just the filtered summaryUsers see output like this instead of actual logs:
The irony: rtk tells you to use
--log-failed, but rtk itself is the reason it doesn't work.Root cause
view_run()(line 695) treatsargsas if it only contains the run ID, ignoring everything after index 0. Unlikelist_runs()which does pass extra args through,view_run()was never wired to forward them.Fix
should_passthrough_run_view(extra_args)— detects when remaining args contain--log-failed,--log, or--json(flags that produce output incompatible with the summary filter)view_run()— when passthrough flags are detected, bypass the filter entirely and delegate to a newrun_passthrough_with_extra()helper that forwards all args toghdirectlyrun_passthrough_with_extra()— executes the command with base args + extra args, tracks as passthrough (0% savings, but preserves usage metrics)When no special flags are present,
view_run()continues to use the existing summary filter — no behavior change for the default case.Test plan
--log-failed→ passthrough--log→ passthrough--json <fields>→ passthrough--web→ no passthrough (use filter)gh_cmd::testspasscargo testsuite passesrtk gh run view <id> --log-failedshows actual failure logsrtk gh run view <id> --json jobsreturns JSON output🤖 Generated with Claude Code