Skip to content

fix(pr-status-sync): gh api --jq doesn't support jq's --arg flag#1

Open
octavianorg wants to merge 1 commit into
mainfrom
fix/pr_status_sync_fix
Open

fix(pr-status-sync): gh api --jq doesn't support jq's --arg flag#1
octavianorg wants to merge 1 commit into
mainfrom
fix/pr_status_sync_fix

Conversation

@octavianorg

@octavianorg octavianorg commented Jul 9, 2026

Copy link
Copy Markdown

Summary

  • Every PR opened/reopened event triggered a failure in the sync / open-pr job of pr-status-sync.yml with accepts 1 arg(s), received 4
  • Root cause: gh api ... --jq --arg l "$BASE_LABEL" '...'gh api --jq only accepts a single filter string; it has no --arg support like the standalone jq binary. The shell consumed --arg as the filter itself, leaving l, $BASE_LABEL, and the real filter as three stray positional args to gh api, which only accepts one (the endpoint)
  • Fixed by fetching labels via gh api --jq '[.[].name]' and piping into a real jq -r --arg call — the same pattern already used correctly elsewhere in this file (the closed-PR path)

Test plan

  • Reproduced the exact failure locally against a real PR with the old code
  • Verified the fixed command runs cleanly against the same PR with no error
  • Confirmed no other gh api --jq --arg occurrences exist elsewhere in this file/repo

Summary by CodeRabbit

  • Bug Fixes
    • Improved PR status label cleanup to more reliably remove outdated base labels during pull request updates.
    • Reduced the chance of stale PR status information persisting after base changes.

The open-pr job's stale base-label cleanup passed --jq --arg l "$BASE_LABEL"
'...' directly to `gh api`, but `gh api --jq` only accepts a single filter
string — it has no --arg support. The shell parsed "--arg" as the filter
itself and left "l", "$BASE_LABEL", and the real filter as three stray
positional args, which `gh api` rejects with "accepts 1 arg(s), received 4".
This fired on every PR opened/reopened event.

Fixed by fetching labels via `gh api --jq` (no vars needed there) and piping
through a real `jq --arg` call, matching the pattern already used elsewhere
in this file for the closed-PR path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 735f03a4-82a6-42c2-82db-5fd4f52c0d1f

📥 Commits

Reviewing files that changed from the base of the PR and between 5989967 and 39a53d6.

📒 Files selected for processing (1)
  • .github/workflows/pr-status-sync.yml

📝 Walkthrough

Walkthrough

The PR status synchronization workflow now computes stale base labels with a two-stage jq pipeline: extracting label names first, then filtering them against BASE_LABEL.

Changes

PR status synchronization

Layer / File(s) Summary
Stale base label query
.github/workflows/pr-status-sync.yml
STALE_BASE is computed by extracting label names with gh api --jq, then filtering them with jq against BASE_LABEL.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main fix: replacing an unsupported gh api --jq --arg usage in pr-status-sync.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pr_status_sync_fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant