Skip to content

patrol-launch-ci-fix.sh: 'gh pr checks --json' missing fields list + hardcoded mono repo #179

Open

Description

@doink-kindo

Patrol cycle hit two real CI failures and patrol-launch-ci-fix.sh failed early with:

ERROR: Failed to fetch checks for PR #<n> (empty or invalid JSON)

The script calls:

gh pr checks "${PR_NUMBER}" -R <private-monorepo> --json > "/tmp/pr_${PR_NUMBER}_checks.json"

gh pr checks --json requires a comma-separated field list (e.g. --json name,bucket,state,link). With no fields, gh emits help text on stderr and an empty stdout, so the subsequent jq empty validation fails.

Additional issues in the same script:

  1. The repo is hardcoded inside the script (private monorepo path stripped). The patrol SOP explicitly says to pass --repo so the script can also handle the second mono-adjacent repo we own. The script does not accept a --repo flag.
  2. gh api '/repos/.../actions/runs?...' --paginate returns a stream of JSON objects (one per page), which is not a single JSON document. jq empty happens to accept it, but downstream consumers that expect a single object/array will break once a PR exceeds one page.

Suggested fix:

  • Pass an explicit --json field list (e.g. --json name,bucket,state,link,workflow,description).
  • Add --repo arg, default to the original repo if omitted, forward to both gh pr and gh api calls.
  • Either drop --paginate or pipe through --jq '[inputs.workflow_runs[]]' style aggregation so the saved file is a single JSON array.

Patrol manually launched the CI fix agents this cycle as a workaround.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions