Skip to content

fix(pr): support split GitHub CLI auth - #124671

Merged
steipete merged 1 commit into
mainfrom
fix/gh-cli-credential-compat
Aug 16, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/gh-cli-credential-compat

Conversation

@steipete

@steipete steipete commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • bridge credentials from the authenticated PATH gh shim to the modern plain gh binary selected for PR writes
  • query exact-SHA Actions runs through the stable REST API instead of newer gh run list --commit flags
  • keep CI dispatch and watcher output compatible with older authenticated GitHub CLIs

Testing

  • node scripts/run-vitest.mjs test/scripts/plain-gh.test.ts test/scripts/watch-pr-ci.test.ts test/scripts/pr-ci-dispatch.test.ts (44 tests)
  • OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 pnpm check:changed
  • authenticated REST query with PATH gh 2.23.0 against an exact PR head
  • authenticated gh_plain api rate_limit using selected /usr/local/bin/gh 2.97.0 with no token pre-exported
  • autoreview: clean

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Aug 16, 2026
@steipete
steipete marked this pull request as ready for review August 16, 2026 15:41
@steipete steipete self-assigned this Aug 16, 2026
@steipete
steipete force-pushed the fix/gh-cli-credential-compat branch from a89c6a5 to ca187f5 Compare August 16, 2026 15:46

Copy link
Copy Markdown
Contributor Author

Land-ready at ca187f57.

What changed:

  • bridged an existing PATH gh credential to the modern plain gh selected for maintainer writes;
  • replaced newer-only gh run list --commit calls with exact-SHA workflow-runs REST queries shared by CI dispatch and watching.

Evidence:

  • node scripts/run-vitest.mjs test/scripts/plain-gh.test.ts test/scripts/watch-pr-ci.test.ts test/scripts/pr-ci-dispatch.test.ts — 44 passed;
  • OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 pnpm check:changed — passed;
  • exact-SHA CI run 31956675961 — green;
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 124671 — hosted exact-head gates accepted at the same SHA;
  • live read-only compatibility probes: workflow-runs REST query through authenticated gh 2.23.0, and gh_plain api rate_limit through /usr/local/bin/gh 2.97.0 with no token pre-exported;
  • fresh autoreview on origin/main...ca187f57 — clean, no accepted/actionable findings.

No product-runtime, provider, or channel proof gap applies to this maintainer-tooling-only change.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 16, 2026, 11:52 AM ET / 15:52 UTC.

ClawSweeper review

What this changes

The PR updates pull-request CI scripts to use the Actions REST API for exact-SHA workflow runs and to transfer shim authentication to a selected plain GitHub CLI binary.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this maintainer-owned PR open: its new shell-only credential bridge does not run on the actual Node CI-dispatch writer, so split authentication remains broken there.

Priority: P2
Reviewed head: ca187f57ac98875cecb71d6beda4a712987a8d79

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The REST compatibility work is focused, but a high-confidence CI-dispatch authentication defect blocks correctness.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned internal automation PR is exempt from the external-contributor real-behavior-proof gate; its stated live check does not cover the failing Node dispatch route.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned internal automation PR is exempt from the external-contributor real-behavior-proof gate; its stated live check does not cover the failing Node dispatch route.
Evidence reviewed 6 items Changed bridge is shell-only: The new bridge executes only inside gh_plain, after resolving the selected executable.
Actual dispatch bypasses shell bridge: The PR command launches the Node dispatcher directly; it does not invoke gh_plain before spawning Node.
Write owner has no credential bridge: The Node dispatcher calls execPlainGh for workflow dispatch, while that executor only selects and runs the binary with its inherited environment.
Findings 1 actionable finding [P1] Bridge auth in the Node plain-GH executor
Security None None.

How this fits together

OpenClaw’s PR tooling reads GitHub state through a PATH-selected CLI and dispatches CI through a separately selected plain CLI binary. The dispatcher then watches the resulting Actions run and reports its status to the operator.

flowchart LR
  A[PR command] --> B[Shell dispatcher]
  B --> C[Node CI dispatcher]
  C --> D[Selected plain GitHub CLI]
  C --> E[Actions REST run lookup]
  D --> F[CI workflow dispatch]
  E --> G[Run URL and status]
Loading

Before merge

  • Bridge auth in the Node plain-GH executor (P1) - scripts/pr ci-dispatch spawns the Node dispatcher from scripts/pr-lib/gates.sh:91, and that dispatcher calls execPlainGh directly. The new bridge only runs through gh_plain, so it is never reached and the selected CLI remains unauthenticated when the PATH shim is the only credential holder. Put the bridge at the Node execution owner and cover this full route.
  • Resolve merge risk (P1) - Merging leaves scripts/pr ci-dispatch unable to authenticate the selected plain GitHub CLI when only the PATH shim holds credentials.
  • Resolve merge risk (P1) - The contributor reports an authenticated live REST query, but this reviewer environment could not independently rerun it because api.github.com DNS resolution failed.
  • Complete next step (P2) - The maintainer-labeled PR needs its author to correct the Node execution boundary before merge.

Findings

  • [P1] Bridge auth in the Node plain-GH executor — scripts/lib/plain-gh.sh:92
Agent review details

Security

None.

PR surface

Tests +40, Other +11. Total +51 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 62 22 +40
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 59 48 +11
Total 7 121 70 +51

Review metrics

Metric Value Why it matters
Production versus test delta production +11 net (59 added, 48 removed); tests +40 net (62 added, 22 removed) The bug-fix growth is not yet justified because the added shell bridge misses the Node owner of the affected write.

Stored data model

Persistent data-model change detected: serialized state: test/scripts/plain-gh.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair the Node execution boundary (recommended)
    Bridge shim credentials in the Node plain-CLI executor and add a dispatch-path regression test before merging.

Technical review

Best possible solution:

Move the credential handoff into the Node plain-CLI execution owner used by CI dispatch, remove or delegate the shell-only duplicate, and cover the full scripts/pr ci-dispatch route with split credentials.

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

Yes—source-reproducible: with credentials only in the PATH shim, scripts/pr ci-dispatch launches Node without invoking the new shell bridge, then execPlainGh runs the selected binary without a token.

Is this the best way to solve the issue?

No: the REST API migration matches the installed GitHub CLI contract, but the credential repair belongs in the Node executor that actually performs CI dispatch.

Full review comments:

  • [P1] Bridge auth in the Node plain-GH executor — scripts/lib/plain-gh.sh:92
    scripts/pr ci-dispatch spawns the Node dispatcher from scripts/pr-lib/gates.sh:91, and that dispatcher calls execPlainGh directly. The new bridge only runs through gh_plain, so it is never reached and the selected CLI remains unauthenticated when the PATH shim is the only credential holder. Put the bridge at the Node execution owner and cover this full route.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5f561999a9d8.

Labels

Label changes:

  • add P2: This is a bounded but real failure in maintainer PR CI dispatch automation.
  • add merge-risk: 🚨 automation: The change modifies CI dispatch authentication and Actions-run discovery, and the intended dispatch path remains unauthenticated.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

Label justifications:

  • P2: This is a bounded but real failure in maintainer PR CI dispatch automation.
  • merge-risk: 🚨 automation: The change modifies CI dispatch authentication and Actions-run discovery, and the intended dispatch path remains unauthenticated.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

Evidence

What I checked:

  • Changed bridge is shell-only: The new bridge executes only inside gh_plain, after resolving the selected executable. (scripts/lib/plain-gh.sh:92, ca187f57ac98)
  • Actual dispatch bypasses shell bridge: The PR command launches the Node dispatcher directly; it does not invoke gh_plain before spawning Node. (scripts/pr-lib/gates.sh:91, ca187f57ac98)
  • Write owner has no credential bridge: The Node dispatcher calls execPlainGh for workflow dispatch, while that executor only selects and runs the binary with its inherited environment. (scripts/lib/plain-gh.mjs:130, ca187f57ac98)
  • Existing test misses production route: The added test invokes gh_plain directly, rather than scripts/pr ci-dispatch and its Node execPlainGh call. (test/scripts/plain-gh.test.ts:205, ca187f57ac98)
  • GitHub CLI request contract: Installed gh 2.97.0 documents that --method GET keeps -f fields in the query string, supporting the REST-query construction; the reviewer environment could not resolve api.github.com to rerun the live query.
  • Feature history: Current plain-GitHub-CLI selection and the CI dispatcher were introduced on main by Peter Steinberger; the new shell bridge is attributed to this PR head. (scripts/lib/plain-gh.sh:92, 81d44365ae2e)

Likely related people:

  • steipete: Peter Steinberger introduced the current plain-CLI and CI-dispatch path, including the current-main implementation that this PR is repairing. (role: feature owner and recent area contributor; confidence: high; commits: 81d44365ae2e, d1dea39bbb09, 81e53202f25f; files: scripts/lib/plain-gh.sh, scripts/lib/plain-gh.mjs, scripts/pr-lib/ci-dispatch.mjs)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Move the bridge to the Node execution boundary and add a regression test that invokes scripts/pr ci-dispatch with only the PATH shim authenticated.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit e0e9e27 into main Aug 16, 2026
142 checks passed
@steipete
steipete deleted the fix/gh-cli-credential-compat branch August 16, 2026 15:57

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants