Skip to content

chore(service): subscribe repository hooks to pull_request and check events #6630

Open

Description

@devops-cli-service

Update 2026-11-26 (infra move): devops roadmap onboard is now devops repos onboard. The consumer already takes pull_request, review, check and comment events (#6889), and devops repos onboard <owner>/<name> --confirm --only 12 writes a wrong or missing hook (with a new secret). Left: check each hook, and the brain write for a pull request delivery.


Split from #6013.

The brain cache can write from a webhook only when each Service repository hook sends that event. The roadmap consumer already handles issues and pull_request, but a person with repository admin must add pull_request to each hook. The issue_comment, pull_request_review, check_suite, check_run, status and push events also need a consumer subscription and a hook change. devops repos onboard row 12 can write a hook. This part is deferred because a person must change each repository setting, and the core cache can ship with issues events and read-through. Acceptance criteria: A person adds pull_request to each Service repository hook. gh api repos/<owner>/<name>/hooks shows pull_request in the events of each hook. The Service receives a pull_request event and the brain cache entry updates. The check and comment events are added when their consumer subscription exists.

Proposed design

Problem statement

The Service takes the pull request and check events, but the project brain gets no entry from a pull_request delivery. Each Service repository hook must also send the events that the consumer takes. This change writes the pull request into the brain before the consumer wakes a lane. A person runs the onboard command to fix each hook after the merge.

Acceptance criteria

Requirement: The webhook row requires the pull request event

The webhook row of devops repos onboard SHALL report a hook as wrong when its events lack pull_request.

Scenario: A hook sends the issue events only

  • WHEN A test gives the row a hook with the URL, JSON content type and events issues, milestone and release.
  • THEN The row is wrong and names events.

Requirement: A pull request delivery writes the brain entry

The roadmap consumer MUST write the pull request of a pull_request delivery into the project brain before it wakes a lane.

Scenario: An opened pull request fills the entry

  • WHEN A test sends a signed pull_request delivery with action opened to the Service with fake brain and lane.
  • THEN The fake tier holds the entry under the pull request number. The fake lane records one wake after the entry exists.

Requirement: Pending a person after the merge

A person with repository admin MUST make each Service repository hook send the events that the consumer takes.

Scenario: The hook events hold the consumer events

  • WHEN A person runs uv run devops repos onboard <owner>/<name> --confirm --only 12 for each repository. The person then runs uv run devops gh api repos/<owner>/<name>/hooks --jq '.[]|{id,active,events,code:.last_response.code}'.
  • THEN Each hook is active. Its events hold issues, issue_comment, pull_request, pull_request_review, check_suite and release. Its code is 200 or 202.

Requirement: Pending a person after the merge

The Service MUST answer a pull_request delivery with a 2xx status.

Scenario: The newest delivery of the hook is accepted

  • WHEN A person opens a pull request in a Service repository and runs uv run devops gh api repos/<owner>/<name>/hooks/<hook-id>/deliveries --jq '.[0] | [.event, .status] | @tsv'.
  • THEN The command prints pull_request and OK.

Existing Tool Considered

No alternatives check has run. The open, maintained GitHub CLI (gh), wrapped as uv run devops gh api, reads and patches repository hooks. devops repos onboard --only 12 writes a missing or wrong hook. The CLI lacks one command that checks every hook of every repository in service.repos, so a person repeats the check. The brain write is project code that no tool covers: about 20k tokens to build, keep and fix, and half a day of elapsed work.

Key questions

  • Does the roadmap consumer already take the pull_request and check events?: Yes. The issue update says feat(roadmap): Route pull, review and check events to watch #6889 added pull_request, review, check and comment events to the consumer. Step 8 of docs/CLUSTER.md lists the six events that the consumer takes. CONST_ROADMAP_WEBHOOK_EVENTS at src/devops_cli/config/constants.py:4299 holds the consumer events. The roadmap_consumer in src/devops_cli/server/routes/webhooks.py uses that set. [sources: docs/CLUSTER.md, src/devops_cli/config/constants.py:4299, src/devops_cli/server/routes/webhooks.py]
  • How does a person fix a hook that lacks an event?: Run uv run devops repos onboard <owner>/<name> --confirm --only 12 for each repository in service.repos. The command writes a missing or wrong hook with a new secret. Then run uv run devops gh api repos/<owner>/<name>/hooks --jq '.[]|{id,active,events,code:.last_response.code}'. Check that each hook is active and holds the consumer events. (best practice) [sources: docs/CLUSTER.md, src/devops_cli/github/onboard/service_rows.py, src/devops_cli/config/constants.py:4299]
    • Chosen: Run devops repos onboard --only 12. The issue update says it writes a wrong or missing hook with a new secret. Row 12 compares the hook with the consumer events.
    • Rejected: Change Settings > Webhooks. It repeats the work for each hook and keeps no record of the events. The project records it as the manual fallback.
    • Rejected: Add a new devops command. The command already exists. A new command adds code and tests for no new result.
  • Which payload model carries the pull request fields?: Use the one GitHubWebhookPayload model at src/devops_cli/models/webhooks.py:124. Add or use the pull_request field of the issue shape. The deliver function in src/devops_cli/server/routes/webhooks.py reads payload.pull_request.number as the subject. ADR 0009 keeps one payload model for every event. (best practice) [sources: src/devops_cli/models/webhooks.py:124, src/devops_cli/server/routes/webhooks.py, docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md]
    • Chosen: One payload model with a pull_request field. ADR 0009 keeps one model for every event. The Service reads the same fields.
    • Rejected: .get chains. ADR 0009 replaces them with a typed model. A body that does not validate must get 400.
    • Rejected: A payload model for each event. The fields are the same. ADR 0009 rejects a model for each event.
  • How does the consumer write the pull request into the brain?: The consumer writes the pull request into the same brain entry that it uses for an issue. It does this before it wakes a lane. It uses the existing issue write path with the pull request number and its fields from the payload. CONTEXT.md defines the project brain as a derived index. (best practice) [sources: src/devops_cli/server/routes/webhooks.py, src/devops_cli/models/webhooks.py:124, CONTEXT.md]
    • Chosen: Reuse the issue write path. The brain entry is keyed by the issue or pull request number. The fields are the same.
    • Rejected: Add a second brain write path for pull requests. It repeats the write and risks two entries for one number.
  • Do check_run, status and push belong to this change?: No. The issue update says the consumer already takes the check events (feat(roadmap): Route pull, review and check events to watch #6889). The remaining work is the hook check and the brain write for a pull request delivery. check_run, status and push stay out until an item adds their consumer subscription and brain write. (best practice) [sources: docs/CLUSTER.md, src/devops_cli/config/constants.py:4299, docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md]
    • Chosen: Only the pull request brain write and the hook check. The consumer already takes the events. No code reads the other events.
    • Rejected: Add all seven events now. The consumer has no subscription for check_run, status and push. Each delivery ends as no_subscriber and changes nothing.
  • Does the change fit one pull request?: Yes. The change touches the webhook route, the payload model and their tests. The hook change is a person step after the merge. [sources: src/devops_cli/server/routes/webhooks.py, src/devops_cli/models/webhooks.py:124]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/chore
    on Nov 21, 2026
  2. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    ContributorAuthor
  3. added
    source/agent
    status/new
    value/medium
    effort/low
    scope/service
    priority/p2-medium
    on Nov 21, 2026
  4. added a commit that references this issue on Nov 21, 2026
  5. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  6. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

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

    effort/lowpriority/p2-mediumscope/servicesource/agentstatus/newtype/chorevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions