Skip to content

fix(scripts): show gh's error when an upstream pin lookup fails - #14647

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/upstream-drift-pin-error
Nov 9, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/upstream-drift-pin-error

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #14209

Summary

The upstream-drift pin check threw away gh's error output. Because of that, filer runs 42575536672 and 42607319598 failed on cursor/plugins@ae5650fe without a cause in the log. That commit exists upstream, and the same report runs clean locally, so the failure was most likely an API error (rate limit or outage) that the log could not show.

Fix

  • scripts/check-upstream-drift.sh: the pin lookup captures gh's stderr and adds it to the error message it exits with. The exit code and the message prefix stay the same.

Verification

  • bash scripts/check-upstream-drift.test.sh: PASS=101 FAIL=0.
  • shellcheck scripts/check-upstream-drift.sh: clean.
  • scripts/check-upstream-drift.sh --report --page docs/upstream/cursor-pstack.md: clean, every row unchanged.
  • Left out: a forced failure against the live API. The fixture seam skips this lookup.

Related

N/A

Remaining

🤖 Generated with Claude Code

The pin check discarded gh's stderr, so the filer's three failures on
cursor/plugins@ae5650fe could not say whether the commit was missing or
the API call failed (rate limit, outage).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 9, 2026 13:52
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-09T13:52:47.741127Z
We couldn’t complete this review. Comment @codex review to try again.
4b240f0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 4b240f044bc1efc093916816b449eb367427ccea: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14647

No security issues found.

Scope: one file, scripts/check-upstream-drift.sh. I read its single hunk in full. The file is not on a trusted path and is not a trust control, a merge hold, a manifest or an instruction surface.

What changed: the pin lookup used to discard all of gh api's output (>/dev/null 2>&1). It now keeps stderr (2>&1 >/dev/null, so stdout, the SHA, is still dropped) and adds it to the die message. The exit code and the message prefix are unchanged.

What I checked:

  • Secret or token leaks: gh api writes API error text to stderr, such as an HTTP status, a message and the request URL. It does not print the auth token, so putting that text in the log exposes no credential.
  • Untrusted input: $o, $r and $pin come from the repository's own upstream record pages, not from pull request, issue or comment text. They were already part of the message before this change. The new $err text is GitHub's API response to a request this repository wrote, so it gives an outside party no new way to inject anything into the log or the shell. $err is only expanded inside a double-quoted string passed to die, so it is never evaluated.
  • Gates: the result still fails closed, because a failed lookup still stops the script through die.

Throughput-phase holds: none of the owner's named friction holds is touched.

Spend: none.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed 4b240f044bc1efc093916816b449eb367427ccea: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read the whole diff for the one changed file, scripts/check-upstream-drift.sh.

What changed. The upstream pin lookup at scripts/check-upstream-drift.sh#L369-L370 used to discard gh's output. It now captures gh's stderr and adds it to the die message.

What I checked:

  • Redirection order. 2>&1 >/dev/null inside $(...) is correct. Stderr goes into the capture and stdout is discarded, so the .sha output doesn't leak into err.
  • Exit status. A plain err="$(...)" assignment with no local returns the command's exit status. The || still fires only when gh fails, and die still exits 2.
  • Shell options. The script runs set -uo pipefail. err is only read on the failure branch, and the ${err:-no output} fallback covers the case where gh fails without printing anything.
  • Name collisions. The loop runs at top level, and no other code in the script uses an err variable, so nothing is overwritten.
  • Consumers. The message prefix is unchanged and the new text is only appended at the end. A repository search found no code that matches on this message.

Closing issue. The PR only says Refs: #14209 and closes no issue, so there are no acceptance criteria to check.

Tests. The fixture seam skips this live-API branch, so no test exercises the new message. The PR says this itself. The change only affects diagnostics, so I'm not counting it as a finding.

The PR body lists verification steps (tests with 101 passing, shellcheck, a report run). The author ran these and I did not.

No embedded instructions were found in the PR context or the prior-findings file. This is the lane's first review of this PR, so it was not limited to blocking findings.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 78f7fab Nov 9, 2026
77 checks passed
@kyle-sexton
kyle-sexton deleted the fix/upstream-drift-pin-error branch November 9, 2026 14:04
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant