Repository navigation
refactor(dashboard): type webhook ingress decisions - #1132
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 1:37 AM ET / 05:37 UTC. ClawSweeper reviewWhat this changesThe PR types the dashboard Worker’s GitHub webhook classifier inputs and outcomes, adds compile-time boundary checks, and documents a local Worker behavior-comparison harness. Merge readinessKeep open: this is a focused, evidence-backed phase of the dashboard strictness work, with no actionable correctness finding. Real local Worker comparison proof is sufficient; normal landing review should wait for the in-progress check. Priority: P3 Review scores
Verification
How this fits togetherThe dashboard Worker receives signed GitHub webhook deliveries, classifies them, then routes accepted events to the review queue or command-dispatch path. This change strengthens compile-time validation at that ingress boundary while preserving the existing runtime routing decisions. flowchart LR
A[GitHub webhook delivery] --> B[Worker HTTP ingress]
B --> C[Signature and JSON validation]
C --> D[Webhook classification]
D --> E[Issue queue admission]
D --> F[Comment command dispatch]
D --> G[Pull request deferral]
D --> H[Rejected event response]
Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land this bounded ingress-typing phase after the current required check completes, retaining the local Worker comparison proof and leaving later strict-mode phases with #1128. Do we have a high-confidence way to reproduce the issue? Not applicable as a user-bug report; the PR instead provides a high-confidence real local Worker comparison of the changed ingress path. Is this the best way to solve the issue? Yes. Typing the external webhook boundary without changing strictness policy or runtime classification is an appropriately narrow first phase for #1128. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 408c28329c18. 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)
|
Ports the durable command-intake pipeline for the "@clawsweeper re-review" command from the abandoned Aug-8 WIP (snapshot 4cad8de on codex/fix-command-review-publication) onto current main. Commands are now durably recorded pre-acknowledgement (intake/watermark/receipt/revision tables, 16-item intake, 15s-15m bounded retries, 30-day receipts), verified against the live comment and head, fenced through verify/enqueue/effects stages, and superseded by full version identity - including equal-timestamp edits (review-caught P1). Acknowledgement and reaction effects are idempotent; router runs that throttle mid-command now recover instead of stranding the command (live instance: openclaw/openclaw#116562 was acked then lost when both router runs throttled). Superseded snapshot pieces were dropped, not ported: retry jitter (#1076/#1077), quota headroom (#1086), retry budgets (#1089), parked reconciliation (#1111), branch guard (#962); dashboard-monolith diffs were reworked around the #1116/#1124/#1132 splits. Proof: committed receipt at this exact head (docs/proof/durable-command-intake/), real Wrangler Worker + DO comparison with durable throttled recovery, GitHub confined to loopback API; full gate 7056 passed / 0 failed; strict check green. Verdict clean (Findings: None) on 9eb957e.
…ng (#1167) Quota campaign PR 5/5: webhook-materialized read model - the pollers stop re-asking GitHub for facts the App already delivered. Typed ingress (extending the #1132 discriminated union) now covers full issue lifecycle, all issue-comment create/edit/delete including non-commands, PR reviews and review comments, workflow runs/jobs, and check runs/suites. The queue DO materializes bounded normalized snapshots: per-item metadata, ordered comment collections with tombstones, review-activity digests, and workflow state - GUID dedupe, monotonic watermarks (out-of-order deliveries cannot regress state), gap detection, and per-class TTLs (items 15m, comments/reviews 30m, workflows 5m, placeholder census 6h). Reads serve "snapshot as of watermark W" with staleness attached. Migrated pollers (measured residual was item_metadata ~2.2k/h + comments ~750/h post PRs 1-4), counted on fixtures: planning 1->0, dashboard health 8->0, placeholder discovery 3->0, router hydration 1->0 GitHub requests on warm snapshots; each keeps a bounded repair poll for gap healing. Hard safety line proven: mutation guards and two-sided lease checks bypass the read model entirely (zero read-model guard hits observed; live hits confirmed). Degradation contract: event classes the GitHub App does not deliver keep their poll paths and emit structured telemetry. REQUIRED APP SUBSCRIPTIONS for full effect: Issues, Pull requests, Issue comments, PR reviews, PR review comments, Workflow runs, Workflow jobs, Check runs, Check suites. Proof: signed loopback deliveries (out-of-order + duplicate GUIDs), poller equivalence with counted formulas, safety fixtures; 59/59 focused, full gate 3455 passed; Crabbox local-container receipt at the final head, machine-verified provenance. Verdict clean (no actionable findings, proof sufficient). Merge note: the red "automerge quota-fixture" check fails identically on origin/main (inherited, tracked separately).
Scope
Phase 1 only of #1128.
This PR types the hosted GitHub webhook classification path. It does not enable strict compiler
flags, add a per-file strict allowlist, change classification policy, or begin Phase 2.
Union shape
The classifier input maps string event literals to readonly consumed-field payload shapes:
issue_comment-> repository, installation, issue, comment, action fields read by the pathissues-> repository, installation, issue, label, action fields read by the pathpull_request-> repository, installation, pull request, label, action fields read by the pathThe result union has four classification kinds: rejected, accepted issue comment, accepted issue
item, and accepted pull-request item. Existing runtime discriminants remain the source of truth:
accepted, thentype,itemKind, andsourceEvent. The accepted comment member now flows intodispatchClawsweeperCommentwithoutas any.Typing-forced code motion
No classification branch or returned object changed. Typing forced only these adjacent edits:
values are reused.
!decision.acceptedis spelleddecision.accepted === falseso the relaxed dashboard compilernarrows the rejected member.
receive annotations needed to carry the narrowed members end to end.
The dedicated expect-error fixture rejects the issue's malformed
{ event: 7, paylod: {} }shape,the misspelled payload property by itself, and pull-request-only fields on an
issuesdelivery.pr-behavior-proofwrangler dev --localWorker HTTP intake, HMAC verification, JSON parsing,classifier branches, local issue queue admission, pull-request source-authority deferral, and the
unsupported-event terminal result.
issue_comment,issues,pull_request, and future-event deliveriesare sent to merge-base and implementation-head Workers twice from a fresh PR checkout.
docs/proof/typed-webhook-ingress/run-proof.sh; Node 24, pinned pnpm,Wrangler 4.107.0. Required proof used Docker-backed Crabbox
provider=local-container,--fresh-pr openclaw/clawsweeper#1132, imagenode:24-bookworm, checksum-verified jq 1.8.1,lease
cbx_dda9e37f1731(crimson-hermit-cceb), runrun_686d05277f14.a7e4e37adb18c939bd3b57e9d9f6ffc4610a9bd6produced fourdeeply equal HTTP status/JSON body pairs in each of two consecutive runs; both dashboard builds
passed;
git status --porcelainwas empty before, between, and after the runs; Crabbox exited 0and stopped the lease automatically. Final branch head
afa21cd96c4731da327b051535a6ec3381c26e88adds only the refreshed receipt and this README summary, leaving the tested launcher unchanged.
docs/proof/typed-webhook-ingress/behavior-report.json, current-headdocs/proof/typed-webhook-ingress/container-receipt.json, and ignored rerun output under.artifacts/typed-webhook-ingress/.production mutation occurs.
Validation
pnpm run build:dashboardnode --test test/dashboard-worker-webhook-ingress.test.ts— 25 passed, 0 failedpnpm run check— 3,346 tests; 3,337 passed, 9 skipped, 0 failedpnpm run format:checkautoreview — no accepted/actionable findings
.artifacts/typed-webhook-ingress/, preserving the frozen committed reportNet delta is +731 lines overall (+748/-17): +179 net for production typing and its compile-time
fixture, plus +552 lines of committed proof harness, documentation, report, and receipt.
OpenClaw Bay: none. The runtime decision objects, lifecycle calls, journey inputs, queue behavior,
and observer-only boundary are unchanged.