Repository navigation
fix(github): report the correct credential for CLI throttles - #1600
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 6:05 AM ET / 10:05 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR makes GitHub CLI throttle errors identify the failed request’s credential while preserving native diagnostics, retry timing, and the existing one-shot fallback. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. No actionable correctness or security findings remain, and the supplied real-client proof supports the change. Priority: P2 Review scores
Verification
How this fits togetherClawSweeper’s shared GitHub CLI wrapper executes requests for review and repair workflows. It turns throttled command failures into structured errors used by callers and operator diagnostics. flowchart TD
A[Review and repair requests] --> B[Prepare command credentials]
B --> C[Capture credential scope]
C --> D[Execute GitHub CLI]
D --> E{Request throttled}
E -->|Eligible public read| F[Existing one-shot App fallback]
F --> D
E -->|Terminal failure| G[Original diagnostics with captured scope]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep credential attribution at the shared command boundary, preserving existing routing and native errors without introducing another token-selection policy. Do we have a high-confidence way to reproduce the issue? Yes. The supplied real-gh trace reproduces the failure using the frozen current-main owners: after successful App fallback, a later Actions throttle is reported as target_app. Is this the best way to solve the issue? Yes. Capturing the prepared credential before dispatch fixes the shared error boundary without changing fallback policy; focused coverage also checks environment drift and native error identity. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 02cd682921ca. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
What Problem This Solves
A later Actions-token request can be reported as a
target_appthrottle after a public read uses its one App fallback. This points operators investigating queue backoff at the wrong credential.Related: #1598. This follow-up changes attribution in the shared GitHub CLI owner and does not depend on that PR.
User Impact
GitHub CLI throttle errors identify the credential used by the failed request. Native error output, reset calculation, routing, retry timing, and the existing single fallback allowance stay intact.
Attribution remains deliberately conservative for non-API commands, explicit hostnames, absolute API URLs, and enterprise
GH_HOSTvalues: these retain the previous default or propagated scope because this owner cannot prove the native client's credential selection.Why This Change Was Made
Capture the credential identity from the prepared child environment before dispatch, then carry that fact with the original error. Sync, async, fallback, and limited-pagination wrappers use the same error factory. The HTTP runtime reuses the extracted pure identity classifier while preserving its existing token precedence.
Production delta: +61 lines; tests: +324 lines. The added boundary records the dispatched credential without retaining tokens or replacing native errors. No new configuration or persisted state.
OpenClaw Bay Impact
No Bay projection, queue schema, lifecycle transition, publication count, or public field changes. This corrects the CLI error's existing scope field; the HTTP runtime's classification behavior and telemetry writer remain unchanged. No Bay UI change is needed.
Documentation Impact
Reviewed
README.mdcredential handling,docs/README.md, andCONTRIBUTING.md. Existing credential provisioning and operator commands remain accurate. The operational change is recorded inCHANGELOG.md; its insertion is separate from the other pending queue fixes.Evidence
corepack pnpm run check: 6,259 passed, 19 skipped, zero failures or cancellations; native AWS runrun_f62d2550a42d, exit 0. Includes build, formatting, static gates, and the full test suite.3e5f0962c7bea9965c6928865ad56e8988376f92; tree927f11deab4c374e0b4e68be84a053c630018986. Only the changelog bullet moved after the accepted runtime proof; source and test hashes below still match.Real Behavior Proof
Claim: the actual compiled CLI owner reports the failed request's credential without changing its real
ghrequest sequence or error streams.Surface and environment: Node 24.18.1, pnpm 12.4.1, native
gh2.46.0, Linux amd64. The same installed dependencies compile the three frozen baseline owners from02cd682921ca0c796212319c1a28c9b1e4bfac58inside the owned fixture. No lazy Git fetch or fixture dependency install occurs.Command:
crabbox run --id cbx_098950dee7ea --no-sync --no-hydrate --keep --timing-json --script <reviewed-proof-script>; native runrun_3cd091b0cbc6exited 0. The reviewed script hash and exact source/build identities are below.Observed trace: all 11 requests were real
ghGETs through a strict loopback HTTPS fixture, with credential role labels only.target_app— reproducedrepository_actionsrepository_actionstarget_app, recovery falseEach terminal throttle retained the native JSON response and
gh: API rate limit exceeded (HTTP 429)stderr. The same 60-second fallback reset floor, non-authoritative reset provenance, and one-fallback request count were preserved.Isolation and limits: separate network/PID/user namespaces, only loopback, no external routes, read-only source, private temporary storage, cleared inherited environment, fake credentials, and a short-lived fixture CA with TLS verification enabled. All assertions and strict socket checks passed; owned children closed and the fixture was removed. This proves actual-client transport and attribution under controlled responses, not production quota recovery. Pagination and alternate-host behavior are covered by focused tests, not this real-client fixture. The inherited fixture retains a strict hold on socket errors; this successful run does not claim a general EPIPE lifecycle fix.
Exact proof receipt and final-head binding
{ "status": "PASS", "generated_at": "2026-09-16T09:43:24.266Z", "native_run": "run_3cd091b0cbc6", "source_base": "02cd682921ca0c796212319c1a28c9b1e4bfac58", "exercised_tree": "a2cc43a08f597533071fe0ae7dba89cf6686d995", "final_head": "3e5f0962c7bea9965c6928865ad56e8988376f92", "final_tree": "927f11deab4c374e0b4e68be84a053c630018986", "post_proof_change": "CHANGELOG.md bullet relocation only; runtime and test hashes unchanged", "script_sha256": "fbb3c492cec28620c9e88687a4e1f1bf71e8a3c40bff7f8091a2d507b653b1d2", "receipt_sha256": "931a3b869fc5ea7af7d75af8a8743c87f09661ff7a552643716fb9bc4a9f3a57", "receipt_bytes": 16222, "source_sha256": "768d176830fae33dab33bd9f742ced8fd7229a9ddc3588fe4b370eb016c6d2cf", "compiled_sha256": "f3c95973ec0bd4dd4f97cb417cd562a018b147ddc4ae648b38ed07199c6a122b", "gh_sha256": "80671b8dab3e41893f3e338fb104c997a390b0a51fafc34eb30048e2df99ab54", "source_and_test_inputs": { "src/github-retry.ts": "cd988d2e48c23847d5bbe95b0a4bea7f04c5344b7cb29e66cffedcaf66aecd51", "src/clawsweeper-github-runtime.ts": "24796e67c463de03beabba6328efd92bea35ca6f176364af5e12ae4b720b7046", "src/repair/github-cli.ts": "a955c4cb0680b1856d67dd1226ea866894d65b127fb8e1d1649df759d7facc4b", "test/github-credential-scope.test.ts": "3e7c07a6d0c2d064e62ee547254570981c91913fe0408c99a9fdafa01808b92b", "test/repair/github-cli-scope.test.ts": "901bb4c2dbb359b0ed2b7b52567cb7793159504c6d4baf47c4a54e31ac87aef3" }, "compiled_owners": { "dist/github-retry.js": "08d214608737f327b3eb2a208dce74d913b607d698e19156beae4b9b62189c1e", "dist/clawsweeper-github-runtime.js": "55e812bc6f5008f8fc3acdceeaffa250b4b746889ce3e3714ba644f7aef9f67c", "dist/repair/github-cli.js": "95aae09725d811b678fe531645cff6dbe0a05190be457ec640f37115dc10e08b" }, "scenario_native_exits": [ { "name": "baseline misattributes later Actions throttle", "exit": 0, "natural": true, "stdout_eof": true, "stderr_eof": true, "wall_ms": 138, "scope": "target_app", "recovered": true }, { "name": "candidate sync attributes later Actions throttle", "exit": 0, "natural": true, "stdout_eof": true, "stderr_eof": true, "wall_ms": 130, "scope": "repository_actions", "recovered": true }, { "name": "candidate async attributes later Actions throttle", "exit": 0, "natural": true, "stdout_eof": true, "stderr_eof": true, "wall_ms": 129, "scope": "repository_actions", "recovered": true }, { "name": "candidate exhausted App remains target_app", "exit": 0, "natural": true, "stdout_eof": true, "stderr_eof": true, "wall_ms": 97, "scope": "target_app", "recovered": false } ], "source_compiled_dependencies_unchanged": true, "owned_fixture_removed": true, "owned_children_closed": true }Full-check log: 1,079,328 bytes, SHA-256
7ee57669e7348dc65a88cc052bdd00cfcfff351d471480e99b1982153ec80730.The proof executed tree
a2cc43a08f597533071fe0ae7dba89cf6686d995. Its only difference from the final tree is the changelog entry's position. All three production owners and both added tests retain the exact hashes in the receipt.