Repository navigation
feat(cli): --webhook-receiver flag so expect_webhook* steps can grade - #679
Merged
Merged
Conversation
…#675) Exposes the storyboard runner's existing `webhook_receiver` option on the CLI. Without this, `webhook-emission` and `idempotency` storyboards skipped their webhook-assertion steps with "Test-kit contract 'webhook_receiver_runner' is not configured on this runner" even when agents emitted fully spec-compliant signed RFC 9421 webhooks. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…vector 027 Upstream `latest.tgz` published vector 027-webhook-registration-authentication-unsigned between main's last CI run and this PR's. CI's "Validate generated files are in sync" step regenerates against current upstream, so the branch has to carry the regen. - Regenerate core.generated.ts, tools.generated.ts, schemas.generated.ts - Move CatalogAction / CatalogItemStatus re-exports: the generator placed them in core.generated.ts, not tools.generated.ts - Register a passthrough mutation for vector 027 (same pattern as 021-026) - Extend NEGATIVE_VECTORS_UNIMPLEMENTED in request-signing-vectors.test.js - Bump hardcoded vector counts 26 → 27 in grader + runner-integration tests - Skip vector 027 in grader-e2e + grader-mcp (the reference verifier hasn't implemented the "unsigned webhook registration with authentication" rejection yet — tracked in the same follow-up as 021-026's skip rationale) Unrelated to the #679 CLI change but required to unblock this PR's CI. Also catches main up to current upstream. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley
added a commit
that referenced
this pull request
Apr 21, 2026
…rendezvous Design proposal responding to client feedback that webhook grading requires a public IP. Rejects socket mode (breaks conformance parity with production HTTP emitter) and ngrok-bundling (vendor lock + test-kit forbids it). Proposes a --webhook-receiver-auto-tunnel flag as a short-term fix and an AdCP-hosted rendezvous service as the long-term answer. Follow-up to PR #679. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
7 tasks
…iver-cli # Conflicts: # src/lib/testing/storyboard/request-signing/builder.ts # src/lib/types/core.generated.ts # src/lib/types/schemas.generated.ts # test/request-signing-grader-e2e.test.js # test/request-signing-grader-mcp.test.js # test/request-signing-vectors.test.js
bokelley
added a commit
that referenced
this pull request
Apr 21, 2026
…rendezvous Design proposal responding to client feedback that webhook grading requires a public IP. Rejects socket mode (breaks conformance parity with production HTTP emitter) and ngrok-bundling (vendor lock + test-kit forbids it). Proposes a --webhook-receiver-auto-tunnel flag as a short-term fix and an AdCP-hosted rendezvous service as the long-term answer. Follow-up to PR #679. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley
added a commit
that referenced
this pull request
Apr 21, 2026
* docs(proposals): webhook-grading reachability — tunnel vs sockets vs rendezvous Design proposal responding to client feedback that webhook grading requires a public IP. Rejects socket mode (breaks conformance parity with production HTTP emitter) and ngrok-bundling (vendor lock + test-kit forbids it). Proposes a --webhook-receiver-auto-tunnel flag as a short-term fix and an AdCP-hosted rendezvous service as the long-term answer. Follow-up to PR #679. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(cli): --webhook-receiver-auto-tunnel for remote-agent grading Autodetect ngrok/cloudflared on PATH, spawn the tunnel pointed at the webhook receiver port, extract its public URL, and plumb it into proxy mode. Cleans up on exit (including SIGINT/SIGTERM). HTTP on the wire — the webhook_receiver_runner parity invariant (loopback_mock ≡ proxy_url) is preserved. ADCP_WEBHOOK_TUNNEL="<cmd> {port}" overrides detection with a custom tunnel, which keeps the CLI vendor-agnostic per the test-kit's "MUST NOT require a specific tunnel vendor" rule and doubles as the hook for the test suite to stub a fake tunnel binary. Conflict validation (public-url, loopback, multi-pass strategy) runs before the dry-run gate so flag misuse fails fast; actual tunnel spawn is deferred past dry-run to avoid wasting startup cost on previews. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(proposals): trim reachability doc, link rendezvous to spec-repo issue Option A (auto-tunnel helper) is shipping in the companion commit on this branch. Option B (hosted rendezvous) is a spec-stewardship initiative with hosting, operational, and abuse-prevention commitments that belong in the adcp spec repo, not as an in-repo RFC — now tracked at adcontextprotocol/adcp#2618 (milestone 3.1.0). Keeps the Socket Mode and ngrok-bundling rejection arguments in place since they're the load-bearing reason the CLI is shaped the way it is. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(cli): auto-tunnel review fixes — URL marker, persistent cleanup, stricter conflict Three substantive fixes from the expert reviews: 1. URL-capture scoping. ngrok regex now pins to known vendor domains (*.ngrok-free.app, *.ngrok.io, *.ngrok.dev, *.ngrok.app) instead of matching any `url=<https://…>` field, so a stray diagnostics URL in startup logs can't be mistaken for the forwarding URL. Custom templates now require an explicit `ADCP_TUNNEL_URL=<https://…>` marker on stdout/stderr — the "first https:// URL" heuristic wired tunnel destinations to docs links whenever the binary logged one at startup. 2. Persistent signal handlers. `process.once` on SIGINT/SIGTERM meant a second Ctrl-C bypassed tunnel cleanup and leaked listeners. Replaced with module-level handlers installed lazily on first tunnel spawn, backed by a shared child set, with a SIGTERM → SIGKILL grace period so tunnels that ignore TERM still get reaped. 3. Unified --webhook-receiver conflict. validateAutoTunnelArgs previously only rejected explicit `--webhook-receiver loopback`; a bare `--webhook-receiver` silently resolved to loopback_mock and was then overwritten by proxy_url, hiding operator intent. Now rejects any `--webhook-receiver` form alongside auto-tunnel with a single clear message (auto-tunnel always implies proxy mode). Smaller fixes: - ADCP_WEBHOOK_TUNNEL_TIMEOUT_MS validates via Number.isFinite + positive check; invalid/zero values warn and fall back to 15000 instead of silently swallowing garbage. - runCli gains a timeout + SIGKILL on spawnSync so a regression where URL capture succeeds but the run hangs fails the test instead of stalling CI. - New test: custom template ignores a bystander URL printed before the marker (regression for the "first https:// wins" class of bugs). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs: drop in-repo webhook-reachability proposal Same reasoning as the rendezvous RFC: design docs drift and don't belong in the repo. The PR description captures the "why" durably (Socket Mode rejection, ngrok-bundling rejection, auto-tunnel selection) and the changeset now links straight to the rendezvous issue instead of routing through a deleted file. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(cli): auto-tunnel E2E fixes — ngrok regex + SIGKILL escalation Found two issues when running against a real ngrok binary: 1. ngrok regex missed the live `.ngrok-free.dev` domain. The previous fix-commit vendor-domain allowlist (.ngrok-free.app, .ngrok.io, .ngrok.dev, .ngrok.app) excluded `.ngrok-free.dev`, which is ngrok's current free-tier subdomain after a mid-2024 migration. Rather than chase the vendor-domain list, anchor on the stable `msg="started tunnel"` log line ngrok emits exactly once per tunnel creation — the URL in its `url=` field is authoritative by definition, and the scoping still blocks stray `url=` fields elsewhere in the log stream from being mistaken for the forwarding URL. 2. SIGKILL escalation was dead code. `reapTunnelChildren` scheduled a `setTimeout` for the force-kill, but Node doesn't run timers after the `'exit'` event fires, and the SIGINT/SIGTERM handlers called `process.exit` synchronously right after `reapTunnelChildren` — cancelling the timer before it could fire. A tunnel that ignored TERM would never see KILL. Split the paths: `'exit'` sends TERM only (best-effort, OS reaps strays); SIGINT/SIGTERM send TERM, schedule a 250ms `setTimeout` that SIGKILLs survivors and calls `process.exit`. Also guard against a second signal during the escalation window by SIGKILLing immediately on the repeat. Verified end-to-end against real ngrok 3.37.3: URL captured, storyboard ran, no zombie tunnel processes after exit. Plus small fixes: help-text clarifies the custom-template marker contract ("first match wins"). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(cli): auto-tunnel — chunk-boundary buffer + cleanup polish Code-review finding: the per-chunk regex scan could miss the ngrok URL if ngrok's "started tunnel" logfmt line split across two `data` events. Anchoring on the head of the line (`msg="started tunnel"` … `url=…`) made line fragmentation a real failure mode where the prior vendor-domain-anchor version was immune. Scan a rolling 16 KiB buffer across chunks instead of each chunk in isolation. Security-review finding (low): the SIGKILL escalation only signals the direct child, so `ADCP_WEBHOOK_TUNNEL="sh -c 'ngrok …'"` would leave a grandchild behind. Documented the constraint in the --help text rather than adopting detached/PGID spawn semantics — the reviewer's pragmatic call, and ngrok/cloudflared direct paths are unaffected. Two nit-level cleanups: explicit `return` after `process.exit` in the second-signal branch (defensive against refactors that swap exit for something softer) and split the "why we don't unref the timer" comment into its two separate mechanisms. Verified end-to-end against real ngrok (ngrok-free.dev URL captured, storyboard ran, no zombie processes). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #675. Exposes the storyboard runner's existing
webhook_receiveroption onadcp storyboard run/adcp comply. Without this,webhook-emissionandidempotencystoryboards skipped their webhook-assertion steps with"Test-kit contract 'webhook_receiver_runner' is not configured on this runner"even when agents emitted fully spec-compliant signed RFC 9421 webhooks.Three new flags (parsed once, plumbed through single-file, full-assessment via
comply(), and multi-instance run paths):--webhook-receiver [MODE]— MODE isloopback(default, 127.0.0.1) orproxy(operator-supplied public URL)--webhook-receiver-port PORT— force bind port, defaults to auto-assign--webhook-receiver-public-url URL— public HTTPS base for proxy mode, impliesproxywhen used aloneSetting any of these activates the receiver and adds
webhook_receiver_runnerto the run'scontractssorequires_contractgates resolve. Also exposed onComplyOptions(webhook_receiver,contracts) so programmatic callers ofcomply()get the same behavior.CLI guards fail loudly up front for common footguns: proxy without public URL, loopback with public URL, non-integer or out-of-range ports, and
--webhook-receivercombined with--multi-instance-strategy multi-pass(receiver URL is per-pass, agents caching pass-1 URLs would deliver to a dead port in pass 2).Test plan
node --test test/lib/cli-webhook-receiver-flag.test.js test/lib/cli-storyboard-file-flag.test.js test/lib/cli-multi-instance-strategy.test.js test/lib/storyboard-webhook-receiver.test.js— 52/52 passnpm run build+tsc --noEmit— cleantest-mcp webhook-emission --webhook-receiver— receiver boots, steps execute and grade real behavior (failno_webhook_receivedbecause the public test agent doesn't emit webhooks, which is the correct signal — before this change they skipped with the contract-not-configured reason)idempotency_keypresence + retry-stability grades pass🤖 Generated with Claude Code