Skip to content

feat(service): one webhook router verifies each provider its own way, parses a typed payload and delivers each event only to the consumers subscribed to it #1386

Closed

Description

@dan-petty

Refreshed plan (2026-10-17, unblocking review)

This section supersedes any text below that conflicts with it.

Decisions

Scope

Delivery

  • One pull request, size M, with Fixes #1386. It is smaller than the body's design: no push routing, no new worker mode and no second verifier.

Acceptance criteria
These body criteria stand unchanged:

The criteria below replace the body's criteria of the same name.

  • Receiver design table. Each extension lands with its first production user:
Extension Added by
HmacSha256, application/json bodies, delivery through ServiceManager.enqueue_trigger to today's lane workers this item
AuthorizationToken(scheme), exactly as the body describes it (get_authorization_scheme_param, scheme match, secrets.compare_digest, 401 for a missing header, another scheme or a wrong token, 401 for every request plus one start-up warning when no token is configured) #1395 (Token)
consumers that take validated payloads #1533's Service-dispatch half
default-branch push routing; a consumer's own worker or a shared worker #1389's cluster lane (an Argo WorkflowTemplate under a mutex; its push trigger after #1535's router step)
per-provider content types (application/x-www-form-urlencoded) and the synchronous responder #1395
delivery as a Workflow submit; DeliveryLRUCache deleted #1535 step 3
  • Typed payloads.
    • GitHub payloads validate into pydantic v2 models in src/devops_cli/models/webhooks.py. Every event validates into a base model, and issues, pull_request, milestone and release have their own.
    • The models use extra="ignore" and declare only action, repository.full_name and sender.login.
    • A body that fails validation gets 400 with the failing field's path, capped at 256 characters (AGENTS.md:36).
    • No .get on a webhook payload remains under src/devops_cli/server/ (today at webhooks.py:144-145, :173-174 and :231). The WebSocket request read at src/devops_cli/server/routes/stream.py:97 is not a webhook payload and is outside this item.
  • Consumers subscribe.
    • A consumer is a declaration with a name, the provider events it takes (optionally narrowed by a predicate on the typed payload), whether it takes the poll tick, and its delivery target.
    • The roadmap consumer's target is ServiceManager.enqueue_trigger.
    • RepoWorker, its coalescing and drain, RoundPause and the {repo, lane} series are unchanged, and none gains a consumer label.
  • The roadmap consumer takes only what its jobs read.
    • It takes issues, pull_request, milestone and release, plus the poll tick, and each reaches both lanes as today.
    • Its TriggerBatch keys stay ("webhook", <event>, <action>) and ("poll", "", ""), so the intake, closure and reprioritize batch keys (constants.py:2289-2300) still match.
    • The machine-account filter (webhooks.py:172-176) becomes this consumer's predicate.
  • Unsubscribed events. Every push, issue_comment and create, and any other event no consumer takes, gets 200 {"status": "no_subscriber"} and enqueues nothing on either lane.
  • Each delivery is logged and counted.
    • Every request that reaches verification writes one INFO record with provider, event, action, delivery, repo and outcome. It never includes the body, the signature or an Authorization header value.
    • devops_cli_service_webhook_deliveries_total gains provider and event labels and the outcome no_subscriber. Events the models don't declare count as other.
    • CONTEXT_LOG_KEYS (json_logs.py:13-23) gains only provider. The consumer key comes with feat(rag): Index managed repos, exclude private from unscoped search #1389's cluster lane.
  • The decision is recorded as an ADR under the next free number in docs/adr/ at merge time, with every link updated.
  • The setup step matches. k8s/README.md:372 (step 8) already lists Issues, Pull requests, Milestones and Releases. Its last sentence changes to say that events without a subscriber, pushes included, are acknowledged and start no round, so a hook that sends every event or only pushes is harmless. feat(rag): Index managed repos, exclude private from unscoped search #1389's cluster lane adds Pushes to the step if it subscribes to them.
  • Tests, in tests/test_server_service.py, through the app and the workers' public methods:
    • every existing case passes, changed only where it names the route or the machine-account rule's new place;
    • an undeclared provider gets 404;
    • an issue_comment, a create and a default-branch push each get no_subscriber and enqueue nothing on either lane's worker;
    • an issues delivery reaches both lanes' workers as ("webhook", "issues", <action>), and one sent by the machine account reaches neither;
    • a consumer declared in the test, with a recording delivery target, receives only the events it subscribes to;
    • a payload without repository.full_name gets 400 naming the field, capped at 256 characters;
    • one delivery writes one record with the six keys and no body, signature or Authorization value;
    • no test reaches the network, each call phase stays under 1 s (--durations=0), and no new test patches a devops-cli name (test(cli): tests double only process edges and mirror the source tree #1307).
  • Pending a person, once the Service runs again (after chore(service): the roadmap service stays at 0 replicas, and its development is blocked, while its machine account is suspended #1562's revert, which needs D2's App identity or a reinstatement): the body's redelivery checks. That is one issues and one issue_comment delivery, Loki holding an accepted and a no_subscriber record, and the counter counting each under its event.

Current references (checked at 3dd7fa6)

  • src/devops_cli/server/routes/webhooks.py:
    • :35-50: the HMAC check;
    • :52-69: DeliveryLRUCache;
    • :72-90: the body cap;
    • :93-112: content type and headers;
    • :115-159: the per-repository secret loop and parse;
    • :144-145, :173-174 and :231: the .get reads on the payload;
    • :172-176: the machine-account filter;
    • :184-247: the router, with its only route at :188 and the enqueue call at :232-237.
  • src/devops_cli/server/service.py:
    • :45-53: TriggerBatch;
    • :130-307: RepoWorker, one per repository and lane, with labels at :144, the thread name at :161 and _execute_batch at :235-280;
    • :350-368: the tick and poll;
    • :370-376: enqueue_trigger on every lane;
    • :418-433: the secrets fallback, with except Exception: at :431;
    • :436-444: _warn_missing_secrets.
  • src/devops_cli/commands/serve.py:62-81: the command's secrets parser.
  • src/devops_cli/roadmap/run.py:
    • :657-704: the lane rows and DEFAULT_DUE_TABLE;
    • :946-954: any non-empty batch reads changes;
    • :1035-1042: SERVICE_JOBS.
  • src/devops_cli/config/constants.py:
    • :1053: the body cap;
    • :1058: the deliveries counter;
    • :1070-1072: the lanes;
    • :2289-2300: the batch keys, with milestone/closed and release/published already included.
  • src/devops_cli/server/json_logs.py:13-23: CONTEXT_LOG_KEYS.
  • tests/test_server_service.py:583: the strict-routes test.
  • tests/test_k8s_roadmap_service.py:158 and k8s/devops/roadmap-service/ingress.yaml:17: the public path.
  • k8s/devops/roadmap-service/networkpolicy.yaml:26-33: the monitoring namespace reaches port 8000.
  • k8s/devops/roadmap-service/deployment.yaml:10-12: replicas: 0.
  • k8s/README.md:363: the suspension note.
  • k8s/README.md:372: the webhook step.
  • AGENTS.md:147-151: the suspension rules.

Dependencies and order


Problem

The roadmap Service (devops serve --service, deployment k8s/devops/roadmap-service) has one webhook route, built for one sender and one consumer. Requests from 2026-10-08 need more than that: #1389 re-ingests each managed repository's default branch into RAG when it changes, and #1395 answers a Mattermost slash command inside the cluster. #1387 adds Argo CD as a sender.

One sender, one consumer

  • The route is GitHub's alone. It is POST /webhooks/github (src/devops_cli/server/routes/webhooks.py:188-245).
    • Every request needs X-GitHub-Event and X-GitHub-Delivery (:93-112) and a sha256= HMAC (:35-50).
    • The HMAC is checked against each managed repository's secret in turn (:124-130).
  • The payload is never typed. It stays a dict[str, Any] (:133-142).
    • repository.full_name, sender.login and action are read with .get chains (:144-145, :173-174, :231).
    • So a renamed or missing field becomes an empty string or a 401, never a validation error.
  • Every event has one destination. Every accepted delivery goes to ServiceManager.enqueue_trigger (src/devops_cli/server/service.py:279-285), into the repository's one RepoWorker (:243-245). That worker's only job is service_job (src/devops_cli/commands/serve.py:141-149).
  • A worker can carry neither a payload nor a second consumer.
    • RepoWorker.enqueue takes only (source, event, action) (service.py:93-105), and TriggerBatch holds only those counts and two timestamps (:42-50). No payload reaches a job.
    • The thread name, the span name, the queue-depth and job-start gauges and the two job counters carry the repository alone (:88, :103, :150, :159, :164, :190, :194). A second worker for the same repository would overwrite the first one's gauges and merge its counts.

Events no job reads still cost a roadmap round

  • The hooks send more than the README lists. Step 9 of the Roadmap service setup (k8s/README.md:354) asks for Issues, Pull requests and Milestones. On 2026-10-08, of the 8 repositories in service.repos, 3 hooks (this repository's included) sent every event (*) and 5 sent only push. None used the README's set.
  • Each accepted delivery joins a roadmap round. This repository's last 100 deliveries (from 00:35 UTC on 2026-10-08) were 65 issues, 32 issue_comment, 1 create, 1 milestone and 1 push. 90 were accepted and 10 ignored. Every push to the 5 push-only repositories is accepted too.
  • A round reads GitHub whatever the event. service_job opens the roadmap (src/devops_cli/roadmap/run.py:870), and any non-empty batch reads changes (:820). A webhook key then skips the idle return (:821-823), so the current release is read (:827-828) and every job's due check runs.

No record of what arrived

  • Only uvicorn's access line is logged. It holds the path and the status code (uvicorn.access, routed to the JSON formatter at src/devops_cli/server/json_logs.py:74).
  • The delivery counter can't tell deliveries apart. devops_cli_service_webhook_deliveries_total carries only outcome (webhooks.py:190-240).
    • From the pod's start at 23:48 UTC on 2026-10-07 to 02:31 UTC on 2026-10-08, it counted 203 accepted and 7 ignored.
    • Nothing says which event, repository or sender each one was.

Which integrations can push events, and which the Service should take

Integration How it can push Authentication it offers Endpoint Reason
GitHub repository webhooks, today (3 of the 8 managed hooks send every event, 5 only push) HMAC-SHA256 in X-Hub-Signature-256, one secret per repository (service.webhook_secrets) moves onto the router (this item) Roadmap triggers today. Default-branch pushes for RAG ingestion (#1389), and releases for #1360.
Argo CD notifications controller, disabled (k8s/argocd/values.yaml:84-85) request headers that reference its Secret; no signature #1387, in-cluster The Service records deploys in GitHub as the machine account. Argo CD's own GitHub notifier needs a GitHub App.
Mattermost (#1390) outgoing webhooks and slash commands a per-command token, sent as Authorization: Token <token>; no signature #1395, in-cluster A read-only /roadmap status command, answered in the request. Alerts, deploys and release posts go to Mattermost directly, not through the Service.
Alertmanager v0.34.1 its webhook receiver posts to the URL in Secret alertmanager-webhook, which by design doesn't exist until a channel is chosen (k8s/monitoring/prometheus-values.yaml:35-40). All 65 webhook notifications since the pod started on 2026-10-03 failed, including a critical NodeNotReady in the last 7 days. bearer token from a file (http_config.authorization.credentials_file); no signature not now It has its own Mattermost receiver (mattermost_configs; the running Alertmanager already exports alertmanager_notifications_total{integration="mattermost"}), and no Service job acts on an alert. #1392 uses it to post alerts to chat.
Gitea (#1081) repository webhooks, once deployed X-Gitea-Signature, plus GitHub-compatible X-Hub-Signature-256, X-GitHub-Event and X-GitHub-Delivery; an optional Authorization header later Nothing consumes Gitea events yet: Argo CD polls it (#1082, #1291). It would reuse the HMAC verifier, with its own secrets, over Service DNS.
Grafana alerting webhook contact point with optional HMAC HMAC-SHA256 header no Grafana has no Grafana-managed alert rules (0 on 2026-10-08). The rules live in Prometheus and route through Alertmanager, and k8s/monitoring/grafana-values.yaml:86 keeps any Grafana-managed alert out of that Alertmanager.
Cloudflare Notifications webhooks shared secret in cf-webhook-auth; no signature no A tunnel alert would arrive through the tunnel it reports on. Published GitHub and Cloudflare status is already polled every 15 minutes by the roadmap metrics job (src/devops_cli/config/defaults.py:801, src/devops_cli/roadmap/run.py:487-499; added by #1235). A second public path would need another Access bypass and break ADR 0003's single path.
LLM gateway (LiteLLM) budget webhooks (beta) and Slack-format alerts none no Budgets need a database, and the gateway runs without one (k8s/llm/gateway/configmap.yaml). Its failures are already Prometheus series (:169). Its Slack-format alerts can go to Mattermost directly.
Statuspage (GitHub, Cloudflare status) webhook subscriptions none; each subscription asks for an email address no Unsigned, and the address is personal data. Polled instead (row above).
Prometheus rules through Alertmanager none of its own no As for Alertmanager.
Qdrant, Valkey, the OpenTelemetry collector no outbound events none no Nothing to receive.
In-cluster registry the registry's notification endpoints static headers no Nothing consumes image pushes, and #1082 moves images to Gitea.

Acceptance criteria

The receiver design. This item builds the one receiver for every inbound endpoint of the Service; later items extend it instead of adding routes. A provider declares its verifier, its content type, where its event name, action, delivery id and subject come from, its payload models, its rules and its exposure. A consumer declares the events it takes, whether it takes the poll tick, its job and its worker mode. Each extension lands with its first production user, so the router ships no code that nothing calls:

Extension Added by
HmacSha256 verifier, application/json bodies, one coalescing worker per consumer and subject this item
AuthorizationToken(scheme) verifier: the header is split with FastAPI's get_authorization_scheme_param, the scheme must match, and the token is compared with secrets.compare_digest. A missing header, another scheme or a wrong token gets 401. With no token configured, every request gets 401, and the Service logs one warning at start naming the setting the first of #1387 (Bearer) and #1395 (Token) to land; the other reuses it
consumers that take validated payloads #1387
one shared worker for a consumer, whose batch carries the subjects that became due #1389
per-provider content types (application/x-www-form-urlencoded), and a provider answered in the request by a synchronous responder instead of consumers #1395
  • One route per declared provider. Providers are a registry keyed by a StrEnum in src/devops_cli/config/constants.py, holding github.

    • create_webhook_router registers POST /webhooks/<provider> for each declared provider. An undeclared provider gets 404 from routing. (An enum path parameter would answer 422 with fastapi 0.142.2.)
    • test_service_app_strict_routes (tests/test_server_service.py:557) also asserts that POST /webhooks/<undeclared> gets 404, and that the app serves exactly /readyz, /healthz, /metrics and /webhooks/<provider> for each declared provider.
  • A provider is a declaration, not a copy of the route. A frozen model per provider names:

    • its verifier;
    • where its event name, action, delivery id and subject come from;
    • its payload models;
    • its rules;
    • its exposure, tunnel or cluster.

    The route takes the same steps for each provider: it refuses while draining (503), requires the provider's content type (application/json for every provider in this item), caps the body at CONST_SERVICE_MAX_BODY_BYTES, verifies, parses, applies the provider's rules, drops a repeated delivery id and delivers.

  • An HMAC verifier from the standard library. HmacSha256 takes a header name, an optional prefix and a secret per subject, and checks with hmac.new and hmac.compare_digest.

    • GitHub's check (webhooks.py:35-50, :115-159) moves into it unchanged.
    • A provider with no secret configured refuses every request with 401. The Service logs one warning at start naming the setting, as _warn_missing_secrets does for a repository (service.py:343-351).
    • The AuthorizationToken verifier comes with its first user (the receiver design above).
  • Typed payloads. GitHub payloads validate into pydantic v2 models in src/devops_cli/models/webhooks.py.

    • Every event validates into a base model. The events a consumer reads (issues, pull_request, milestone, release and push) have their own.
    • The models use extra="ignore" and declare only the fields read: action, repository.full_name, repository.default_branch and sender.login. push adds ref and deleted.
    • A body that fails validation gets 400 with the failing field's path, capped at 256 characters (AGENTS.md:40).
    • No .get on a payload remains under src/devops_cli/server/.
  • Consumers subscribe.

    • A consumer is a declaration: a name, the provider events it takes (optionally narrowed by action or by a predicate on the typed payload), whether it takes the poll tick, and its job.
    • Workers are keyed by consumer and subject. Each is a RepoWorker with its coalescing and drain unchanged, so a long RAG ingestion never waits behind a roadmap round, and a round never waits behind an ingestion.
    • The worker's thread name, span name and span attributes carry the consumer. devops_cli_service_queue_depth, devops_cli_service_job_start_timestamp_seconds, devops_cli_service_jobs_total and devops_cli_service_job_seconds_total gain a consumer label, bounded by the declared consumers. No dashboard or rule under k8s/ reads these series today.
  • The roadmap consumer takes only what its jobs read.

  • Pushes and unsubscribed events.

    • A push whose ref is the repository's default branch and whose deleted is false reaches every consumer subscribed to pushes, as a ("webhook", "push", "") key in that consumer's next batch. No consumer in this item takes pushes; feat(rag): Index managed repos, exclude private from unscoped search #1389 adds the first.
    • Any other push, and any event with no subscriber (issue_comment and create included), gets 200 {"status": "no_subscriber"} and runs nothing.
  • GitHub's own rules stay with the GitHub provider. ping still gets pong, and repeated delivery ids are still dropped through DeliveryLRUCache.

  • Each delivery is logged and counted.

    • Every request that reaches verification writes one INFO record with provider, event, action, delivery, repo and outcome. It never includes the body, the signature or an Authorization header value.
    • devops_cli_service_webhook_deliveries_total gains provider and event labels, plus the outcome no_subscriber. Events that the provider's models don't declare count as other, so the label set stays bounded.
    • CONTEXT_LOG_KEYS gains provider and consumer.
  • Exposure is pinned. tests/test_k8s_roadmap_service.py checks that the roadmap-service Ingress routes exactly /webhooks/<provider> for the providers marked tunnel.

    • Today that is only /webhooks/github (k8s/devops/roadmap-service/ingress.yaml:17, checked today at tests/test_k8s_roadmap_service.py:158).
    • A cluster provider is reached only at http://roadmap-service.devops.svc.cluster.local:8000/webhooks/<provider>.
  • The decision is recorded as an ADR under the next free number in docs/adr/ at merge time, with every link updated. (0005 is claimed by docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308 and by feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137 for feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines #1138.) It says:

  • The setup steps match. k8s/README.md (Roadmap service, step 9) lists Issues, Pull requests, Milestones and Releases, and says Pushes are needed once a consumer takes them. It also says that a hook sending every event, or only pushes, is harmless: events without a subscriber are acknowledged and start no round.

  • Tests, in tests/test_server_service.py, through the app and the worker's public methods:

    • every existing case passes, changed only where it names the route or the machine-account rule's new place;
    • an undeclared provider gets 404;
    • an issue_comment, a create and a default-branch push each get no_subscriber and enqueue nothing for the roadmap worker;
    • with a push consumer declared in the test:
      • a default-branch push reaches its worker and not the roadmap worker;
      • a push to another branch, and a branch deletion, reach no consumer;
      • a default-branch push sent by the machine account still reaches it;
    • two consumers' workers for one repository report separate devops_cli_service_jobs_total and devops_cli_service_queue_depth series;
    • a payload without repository.full_name gets 400;
    • one delivery writes one record with the six keys.

    No test reaches the network, each call phase stays under 1 s (--durations=0), and no new test patches a devops-cli name (test(cli): tests double only process edges and mirror the source tree #1307).

  • uv run devops ci passes within its 5-minute budget.

  • A changelog.d/<n>.md fragment exists, and CHANGELOG.md and docs/ROADMAP.md are untouched.

  • Pending a person, after merge, once the Service runs a release that contains this:

    • redeliver one recent issues delivery and one issue_comment delivery from this repository's webhook settings;
    • check that Loki holds a record for each ({namespace="devops"} | json | provider="github"), the first accepted and the second no_subscriber;
    • check that devops_cli_service_webhook_deliveries_total{provider="github"} counts each under its event.

Key questions

Strategic alignment

Activity

  1. added
    type/feature
    scope/security
    scope/telemetry
    scope/github
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. It unblocks #1389, #1395, and #1387 but the current single-provider, single-consumer path still works for the existing roadmap job.
    • Value: High. It is the shared routing layer that three open features depend on and eliminates wasted roadmap rounds from unhandled events.
    • Effort: High. It requires redesigning verification per provider, introducing typed payload models, building a subscription/dispatch mechanism, and updating the worker and metrics infrastructure.
  3. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Linked: #1387, #1389 and #1395 build on this item's router; #1387 and #1395 share the AuthorizationToken verifier whichever lands first adds. Found by the 2026-10-08 backlog review.

  4. dan-petty commented on Oct 9, 2026

    @dan-petty
    OwnerAuthor

    Finding: v0.2.29 Service gap assessment (2026-10-09)

    Measured on the devops-cli hook over 3 days: 9,648 deliveries, 9,269 answered 202, only 221 carrying a batch key; the top accepted events were workflow_job (2,446), check_run (2,288) and workflow_run (1,287). Each accepted delivery starts a full round, so during CI rounds ran about 4x as often as polling needs. Of the 8 managed repositories' hooks, 3 subscribe to * and 5 only to push, so those 5 never deliver a close, intake or reprioritize hint.

    The simplest fix is a settings change, no code: subscribe every hook to issues, pull_request, milestone and release (and add Releases to k8s/README.md step 8). Optional first criterion here: the route answers 200 "ignored" to any (event, action) no batch key names.

  5. dan-petty commented on Oct 9, 2026

    @dan-petty
    OwnerAuthor

    Owner direction (2026-10-09): consumers declare schedules beside their events

    The Service must manage both event-driven triggers and scheduled tasks (see #1533's ADR). One addition to this item's design, so the consumers it routes to don't each grow their own timer loop:

  6. dan-petty commented on Oct 9, 2026

    @dan-petty
    OwnerAuthor

    The owner chose Argo Workflows as the Service's engine on 2026-10-09 (#1535). That changes this item's delivery step. A consumer declares its events, its schedules (as CronWorkflows) and its lane. The router delivers an event by creating a Workflow named from the delivery ID before it returns 2xx, so it needs no dispatch queue, threads or retries of its own. The full mapping is in #1535's migration table.

  7. added
    status/blocked
    on Oct 11, 2026
  8. dan-petty commented on Oct 11, 2026

    @dan-petty
    OwnerAuthor

    Blocked by #1562: the roadmap Service's machine account is suspended, and the Service is held at 0 replicas. This item develops the Service or can only be checked on it, so it waits until the account is reinstated or the jobs act as a GitHub App.


    Generated by Claude Code

  9. added this to the v0.2.38 milestone on Oct 17, 2026
  10. added
    priority/p0-critical
    on Oct 18, 2026
  11. modified the milestones: v0.2.38, v0.2.39 on Oct 21, 2026
  12. added
    status/in-progress
    and removed
    status/blocked
    on Oct 22, 2026
  13. added a commit that references this issue on Oct 22, 2026
    e6714e5
  14. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1827, merged into release/v0.2.39 as e6714e5.

    Cause: The roadmap Service had one webhook route for one sender and one consumer. It put every accepted delivery, whatever its event, into a round of both lanes, though no roadmap job is due on a push, an issue_comment or a create. It read the payload with .get chains, so a renamed or missing field became an empty string or a 401 instead of a validation error. It wrote no record of what arrived, and its deliveries counter carried only the outcome. A signature header with non-ASCII text also made hmac.compare_digest raise TypeError, which failed the request.

    Change: One router now registers POST /webhooks/ for each member of WebhookProviderName (github today), so an undeclared provider gets 404 from routing. A provider is a frozen declaration: its verifier, the headers its event name and delivery id come from, its payload model, its ping event and its exposure (tunnel or cluster). Every request takes the same steps: drain 503, content type 415, event and delivery headers 400, body cap 413, verify 401, validate the typed payload 400, ping pong, no_subscriber, duplicate through DeliveryLRUCache, deliver. HmacSha256 (hmac.new and hmac.compare_digest, comparing bytes) replaces verify_webhook_signature and runs before the body is parsed, so a sender without a secret cannot probe the schema. GitHubWebhookPayload (models/webhooks.py, pydantic v2, extra ignore) declares only action, repository.full_name and sender.login, and a body that fails validation gets 400 naming the…

    14 file(s) changed.

    How it was verified

    Check runs at 30191bb:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • zizmor: pass
    • devops-cli: pass
    • bandit: pass
    • CodeQL: pass
    • Rule Pack Tests: pass
    • Fail-to-Pass Check: pass
    • Fail-to-Pass Self-Check: pass
    • Changed-Test Independence: pass
    • Tests & Coverage: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • Static Analysis: pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1386-webhook-router.md:

    • An undeclared provider gets 404, and the app serves exactly /readyz, /healthz, /metrics and /webhooks/<provider> for each declared provider (tests/test_server_service.py::test_service_app_strict_routes).
    • HmacSha256 verifies in constant time against each subject's secret and names the matching subjects (test_hmac_sha256_verifier_checks_the_header_digest_against_each_subjects_secret). A signature header with non-ASCII text gets 401 (test_a_signature_header_with_non_ascii_text_is_refused_with_401).
    • An issue_comment, a create, a default-branch push and a workflow_run each get 200 no_subscriber and enqueue nothing on either lane (test_an_event_no_consumer_subscribes_to_gets_no_subscriber_and_starts_no_round).
    • Each of issues, pull_request, milestone and release reaches both lanes as ("webhook", <event>, <action>) (test_the_roadmap_consumer_takes_the_events_its_jobs_read_into_both_lanes), and one sent by the machine account reaches neither and is answered ignored_machine_account (test_the_machine_accounts_own_event_reaches_neither_lane).
    • A consumer declared in the test, with a recording target, receives only the events it subscribes to (test_a_consumer_receives_only_the_events_it_subscribes_to).
    • A signed payload without repository.full_name gets 400 naming the field within 256 characters, and an unsigned one gets 401 first (test_a_payload_missing_a_field_the_service_reads_gets_400_naming_the_field, test_whole_error_text_for_a_payload_without_a_repository_name).
    • A Content-Length above the cap gets 413, writes its one record and counts once, whether it has 20, 4300, 4301 or 5000 digits, and a small number padded with zeros is judged by its value (test_a_content_length_over_the_cap_gets_413_whatever_its_number_of_digits, test_a_content_length_padded_with_zeros_is_judged_by_its_value).
    • The text of a payload's failed fields is cut to 256 characters when the fields add up to more (test_the_detail_of_an_invalid_payload_is_cut_to_the_bound_on_error_details).
    • The machine-account refusal belongs to the roadmap consumer alone: a consumer subscribed beside it receives the machine account's event, and neither lane runs a round for it (test_the_machine_accounts_event_is_refused_by_the_roadmap_consumer_alone).
    • When every consumer subscribed to an event refuses a payload, the answer carries the first declared refusal's status, and a refusal that is the empty text still refuses (test_when_every_subscribed_consumer_refuses_the_first_refusals_status_answers, test_a_consumer_whose_refusal_is_empty_text_still_refuses_the_payload).
    • One delivery writes one record with the six keys and no body, signature or Authorization value (test_one_delivery_writes_one_record_with_its_six_keys_and_no_secret). The event and delivery id are cut to 256 characters, and an undeclared event counts as other (test_header_values_in_the_record_and_the_counter_are_bounded).
    • Every path counts under provider, event and outcome: accepted, repeated, pong, machine account, no subscriber, 401, 415, 400 and 503 (test_every_path_counts_its_delivery_by_provider_event_and_outcome).
    • The Ingress routes exactly the paths of the providers marked tunnel (tests/test_k8s_roadmap_service.py::test_ingress_has_class_traefik_one_host_and_a_prefix_path_for_each_tunnel_provider). replicas: 0 stays pinned by the same file.
    • Every existing case in tests/test_server_service.py passes. The ten bulk deliveries of test_multi_concurrency_coalescing_and_multi_repo are issues events instead of push, since a push now has no subscriber, and the signature test names HmacSha256.
    • tests/test_swallowed_failures_ratchet.py passes with the ceiling for src/devops_cli/server/routes/webhooks.py lowered from 1 to 0 (pydantic's validation error replaces the broad except Exception).
    • ADR 0009, k8s/README.md step 8 and changelog.d/1386.md.
    • uv run devops ci is the pull request's gate.
    • Pending a person, once the Service runs again (after feat(service): the roadmap jobs act as a github app installation on an organization-owned board, so the service runs again without the suspended machine account #1647's GitHub App identity or a reinstatement, with each managed repository's webhook re-enabled): in the repository's webhook settings, redeliver one recent issues delivery and one issue_comment delivery, picking deliveries sent while the Service was down, since GitHub redelivers under the original delivery id and the pod answers a delivery id it already holds as duplicate. In Loki, {namespace="devops"} | json | provider="github" holds an accepted record for the first and a no_subscriber record for the second. devops_cli_service_webhook_deliveries_total{provider="github"} counts the first under event="issues" and the second under event="other".
  15. added a commit that references this issue on Oct 23, 2026
    f209f6c
  16. removed
    status/in-progress
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p0-criticalscope/githubscope/securityscope/telemetrytype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions