Skip to content

gh pr checks --watch reports duplicated pass/fail counts when checks already finished #3541

Closed

Description

@activekezio

Summary

rtk gh pr checks <PR> --watch reports check counts inflated by a multiple of the real total (e.g. 18 reported instead of 9) when the PR's checks have already finished by the time --watch starts polling.

Root cause

gh pr checks --watch, when stdout is not a TTY (piped/captured — the normal case for an agent-driven shell), does not clear the screen between polls. It just appends the full checks table again on every polling cycle until it detects the run is complete. If the checks are already resolved, gh still does at least one extra poll cycle before exiting, so the raw output contains the same 9-row table printed 2+ times.

rtk's filtered summary for --watch appears to count pass/fail occurrences across the entire captured output stream instead of deduplicating by check name / using only the final snapshot, so N poll cycles × real check count gets reported as the total.

Reproduction

# Raw gh output — same table printed twice within one --watch invocation
gh pr checks 9776 --watch
# (9-row table, then the same 9-row table again ~10s later, 18 lines of "pass" total)

# rtk filtered mode, same PR
rtk gh pr checks 9776 --watch
# CI Checks Summary:
#   [ok] Passed: 18      <- real total is 9
#   [FAIL] Failed: 0

# Without --watch, rtk is correct on the same PR:
rtk gh pr checks 9776
# CI Checks Summary:
#   [ok] Passed: 9
#   [FAIL] Failed: 0

Environment

  • rtk 0.45.0 (also reproduced on 0.37.2 before upgrading — not fixed by the upgrade)
  • gh version: 2.97.0 (2026-07-31)
  • macOS, invoked via Claude Code's Bash tool (non-TTY stdout)

Impact

An agent relying on rtk gh pr checks --watch's summary to decide whether CI passed gets a plausible-looking but wrong number. In this case it wasn't misleading (18/18 still reads as "all passed, 0 failed"), but the count itself is fabricated and would misrepresent partial-failure states too if, say, 1 of 9 real checks failed but got counted twice as failed among 18 — the ratio would still look coherent but wouldn't match GitHub's actual check count.

Suggested fix

For --watch, either:

  • parse only the last complete table snapshot in the captured output before summarizing, or
  • deduplicate by check name (keep the most recent status per name) before counting.

Activity

  1. pszymkowiak commented on Aug 11, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 88%

    Summary

    rtk's --watch summary for gh pr checks sums pass/fail across all polling cycles instead of deduplicating by check name, inflating counts (and could mask real partial failures); fix by parsing only the final snapshot or deduping per check name.

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

    📁 Relevant files
    • src/commands/gh/pr_checks.rs

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

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:clibugpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions