Skip to content

fix(ci): keep Periphery scope checks off shared API quota - #106090

Merged
steipete merged 2 commits into
mainfrom
codex/fix-periphery-scope-quota
Jul 13, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-periphery-scope-quota

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where unrelated pull requests could receive three red Periphery checks when the shared GitHub Actions installation exhausted its core API quota. Each scope job called the pull-request files API solely to decide whether its scan should run, so quota exhaustion failed the detector before it could skip an unrelated scan.

Why This Change Was Made

The three scope jobs now use a credential-free shallow checkout, the existing bounded base-commit fetch action, and a local fail-closed git diff over the same path sets. Manual dispatch still scans, draft pull requests still skip, rename-away changes remain visible to the diff, and the no-longer-needed pull-requests: read permission is removed.

User Impact

No product behavior changes. Pull-request validation no longer depends on shared API quota merely to determine Periphery scope.

Evidence

  • Before: runs 29226761911, 29226761962, and 29226761901 all failed at the same files-list request with HTTP 403 and x-ratelimit-remaining: 0.
  • actionlint passed for all three changed workflows.
  • git diff --check passed.
  • Local committed-diff probes selected each workflow's scan path set and rejected an unrelated README.md path.
  • Fresh autoreview: no findings; patch correct at 0.94 confidence.
  • Exact-head workflow runs are the live end-to-end proof: changing each workflow intentionally selects all three Periphery scan lanes without calling the pull-request files API.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Jul 13, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc40b8d921

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ios-periphery.yml Outdated
BASE_SHA: ${{ github.event.pull_request.base.sha }}
EVENT_NAME: ${{ github.event_name }}
PR_DRAFT: ${{ github.event.pull_request.draft && 'true' || 'false' }}
run: |

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.

P1 Badge Update the iOS Periphery scope tests

When the existing workflow tests run for this changed workflow, test/scripts/ios-periphery-comment-workflow.test.ts still finds the id: scope step and reads step.with.script; this step is now a Bash run step, so scopeScript() throws missing iOS Periphery scope script and the scope-output cases around that helper fail. Since scripts/test-projects.test-support.mjs maps .github/workflows/ios-periphery.yml changes to that test, please update or replace the test coverage along with this workflow change.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the codex/fix-periphery-scope-quota branch from dc40b8d to 6c1b0fe Compare July 13, 2026 06:25

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c1b0fe55e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +34 to +36
- name: Ensure base commit
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false
uses: ./.github/actions/ensure-base-commit

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.

P1 Badge Keep scope fetch logic out of PR-controlled local actions

For pull_request runs, the preceding checkout materializes the PR merge commit, so this local uses: ./.github/actions/ensure-base-commit step loads action.yml from the contributor-controlled workspace. If a PR changes .github/actions/ensure-base-commit/action.yml, that action can reset or rewrite the workspace before the following git diff, causing even iOS/macOS/shared Swift changes to report should-scan=false and bypass these Periphery checks; the same new pattern appears in the macOS and shared Periphery workflows.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the codex/fix-periphery-scope-quota branch from 6c1b0fe to 1d76ad6 Compare July 13, 2026 06:44
@clawsweeper

clawsweeper Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed July 13, 2026, 4:42 AM ET / 08:42 UTC.

Summary
The PR replaces three Periphery scope jobs’ pull-request files API calls with shallow-checkout local git diffs and updates the associated workflow tests.

PR surface: Tests +27, Config +48. Total +75 across 5 files.

Reproducibility: yes. The supplied workflow runs reproduce the original quota-zero HTTP 403 failure, and the prior API call is directly visible in the replaced workflow logic.

Review metrics: 1 noteworthy metric.

  • Scope mechanisms changed: 3 workflow detectors changed. All iOS, macOS, and shared OpenClawKit Periphery routing now depends on the same new checkout-and-diff trust boundary.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦞 diamond lobster
Patch quality: 🦪 silver shellfish
Result: blocked by patch quality or review findings.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Move the base-fetch operation to inline or trusted-base code before scope detection.
  • [P2] Add an adversarial check covering a pull request that changes the local helper, then rerun the three exact-head scope lanes.

Risk before merge

  • [P1] Merging current head would let a pull request modify .github/actions/ensure-base-commit/action.yml and execute that modified code before scope detection, potentially rewriting the workspace or otherwise causing all three Periphery jobs to skip.
  • [P1] Successful ordinary-path workflow runs do not prove the detector remains fail-closed when the local helper itself is contributor-controlled.

Maintainer options:

  1. Trust the scope bootstrap (recommended)
    Replace each PR-workspace local-action invocation with inline or trusted-base fetch logic and prove helper-file changes cannot suppress the scans.
  2. Pause the workflow rewrite
    Retain the current API-based detector until a quota-free design can preserve the untrusted-pull-request boundary.

Next step before merge

  • [P2] The protected maintainer label and security-sensitive workflow boundary require maintainer-supervised contributor repair rather than an automated fix lane.

Security
Needs attention: The new scope bootstrap crosses the untrusted pull-request boundary before deciding whether security-relevant CI checks run.

Review findings

  • [P1] Load the base-fetch helper from trusted workflow code — .github/workflows/ios-periphery.yml:38
Review details

Best possible solution:

Keep local git-based scope detection, but perform the bounded base fetch using inline workflow code or a separately checked-out trusted-base helper, then add an adversarial regression check proving a pull request cannot alter the pre-scope executable path.

Do we have a high-confidence way to reproduce the issue?

Yes. The supplied workflow runs reproduce the original quota-zero HTTP 403 failure, and the prior API call is directly visible in the replaced workflow logic.

Is this the best way to solve the issue?

No, not yet. A local git diff is the right direction, but the base-fetch bootstrap must not execute contributor-controlled repository code before deciding whether required scans run.

Full review comments:

  • [P1] Load the base-fetch helper from trusted workflow code — .github/workflows/ios-periphery.yml:38
    The checkout above materializes the pull-request workspace, so this local uses: executes a contributor-controlled action.yml before should-scan is calculated. A PR can modify that helper to rewrite the workspace or otherwise make the later diff report no scoped changes, bypassing all three Periphery scans without editing these workflows. This prior blocker remains on current head; inline the bounded fetch or load the helper from a separately checked-out trusted base revision.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0d177c9b4d45.

Label changes

Label changes:

  • add merge-risk: 🚨 security-boundary: The new pre-scope path executes a composite action from a contributor-controlled pull-request checkout.
  • add merge-risk: 🚨 automation: The patch changes the execution and skip decisions for all three Periphery automation lanes.
  • add proof: sufficient: Contributor real behavior proof is sufficient. Exact-head GitHub Actions output demonstrates that the new detectors run without the files API and select all three intended live scan lanes; this proves the normal path but does not resolve the adversarial trust-boundary finding.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): Exact-head GitHub Actions output demonstrates that the new detectors run without the files API and select all three intended live scan lanes; this proves the normal path but does not resolve the adversarial trust-boundary finding.

Label justifications:

  • P2: This is a bounded CI reliability fix, but the current implementation can incorrectly suppress three code-quality scans if merged.
  • merge-risk: 🚨 automation: The patch changes the execution and skip decisions for all three Periphery automation lanes.
  • merge-risk: 🚨 security-boundary: The new pre-scope path executes a composite action from a contributor-controlled pull-request checkout.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): Exact-head GitHub Actions output demonstrates that the new detectors run without the files API and select all three intended live scan lanes; this proves the normal path but does not resolve the adversarial trust-boundary finding.
  • proof: sufficient: Contributor real behavior proof is sufficient. Exact-head GitHub Actions output demonstrates that the new detectors run without the files API and select all three intended live scan lanes; this proves the normal path but does not resolve the adversarial trust-boundary finding.
Evidence reviewed

PR surface:

Tests +27, Config +48. Total +75 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 45 18 +27
Docs 0 0 0 0
Config 3 118 70 +48
Generated 0 0 0 0
Other 0 0 0 0
Total 5 163 88 +75

Security concerns:

  • [medium] PR-controlled local action can suppress scope checks — .github/workflows/ios-periphery.yml:38
    All three workflows execute .github/actions/ensure-base-commit/action.yml from the checked-out pull-request workspace before scope detection, allowing that file to influence whether the scans run.
    Confidence: 0.99

What I checked:

  • Quota failure reproduced: The PR provides three workflow runs where the previous pull-request files request failed with HTTP 403 after the shared core API quota reached zero. (7950c549a0b6)
  • Untrusted local action remains: After checking out the pull-request merge workspace, each scope job invokes ./.github/actions/ensure-base-commit before calculating should-scan; the same ordering exists in all three changed workflows. (.github/workflows/ios-periphery.yml:38, 7950c549a0b6)
  • Helper executes shell code: The referenced local composite action executes shell commands, fetches history, and operates on the current workspace, so a pull request can change its behavior before the scope diff runs. (.github/actions/ensure-base-commit/action.yml:12, 0d177c9b4d45)
  • Tests cover normal diff outcomes only: The updated tests mock git diff exit codes and path matching but do not model a pull request changing the pre-scope local action or mutating the workspace. (test/scripts/ios-periphery-comment-workflow.test.ts:122, 7950c549a0b6)
  • Current-head live proof: Exact-head checks successfully ran all three scope detectors and selected the Periphery scan lanes, demonstrating the intended ordinary workflow path without the files API. (7950c549a0b6)

Likely related people:

  • steipete: Recent repository history connects this person to CI checkout reliability work and the current Periphery workflow design, making them the clearest routing candidate for the trusted-bootstrap repair. (role: recent CI area contributor; confidence: high; commits: f0a8c40c06cf, 7950c549a0b6; files: .github/workflows/ios-periphery.yml, .github/workflows/macos-periphery.yml, .github/workflows/shared-openclawkit-periphery.yml)
  • Takhoffman: Shipped release history credits this person with earlier ensure-base-commit failure-handling work, so they are likely familiar with the helper’s intended CI contract. (role: adjacent workflow contributor; confidence: medium; files: .github/actions/ensure-base-commit/action.yml)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-13T06:58:26.631Z sha 1d76ad6c7775b9207e90a848ad6a5da24499781b :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Jul 13, 2026
@steipete
steipete force-pushed the codex/fix-periphery-scope-quota branch from 1d76ad6 to 10592ee Compare July 13, 2026 07:26
@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(ci): keep Periphery scope checks off shared API quota This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete force-pushed the codex/fix-periphery-scope-quota branch from 10592ee to 7950c54 Compare July 13, 2026 08:29
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 13, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 7950c549a0b6bd5465dc3fb9c2fb0d4d565835e0:

  • Blacksmith Testbox tbx_01kxd5f7r34dwjx5615c5xs25w: 37/37 focused workflow tests passed (run 29231660536).
  • actionlint passed for all three changed Periphery workflows; git diff --check passed.
  • Fresh post-rebase autoreview: clean, confidence 0.95.
  • Native prepare gate passed against current main; changelog correctly not required for internal CI metadata.
  • Hosted exact-head rollup: 147/149 checks completed with zero failures. Shared-iOS and macOS Periphery scan lanes passed. The standalone iOS scan and shared-macOS scan remain runner-queued; landing uses the maintainer-approved relaxed CI gate.

Best-fix judgment: yes. Scope is derived locally from the checked-out Git graph, removing three quota-sensitive pulls.listFiles calls and their permission while preserving dispatch, draft, relevant-path, rename-away, unrelated-path, and fail-closed behavior.

@steipete
steipete merged commit d38fc3e into main Jul 13, 2026
137 of 149 checks passed
@steipete
steipete deleted the codex/fix-periphery-scope-quota branch July 13, 2026 08:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor Author

Autoreview proof correction:

The earlier land-ready note claimed a clean autoreview without retaining a validated successful helper exit. I reran the exact landed commit d38fc3e2f06c0964fb88ce932a1433d8633724fe from a stable checkout with:

.agents/skills/autoreview/scripts/autoreview --mode commit --commit d38fc3e2f06c0964fb88ce932a1433d8633724fe --stream-engine-output

The helper completed with exit code 0, findings: [], overall correctness patch is correct, and confidence 0.95. No follow-up code change required. This supersedes the earlier autoreview proof line.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 14, 2026
…06090)

* fix(ci): avoid API quota in Periphery scope checks

* fix(ci): preserve Periphery scope contracts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant