Repository navigation
refactor(dashboard): unify GitHub App authentication - #1115
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 9:57 PM ET / August 11, 2026, 01:57 UTC. ClawSweeper reviewWhat this changesThe PR moves duplicated GitHub App credential parsing, JWT signing, installation lookup, and request handling into one dashboard module while retaining plain Worker errors and classified queue errors. Merge readinessKeep open: current main still has the two App-auth implementations, while this branch centralizes them with compatibility adapters. No actionable correctness or security defect was found; the current-head Worker/Durable Object proof is sufficient. Likely related people: steipete and Martin Cleary (medium-confidence history routing). Priority: P2 Review scores
Verification
How this fits togetherThe dashboard Worker and exact-review queue authenticate to GitHub as an App before reading or dispatching review work. The shared authentication module now supplies those requests, with each caller retaining its own error behavior. flowchart LR
A[Webhook and queue requests] --> B[Dashboard Worker]
A --> C[Exact-review queue]
B --> D[Shared GitHub App authentication]
C --> D
D --> E[GitHub API requests]
E --> F[Worker plain errors]
E --> G[Queue classified errors]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one App-auth implementation with the Worker compatibility adapters, then merge with focused observation of GitHub App token and installation failures. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a consolidation of existing authentication behavior, not a user-reported failure. Is this the best way to solve the issue? Yes: using one shared implementation with narrow Worker adapters is the maintainable way to remove duplication without replacing the queue's classified-error contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1ee584328f2f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
What Problem This Solves
ClawSweeper had two independent copies of its GitHub App authentication stack in the dashboard
Worker and exact-review queue. Eleven functions were byte-identical, while
githubAppJsonhadalready drifted: the queue classified timeout, network, rate-limit, validation, and response-body
failures with
GitHubRequestError; the Worker exposed plain errors. Keeping two cryptographic andrequest implementations made future auth drift likely while making a mechanical consolidation
unsafe without an explicit error-boundary decision.
Why This Change Was Made
dashboard/github-api.tsis now the single canonical owner of all 12 functions and uses thequeue's richer classified implementation. The queue imports that implementation directly. The
Worker imports thin wrapper exports that preserve its former observable error surface: classified
timeout and HTTP failures become plain
Errorvalues with the same message, response-body errorspass through, and non-timeout fetch rejections rethrow the original rejection object unchanged.
The shared module privately associates a classified request failure with its original transport
rejection. That preserves the queue's
GitHubRequestErrorcontract without exposing new fields orchanging its constructor, while allowing only the Worker adapter to restore the merge-base
behavior. A controller-owned timeout remains distinct from an independent
AbortErrorrejection.User Impact
No intended observable behavior change. GitHub App signing, key normalization, installation
lookup, token requests, and queue classification now have one implementation. Every Worker
failure shape pinned from the merge-base implementation remains unchanged.
Drift Evidence
Before this change, the two monoliths contained duplicate implementations of credentials parsing,
installation lookup, JSON requests, JWT signing, private-key normalization, PKCS1-to-PKCS8
conversion, PEM decoding, DER wrapping, DER element/length encoding, byte concatenation, and
base64url encoding. The only implementation drift was
githubAppJson: the queue had the richerclassified error behavior and the Worker used plain errors. This PR resolves that drift by the
coordinator decision above rather than choosing one surface implicitly.
Production code changes remain a net reduction. The complete PR is larger because it commits the
required reusable real-runtime proof and redacted evidence.
Accepted Finding Disposition
The P2 transport-compatibility finding is resolved at current head
cdf2a6ead92276bd467bdda1e42d1f51880b6caf. At the merge base, the Worker awaitedfetch(...).finally(...)without a catch, so a fetch rejection propagated unchanged. The adapter now rethrows the original
non-controller transport rejection object. The focused test pins both
TypeError("fetch failed")and
DOMException("request aborted", "AbortError")by object identity, constructor, and message,while separately pinning the controller-owned timeout path.
Real Behavior Proof
while preserving their entry-point behavior.
ExactReviewQueueDurableObject, both signed HTTP routes, the production App signer/request client, and a real loopback
GITHUB_API_URLHTTP listener.issue_commentwebhook and a signedbranch-authority request. The loopback server holds both initial App-auth requests until they are
present, then compares the complete JWT and canonical auth-header bytes before allowing both
workflows to finish.
docs/proof/unify-github-app-auth/run-proof.sh; Node 24.19.0,Wrangler 4.107.0, real loopback sockets.
PROOF_RC=0; Worker status202with status comment777;queue status
202;openclaw/gogcli#598resolved through the Durable Object; byte-identical JWTand canonical App-auth header bytes; zero unexpected loopback requests.
summary under
docs/proof/unify-github-app-auth/; current-head reruns used isolated temporaryoutput so historical committed artifacts remain immutable.
GitHub write, workflow dispatch, deployment, or live queue mutation occurs.
Docker-backed Crabbox proof used a clean
--fresh-pr openclaw/clawsweeper#1115 --no-hydratecheckout atcdf2a6ead92276bd467bdda1e42d1f51880b6caf, Corepack with pnpm 11.10.0, and achecksum-verified jq 1.8.1 (
jq-linux-amd64: OK). The local-container runtime proof printedPROOF_RC=0andCONTAINER_PROOF_RC=0. Providerlocal-container, imagenode:24-bookworm, leasecbx_b2244ab2ed15(jade-barnacle-ceda); Crabbox exited 0 and reportsleaseStopped=true.The same container baselined current
origin/mainat1ee584328f2f07e8dde61dc70124c26da6c28af2: its targeted run produced exactly the three knownblob-hydration environmental failures. The PR full suite ran 3,312 tests—3,301 passed, 8 skipped,
and the same 3 failed—so
CONTAINER_DELTA_FAILURES=0.Worker Error-Shape Evidence
test/github-api.test.tsdrives the actual signed Worker route and pins the full representativesurface:
GitHub App installation timed outas plainErrorfetch failedas the originalTypeErrorobjectrequest abortedas the originalDOMExceptionwith nameAbortErrorGitHub App installation 503as plainErrorUnexpected token 'o', "not-json" is not valid JSONasSyntaxErrorThe same focused file also verifies a canonical RS256 JWT and the PKCS1-to-PKCS8 conversion against
Node's cryptographic implementation.
Validation
pnpm run format:check— passedpnpm run check:limits— passedpnpm run build:all— passedpnpm run test:no-build— 3,312 tests; 3,303 passed; 9 skipped; 0 failedpnpm run lint— passedpnpm run check:active-surface— passedpnpm run check:dashboard-queue-boundary— passedPROOF_RC=0PROOF_RC=0,CONTAINER_PROOF_RC=0, no failure deltaorigin/main— clean, no accepted/actionable findingsOpenClaw Bay Impact
None. This is an internal authentication ownership consolidation and error-boundary compatibility
repair. It changes no lifecycle or review-publication contract, queue semantics, status/telemetry
shape, Bay data contract, control, or observer-only boundary.
Documentation Lifecycle
The proof package is historical evidence tied to the recorded source SHA and re-runnable harness;
it is not an active operator runbook. No active documentation lifecycle changes.