Skip to content

fix(upstream-drift): retry anonymously when an IP allow list refuses the token - #14704

Merged
kyle-sexton merged 4 commits into
mainfrom
fix/upstream-drift-ip-allowlist
Nov 9, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
fix/upstream-drift-ip-allowlist

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Refs: #14209

Summary

The monthly upstream drift filer failed every run: the cursor org's IP allow list refuses the Actions token with HTTP 403 (run 42631314988), and check-upstream-drift.sh exits 2 on the first refused call, so no upstream gets an issue.

Fix

  • scripts/check-upstream-drift.sh: every REST read goes through one api helper. When a response's message names an IP allow list, that owner's calls retry anonymously with curl (public repositories). A page with any read still refused (pin, HEAD or tree, for example after the anonymous rate limit) is reported status=unreachable head=unknown, named on stderr, and skipped; --report goes on and exits by drift, the other modes exit 2.
  • scripts/upstream-drift-issues.sh: accepts unreachable and treats it like untracked: the upstream's issue is never closed as clean.
  • The workflow fails after filing when the report holds an unreachable page, with an error annotation, so a gap is never silent. The contract doc states all three.

Verification

  • bash scripts/check-upstream-drift.test.sh: PASS=116 FAIL=0, with new stub-gh/curl cases for a working anonymous retry (gh called once), a refused retry, a refused later HEAD read (unreachable line, rc 0 under --report, rc 2 otherwise) and a non-allow-list failure (no retry, rc 2).
  • bash scripts/upstream-drift-issues.test.sh: PASS=167 FAIL=0, with a clean-beside-unreachable case that closes nothing.
  • shellcheck and actionlint clean; a live --report --page docs/upstream/cursor-pstack.md read cleanly, and an anonymous curl of the pinned cursor/plugins commit returned HTTP 200.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 9, 2026 10:00
…the token

The cursor org's IP allow list refuses the Actions token (HTTP 403), which
failed the whole drift run. Calls for that owner now retry through anonymous
curl; a page still refused is reported status=unreachable, the filer leaves
its issue alone, and the workflow fails after filing the other upstreams.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A tree or HEAD read refused after the pin lookup (for example once the
anonymous rate limit runs out) now marks the page unreachable instead of
ending the whole run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 9, 2026 15:03
@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-09T15:03:23.124499Z
We couldn’t complete this review. Comment @codex review to try again.
226fc86 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 0ba820d9c546eaae262f4701a9f0be2cb4d754e5: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14704 (0ba820d), incremental since fdeb9f1

I found no security issues. I read every hunk of the 3 files changed since the last review: docs/contracts/upstream-drift/README.md, scripts/check-upstream-drift.sh and scripts/check-upstream-drift.test.sh. None of them is on a trusted path. The change touches no trust control: no trusted-actor check, lane token, kill switch, merge hold or plugin manifest. This lane had already reviewed an earlier head, so the review was blocking only.

What I checked

  • Script change in the api() helper (L214-L217):
    • When curl itself fails, the script now sets PAGE_UNREACH="curl failed" before it returns 5.
    • This makes the script fail closed. Every caller that checks PAGE_UNREACH now marks the page unreachable: L296, L351, L435, L455, L464 and L528. Before, the page went on with an empty HEAD.
    • PAGE_UNREACH is reset for each page at L416, so one failed page can't affect the next.
    • The value is a fixed string, so no upstream-controlled text reaches the stderr message at L405.
  • Anonymous curl call: unchanged. It sends no auth header, the host is fixed and -L isn't set.
  • Test stub: it now exits 7 when its code argument is exit. This affects tests only.
  • README: the wording change is prose only and widens nothing.

Settled threads: both threads are resolved by the fix in this head, with no lines changed since. I raised nothing again.

Spend: none beyond the existing anonymous api.github.com reads.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 2 inline finding(s) on fdeb9f126da3cb6be5bf3a01e141e28e0ba4c519; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread scripts/check-upstream-drift.sh Resolved
Comment thread docs/contracts/upstream-drift/README.md Resolved
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review: PR #14704 (incremental, blocking only)

I read every hunk of all 3 files changed since fdeb9f12: docs/contracts/upstream-drift/README.md, scripts/check-upstream-drift.sh and scripts/check-upstream-drift.test.sh. This lane already reviewed an earlier head, so this pass reports only blocking findings.

No new findings. This push fixes both of the lane's earlier findings, and the owner has resolved both threads:

  1. Curl transport failure (scripts/check-upstream-drift.sh:214-217): when curl itself fails, api now sets PAGE_UNREACH="curl failed" before it returns 5. I traced each caller:

    • head_sha returns an empty OUT_SHA, and the main loop's PAGE_UNREACH check then sends the page to unreachable_page.
    • gh_tree sees PAGE_UNREACH at line 296 and returns 5 instead of reaching die.
    • The tree cache at line 351 is skipped.
    • The stderr message now reads an anonymous read (curl failed) rather than an empty ().

    The new test allow list, curl fails on a later read makes the stub curl exit 7 on commits/HEAD. It checks the head=unknown status=unreachable line, rc 0 under --report, and the stderr text, so it would fail if the fix were reverted.

  2. Contract wording (README lines 447-448): the contract now says a page with any read (pin, HEAD or tree) still refused is listed unreachable. That matches what the script does.

PR context: the PR says Refs: #14209 and closes no issue, so there were no acceptance criteria to check. The author's suite count (PASS=120 in the owner's reply) is their claim; I did not run the tests.

Spend: none. The anonymous reads use GitHub's unauthenticated REST quota.

A transport failure in the anonymous retry returned 5 without marking the
page, so head_sha handed back an empty HEAD and the page read as drift.
The contract now says any refused read marks the page unreachable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 7731783 Nov 9, 2026
55 checks passed
@kyle-sexton
kyle-sexton deleted the fix/upstream-drift-ip-allowlist branch November 9, 2026 15:24
@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