Skip to content

refactor(dashboard): type webhook ingress decisions - #1132

Merged
steipete merged 5 commits into
mainfrom
steipete/typed-webhook-ingress
Aug 12, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/typed-webhook-ingress

Conversation

@steipete

@steipete steipete commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

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 path
  • issues -> repository, installation, issue, label, action fields read by the path
  • pull_request -> repository, installation, pull request, label, action fields read by the path
  • other string event names -> the common repository/installation/label/action shape

The 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, then type, itemKind, and sourceEvent. The accepted comment member now flows into
dispatchClawsweeperComment without as any.

Typing-forced code motion

No classification branch or returned object changed. Typing forced only these adjacent edits:

  1. The three delivery-header reads are collected once in a readonly typed object and the same raw
    values are reused.
  2. !decision.accepted is spelled decision.accepted === false so the relaxed dashboard compiler
    narrows the rejected member.
  3. The classifier's compound accepted/reason guard is split into two guards for the same narrowing.
  4. The accepted item local uses a type annotation instead of its previous assertion.
  5. Existing timestamp, pull-request revision/ingress, Bay-trigger, and comment-dispatch parameters
    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 issues delivery.

pr-behavior-proof

  • Claim: Type annotations and union narrowing do not change hosted webhook classification outcomes.
  • Exercised surface: real wrangler dev --local Worker HTTP intake, HMAC verification, JSON parsing,
    classifier branches, local issue queue admission, pull-request source-authority deferral, and the
    unsupported-event terminal result.
  • Scenario: identical signed issue_comment, issues, pull_request, and future-event deliveries
    are sent to merge-base and implementation-head Workers twice from a fresh PR checkout.
  • Command/environment: 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, image node:24-bookworm, checksum-verified jq 1.8.1,
    lease cbx_dda9e37f1731 (crimson-hermit-cceb), run run_686d05277f14.
  • Observable result: source and launcher head a7e4e37adb18c939bd3b57e9d9f6ffc4610a9bd6 produced four
    deeply equal HTTP status/JSON body pairs in each of two consecutive runs; both dashboard builds
    passed; git status --porcelain was empty before, between, and after the runs; Crabbox exited 0
    and stopped the lease automatically. Final branch head afa21cd96c4731da327b051535a6ec3381c26e88
    adds only the refreshed receipt and this README summary, leaving the tested launcher unchanged.
  • Artifacts: frozen review-time docs/proof/typed-webhook-ingress/behavior-report.json, current-head
    docs/proof/typed-webhook-ingress/container-receipt.json, and ignored rerun output under
    .artifacts/typed-webhook-ingress/.
  • Limits: fixtures and credentials are synthetic; no live GitHub call, Worker deployment, or
    production mutation occurs.

Validation

  • pnpm run build:dashboard
  • node --test test/dashboard-worker-webhook-ingress.test.ts — 25 passed, 0 failed
  • pnpm run check — 3,346 tests; 3,337 passed, 9 skipped, 0 failed
  • current source/launcher head Worker proof, run twice — 4 identical outcomes per run, 0 differences
  • Docker-backed Crabbox proof — exit 0, lease stopped, checkout clean after both runs
  • pnpm run format:check
  • implementation pre-commit and committed-branch autoreview, plus receipt-refresh pre-commit
    autoreview — no accepted/actionable findings
  • proof re-runs default to .artifacts/typed-webhook-ingress/, preserving the frozen committed report

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

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 1:37 AM ET / 05:37 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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
Reviewed head: afa21cd96c4731da327b051535a6ec3381c26e88

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The PR is tightly scoped and backed by unusually concrete production-boundary comparison evidence.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The committed Crabbox receipt records two successful real local Worker HTTP comparisons at the tested source/launcher head; the final head changes only the receipt and README summary.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The committed Crabbox receipt records two successful real local Worker HTTP comparisons at the tested source/launcher head; the final head changes only the receipt and README summary.
Evidence reviewed 5 items Current-main baseline still uses untyped classifier results: Current main calls the classifier, asserts accepted item decisions, and casts accepted comment decisions to any; the proposed phase therefore is not already implemented on main.
Real behavior proof receipt: The committed receipt records two Docker-backed local Worker comparisons of four signed webhook deliveries with zero differences, two successful dashboard builds, and a clean checkout before and after each run.
Proof harness scope: The harness starts merge-base and head Workers through Wrangler, sends signed issue-comment, issue, pull-request, and unsupported-event payloads, and deep-compares their HTTP outcomes.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - Webhook classification feeds queue admission and command dispatch; the proof compares four signed synthetic event paths but does not exercise live GitHub API calls.
  • Resolve merge risk (P1) - The local partial clone could not materialize the proposed dashboard Worker blob, so independent line-by-line inspection of that file is limited to the supplied diff context.
  • Complete next step (P2) - No mechanical repair is identified; this needs only the in-progress check and ordinary maintainer landing review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change distribution Worker +179/-17, compile-time fixture +17, proof/docs +552 Most of the 748 added lines document and preserve behavior evidence rather than alter webhook runtime logic.
Runtime comparison 4 signed event paths × 2 successful runs, 0 differences The proof directly compares merge-base and implementation Worker HTTP outputs at the ingress boundary.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1128
Summary: This PR explicitly implements phase 1 of the canonical dashboard strict-mode migration plan.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the bounded ingress risk (recommended)
    After the in-progress check completes on this head, accept the constrained automation risk supported by the two-run Worker comparison proof.

Technical review

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

Labels

Label justifications:

  • P3: This is a scoped internal typing and proof improvement with no intended user-visible policy change.
  • merge-risk: 🚨 automation: The touched classifier controls hosted webhook admission, queueing, and command dispatch even though the submitted proof shows unchanged outcomes.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The committed Crabbox receipt records two successful real local Worker HTTP comparisons at the tested source/launcher head; the final head changes only the receipt and README summary.
  • proof: sufficient: Contributor real behavior proof is sufficient. The committed Crabbox receipt records two successful real local Worker HTTP comparisons at the tested source/launcher head; the final head changes only the receipt and README summary.

Evidence

What I checked:

  • Current-main baseline still uses untyped classifier results: Current main calls the classifier, asserts accepted item decisions, and casts accepted comment decisions to any; the proposed phase therefore is not already implemented on main. (dashboard/worker.ts:1385, 408c28329c18)
  • Real behavior proof receipt: The committed receipt records two Docker-backed local Worker comparisons of four signed webhook deliveries with zero differences, two successful dashboard builds, and a clean checkout before and after each run. (docs/proof/typed-webhook-ingress/container-receipt.json:1, afa21cd96c47)
  • Proof harness scope: The harness starts merge-base and head Workers through Wrangler, sends signed issue-comment, issue, pull-request, and unsupported-event payloads, and deep-compares their HTTP outcomes. (docs/proof/typed-webhook-ingress/run-proof.mjs:1, afa21cd96c47)
  • Recent dashboard ownership history: Recent dashboard Worker refactors and the GitHub App authentication consolidation were authored by Peter Steinberger, making this the strongest current-main routing path. (dashboard/worker.ts:1385, 27d0dca68158)
  • Local inspection limitation: The partial clone contains the PR commit and proof blobs but could not materialize the proposed Worker blob because its promisor remote was DNS-unreachable; no source-level defect was inferred from that limitation. (dashboard/worker.ts, afa21cd96c47)

Likely related people:

  • Peter Steinberger: Recent current-main history includes the dashboard Worker refactor and GitHub App authentication work that surround this ingress path. (role: recent dashboard and webhook-area contributor; confidence: high; commits: 27d0dca68158, 5a964dadc813; files: dashboard/worker.ts)
  • Martin Cleary: Recent dashboard history includes Bay and operational telemetry work adjacent to the annotated journey-trigger path. (role: adjacent dashboard telemetry contributor; confidence: medium; commits: 51ac499c741b, f9a2f9493c2d; files: dashboard/worker.ts)

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-12T05:09:10.082Z sha 8a4ec7c :: needs changes before merge. :: [P2] Keep routine proof output out of the tracked docs tree
  • reviewed 2026-08-12T05:12:51.083Z sha 8a4ec7c :: needs changes before merge. :: [P2] Default proof output outside the tracked docs tree
  • reviewed 2026-08-12T05:22:35.021Z sha a7e4e37 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. label Aug 12, 2026
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. proof: sufficient Contributor real behavior proof is sufficient. labels Aug 12, 2026
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 12, 2026
@steipete
steipete merged commit a179597 into main Aug 12, 2026
19 checks passed
@steipete
steipete deleted the steipete/typed-webhook-ingress branch August 12, 2026 05:55
steipete added a commit that referenced this pull request Aug 12, 2026
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.
steipete added a commit that referenced this pull request Aug 14, 2026
…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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant