Repository navigation
Description
Problem or Motivation
The stage_ready row (src/devops_cli/roadmap/stage/stage_ready.py) marks a staged draft pull request ready when CI checks pass and plan/needs-fix is absent. Today, CONST_ROADMAP_WEBHOOK_EVENTS (src/devops_cli/config/constants.py:3545) subscribes only to issues. Every pull_request and check_suite webhook returns 200 {"status": "no_subscriber"}.
Because the Service ignores those events, stage_ready relies on a 3-minute polling timer (DEFAULT_ROADMAP_STAGE_READY_INTERVAL_MINUTES). Each waiting draft costs two GitHub requests per round, or 40 requests per hour (#3671). In addition, open issue #3671 resets its failed-check backoff when a pull_request webhook arrives, which requires subscribing to pull_request events.
Proposed Solution & Architectural Design
- Extend
GitHubWebhookPayload(src/devops_cli/models/webhooks.py) with optional models forpull_requestandcheck_suite. - Add
"pull_request"and"check_suite"toCONST_ROADMAP_WEBHOOK_EVENTS(src/devops_cli/config/constants.py). Open issue feat(roadmap): onboard checks the webhook of a repository #3772 readsCONST_ROADMAP_WEBHOOK_EVENTS, so onboarding checks pick up the new events from one source. - Add a scoped update in
src/devops_cli/roadmap/stage/stage_ready.pyandsrc/devops_cli/roadmap/run.pyon thestatuslane. - Trigger the scoped update on
check_suite(completed) andpull_request(opened,reopened,synchronize,labeled,unlabeled). - Narrow the scoped run to open items whose
stage.prmatches the delivered pull request numbers. - Keep the 3-minute reconciling poll in
STATUS_LANE_ROWSso missed deliveries still settle (ADR 0003, ADR 0017).
Target Subsystem
SDLC, Git & PR Governance
Existing Tool Considered
gidgethub (https://github.com/gidgethub/gidgethub, ADR 0006) and githubkit (https://github.com/yanyongyu/githubkit) parse webhook schemas. GitHub auto-merge acts only after a draft becomes ready. None of these tools inspect stage.pr records, enforce plan/needs-fix holds, or run the Jev completeness check. Extending models/webhooks.py, webhooks.py, run.py, and stage_ready.py costs about 110,000 tokens to build, maintain, and fix, and 2.5 hours of elapsed time.
Acceptance Criteria
-
CONST_ROADMAP_WEBHOOK_EVENTSincludes"pull_request"and"check_suite", andk8s/README.mdstep 8 lists the same events. -
GitHubWebhookPayloadvalidatespull_requestandcheck_suitepayloads while keepingissueoptional. -
check_suitecompletedandpull_requestdraft-change deliveries run a scopedstage_readypass onstatusfor the matchingstage.pritem. - Payloads for pull requests that match no open staged draft make zero
GET pulls/<n>orcheck-runsrequests. - Offline unit tests cover payload parsing, consumer routing, and scoped
stage_readyexecution.
Standards Compliance
- I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 5, zero bare exceptions, tests that cover the changed lines).
- I am willing to submit a pull request implementing this feature with accompanying tests.
Proposed design
Problem statement
The Service ignores pull_request and check_suite webhook events. The stage_ready row therefore waits for a 3-minute poll and costs two GitHub requests for each waiting draft in each round. This change subscribes to those events and runs a scoped stage_ready pass on the status lane for the delivered pull request numbers. The poll stays as the reconciling path.
Acceptance criteria
Requirement: Webhook event list
The roadmap webhook event set and k8s/README.md step 8 SHALL both list issues, pull_request and check_suite.
Scenario: Event list and README agree
- WHEN A test reads
CONST_ROADMAP_WEBHOOK_EVENTSand step 8 ofk8s/README.md. - THEN Both name
issues,pull_requestandcheck_suite.
Requirement: Optional payload models
GitHubWebhookPayload SHALL validate optional pull_request and check_suite objects and keep issue optional.
Scenario: Both new payloads validate
- WHEN The model validates a
pull_requestpayload with number 42 and acheck_suitepayload withcheck_suite.pull_requestsholding 42. - THEN Both expose number 42, and each has
issueequal toNone.
Requirement: Scoped stage ready routing
The Service SHALL route check_suite.completed and the five listed pull_request actions to a scoped stage_ready update on the status lane.
Scenario: Subscribed actions map to stage ready
- WHEN A test looks up each event and action in
SCOPED_UPDATES. - THEN Each entry names job
stage_readyand lanestatus, and its runner is the scoped stage ready runner.
Requirement: Scoped pull request filter
A scoped stage_ready pass SHALL read only open items whose stage.pr equals a delivered pull request number.
Scenario: Only the delivered draft is read
- WHEN The store holds open staged drafts 42 and 43, and the delivery names pull request 42.
- THEN The pass reads pull request 42 and sends no request for pull request 43.
Requirement: No match sends no request
A scoped stage_ready pass with no matching open staged draft SHALL send zero GET pulls/<n> and zero check-runs requests.
Scenario: Unmatched delivery is silent
- WHEN The delivery names pull request 99, and the store holds no open item with
stage.pr99. - THEN The pass sends no GitHub request and returns empty marked, settled and waiting tuples.
Requirement: Reconciling poll remains
The stage_ready row SHALL remain in STATUS_LANE_ROWS with DEFAULT_ROADMAP_STAGE_READY_INTERVAL_MINUTES and first_run_due set.
Scenario: Poll row stays in the status lane
- WHEN A test inspects
STATUS_LANE_ROWS. - THEN The
stage_readyrow has the 3-minute interval and is due on its first run.
Requirement: Scoped run writes no schedule success
A scoped stage_ready update SHALL NOT write a stage_ready success to schedule.json.
Scenario: Poll still judges later changes
- WHEN A
pull_requestsynchronize delivery runs a scopedstage_readypass. - THEN
schedule.jsonkeeps the previousstage_readysuccess time.
Requirement: Offline unit tests
The change SHALL add offline unit tests for payload parsing, scoped routing and scoped stage_ready execution.
Scenario: Offline suite covers the new paths
- WHEN The new unit tests run with no network access.
- THEN Payload parsing, routing and scoped execution tests pass.
Existing Tool Considered
No alternatives check has run. The body names gidgethub and githubkit. They parse webhook schemas only. They do not inspect stage.pr records, enforce plan/needs-fix holds, or run the Jev completeness check. Building the change costs about 110,000 tokens to build, keep and fix, and 2.5 hours of elapsed time.
Key questions
- Which webhook events and actions should the Service subscribe to for
stage_ready?: Addpull_requestandcheck_suitetoCONST_ROADMAP_WEBHOOK_EVENTS. Routecheck_suite.completedandpull_requestopened, reopened, synchronize, labeled and unlabeled to scopedstage_readyon the status lane. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/roadmap/run.py, k8s/README.md, docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md]- Rejected: Add only check_suite. It misses the pull request label and synchronize changes that the issue needs.
- Chosen: Add pull_request and check_suite with the listed actions. It covers the issue and keeps one event list for onboarding checks.
- Rejected: Add every pull_request action. It runs the scoped pass for actions that do not change the draft or its checks.
- What fields should the webhook payload model add for
pull_requestandcheck_suite?: Add optionalWebhookPullRequestwithnumber, and optionalWebhookCheckSuitewithpull_requestsnumbers. Keepissueoptional and ignore extra fields. (best practice) [sources: src/devops_cli/models/webhooks.py, docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md]- Rejected: Use gidgethub or githubkit models. It adds a dependency and still does not route stage_ready.
- Chosen: Add minimal pydantic models. It follows the existing payload model and reads only the numbers that routing needs.
- Rejected: Read a raw dict in the route. It bypasses validation and the typed contract of the webhook route.
- How should a
check_suitedelivery name its pull requests?: Readcheck_suite.pull_requests[].number. A suite with no pull requests yields an empty tuple and runs no scoped update. (best practice) [sources: src/devops_cli/models/webhooks.py]- Rejected: Match by check_suite.head_sha.
stage.prstores a pull request number, so head_sha would need extra reads. - Chosen: Read check_suite.pull_requests numbers. It matches the
stage.prrecord directly and needs no extra request. - Rejected: Run every open staged draft. It defeats the scoped run and its request saving.
- Rejected: Match by check_suite.head_sha.
- How should
WebhookDeliverycarry more than one pull request number?: Addpull_numbers: tuple[int, ...] = ()toWebhookDelivery. Apull_requestdelivery sets one number, and acheck_suitedelivery sets every number in its payload. (best practice) [sources: src/devops_cli/roadmap/run.py]- Rejected: One delivery for each pull request. A check_suite can name several pull requests, and separate deliveries repeat the round.
- Chosen: One delivery with a tuple of pull request numbers. It keeps one scoped round for the delivery and supports multiple pull requests.
- Rejected: A new event-specific delivery class. It adds a parallel type where one optional tuple is enough.
- How should the scoped pass narrow
stage_readyto the delivered pull requests?: Add an optionalpull_numbersargument tomark_stage_readyand filter_recorded_pullby that set. The defaultNonekeeps the full poll, and an empty tuple makes no match. (best practice) [sources: src/devops_cli/roadmap/stage/stage_ready.py]- Rejected: Add a second stage_ready function. It duplicates the draft readiness, needs-fix and Jev logic.
- Rejected: Filter the store items before the call. It puts
stage.prknowledge outside the row that owns it. - Chosen: Add an optional pull_numbers filter to mark_stage_ready. It keeps one decision path and makes the zero-request case explicit.
- Should the scoped update run on the status lane, and should the poll remain?: Run the scoped update on the status lane. Keep the
stage_readyrow inSTATUS_LANE_ROWSwith its 3-minute interval and first-run rule. (best practice) [sources: src/devops_cli/roadmap/run.py, src/devops_cli/config/defaults.py, docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md, docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md]- Chosen: Status lane and keep the poll.
stage_readycalls no model, and ADR 0003 makes the poll the reconciling path. - Rejected: Model lane and keep the poll. It delays a GitHub-only row behind model-bound work.
- Rejected: Status lane and remove the poll. A lost delivery would leave a green draft a draft with no later recovery.
- Chosen: Status lane and keep the poll.
- Should a completed
check_suitetrigger the scoped pass for every conclusion?: Yes. Trigger oncheck_suite.completedfor every conclusion. The pass reads the check runs and leaves a failing draft a draft. (best practice) [sources: src/devops_cli/roadmap/stage/stage_ready.py, src/devops_cli/roadmap/run.py]- Rejected: Only a successful conclusion. It duplicates the check-run decision and misses a suite that settles after a failure.
- Chosen: Every completed conclusion. The row is idempotent and reads the check runs before it marks a draft ready.
- Rejected: No check_suite trigger. It keeps the 3-minute poll as the only path after checks end.
- Should
pull_requestlabeled and unlabeled trigger for every label or onlyplan/needs-fix?: Trigger for every labeled and unlabeled action on a matching staged pull request. The scoped pass then readsplan/needs-fixand decides. (best practice) [sources: src/devops_cli/roadmap/stage/stage_ready.py]- Rejected: Only the plan/needs-fix label. It puts label knowledge in the router and can miss a label change that the row must record.
- Chosen: Every label on a matching staged pull request. The
stage.prfilter makes a non-staged label change cost no request. - Rejected: No label trigger. The row would wait for the poll after a person removes or adds the hold.
- Should
CONST_ROADMAP_INTAKE_BATCH_KEYSgain the new events?: No. Add the events toCONST_ROADMAP_WEBHOOK_EVENTSonly. Intake keeps itsissuesbatch keys, so a pull_request or check_suite delivery never runs intake. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/roadmap/run.py, docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md]- Rejected: Add the events to both constants. It makes PR and check events run intake, which only reads issues.
- Chosen: Add the events to the webhook event set only. It routes the new events to stage_ready and leaves intake unchanged.
- Rejected: Add a second event set. It splits the source that onboarding checks read.
- Should a scoped update write a
stage_readysuccess toschedule.json?: No. The scoped update leaves the previousstage_readysuccess time, so the poll still judges every change since that time. (best practice) [sources: src/devops_cli/roadmap/run.py, docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md]- Rejected: Write a success for the scoped update. It hides changes from the reconciling poll.
- Chosen: Write no success. It follows the existing scoped update contract and keeps the poll authoritative.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-18: rejected.
Rejected by ADR 0009. A newer fact can change an ADR.
Tool: yanyongyu/githubkit (https://github.com/yanyongyu/githubkit), MIT, last activity 2026-11-15, maintained.
Reason: Searches found githubkit, which validates pull_request and check_suite webhook payloads with typed Pydantic models, but no tool routes those events to a scoped sweep or filters by stage.pr; ADR 0009 rejects its parse in the router.
Covers:
- Typed Pydantic models for pull_request and check_suite payloads
- Optional validation of webhook event data
- REST and GraphQL client beside the webhook models
Lacks:
- No scoped sweep of open stage.pr items
- No filter by the delivered pull request numbers
- No plan/needs-fix hold or Jev completeness check
- No routing of events to the status lane
Owner decision 2026-11-13
D8 (approved, tracker #5482): subscribe the App to pull_request, pull_request_review, check_suite and issue_comment. Only a person changes the App webhook events (owner step). Add pull_request_review. The router runs a scoped sweep for the delivered PR (due_jobs for that subject) in place of a scoped stage_ready, and it keeps its refusal of the deliveries of the App. The poll stays the fallback. The title changes to match.
- Live proof: after the merge, the release and the owner step, a check end on an open bot PR makes a watch result line within 2 min. A comment gives the delivery ID and the result line.
Activity
dan-petty commentedon Nov 10, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.Reduces API cost and improves responsiveness but a polling fallback still works, so it is not critical.Cuts repeated GitHub requests per draft and lets readiness settle faster on check completion.Requires new payload models, webhook routing, scoped execution logic, and offline tests across four files.Both extend the stage_ready feature from #2865; the candidate adds webhook-triggered scoped execution, while #2865 delivered the polling-based readiness check.devops-cli-service commentedon Nov 10, 2026
Status set to Ready at e590fa3 (see proposed design in issue body).
devops-cli-service commentedon Nov 11, 2026
Alternatives check: rejected
Reason: The searches show githubkit ships
verifyandparsefor GitHub webhook deliveries, which turn a named event such aspull_requestorcheck_suiteinto a validated, typed Pydantic model, so it covers the payload-model half of the issue (and gidgethub only offers signature validation plus untyped event data and a router). It does not cover the rest: routing a delivery to a scopedstage_readypass on the status lane, narrowing bystage.prpull numbers, the zero-request case, or theplan/needs-fixand Jev decisions, and ADR 0009 explicitly rejected githubkit'sverifyandparsefor this router.Rejected by ADR 0009. A newer fact can change an ADR.
Tool: yanyongyu/githubkit (https://github.com/yanyongyu/githubkit)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-11. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 12, 2026
Scope update from the Service step jobs plan (#5014).
The owner asked on 2026-11-12 for a separate job for each step that the Service jobs run the same way every time. This issue is the
pr-eventsitem of that plan. The plan is extract-first: each repeated step becomes one module and one command (devops roadmap step <name>) that every caller uses, and then the steps that cost most move to their own Jobs.Proposed title:
feat(roadmap): pull_request events make the watch row dueProblem (plan evidence)
The live hook sends issues, milestone, pull_request and release, but the roadmap consumer takes issues only (CONST_ROADMAP_WEBHOOK_EVENTS, src/devops_cli/config/constants.py:3659). k8s/README.md:696 says that the hook sends only issues. So the Service sees a new head, a close or a merge only at the next poll. #4413 planned a scoped stage_ready on these events, and #4414 a handler for closed plan pull requests. The watch row replaces both rows.
Added scope
Change the scope of #4413: the consumer takes pull_request (opened, synchronize, reopened, ready_for_review, closed) and sets the due mark of the watch row for that repository, with the pull request number as a hint. It drops the writes of its own bot. The poll stays the floor, because deliveries get lost. A closed plan pull request goes to cleanup through the CLOSED verdict, so #4414 folds here. check_suite comes only after owner decision O1. Change k8s/README.md:696 and the hook check text in the same pull request.
Cost: about 0.6M tokens and 0.5 agent-day. The full value also needs webhook-403.
Added acceptance
Merge first
Coordination
#4414 (closed plan pull requests from webhooks) folds into this item: a closed plan pull request goes to cleanup through the CLOSED verdict. Close #4414 with evidence after the pull request of this item merges.
[-]feat(roadmap): run scoped stage_ready on PR and check events[/-][+]feat(roadmap): PR, review and check events start a scoped sweep[/+]24 remaining items
devops-cli-service commentedon Nov 23, 2026
The draft pull request #6889 holds the final title and body. In mode
onofroadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.Spend: 268 model requests, 23521076 input tokens, 103618 output tokens.
feat(roadmap): PR, review and check events start a scoped sweep (#4413)
docs(openspec): archive the change (#4413)
feat(roadmap): PR, review and check events start a scoped sweep (#4413)
docs(openspec): archive the change (#4413)
feat(roadmap): PR, review and check events start a scoped sweep (#4413)
docs(openspec): archive the change (#4413)
devops-cli-service commentedon Nov 23, 2026
Released in v0.202.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.202.0
devops-cli-service commentedon Nov 23, 2026
Live since 2026-11-23 17:41 UTC