Skip to content

fix(service): route issues webhooks past scoped intake #4412

Closed

Description

@dan-petty

Problem Description

The Service subscribes to GitHub issues webhooks, but three routing gaps drop events after scoped intake. These gaps leave refine, retitle, stage, and implement waiting for their polling timers.

First, roadmap_consumer (src/devops_cli/server/routes/webhooks.py:284-304) sends ("issues", "edited") to _SCOPED_INTAKE on the triage lane and returns early. When a person edits an existing Item that already holds a priority/* label, _intake_one (src/devops_cli/roadmap/run.py:519-555) skips non-candidates and writes nothing. The model lane never wakes up, so refine, retitle, and stage miss the edit until the next poll.

Second, when _intake_one places a P0 item or a critical fix, _apply_round (src/devops_cli/roadmap/run.py:462-465) stamps refine_due in schedule.json. However, roadmap_consumer only enqueues work on the triage lane and never wakes the model lane worker. refine waits up to 151 seconds today, or up to 600 seconds once idle backoff (#3672) lands.

Third, un-scoped issues actions such as labeled, unlabeled, and closed call enqueue_trigger (src/devops_cli/server/routes/webhooks.py:306). That call wakes all three lanes, and triage spends one GitHub request on store.changes_since. Yet no row in STATUS_LANE_ROWS or MODEL_LANE_ROWS (src/devops_cli/roadmap/run.py:770-861) sets batch_keys or due_rule. _Poll.is_due (src/devops_cli/roadmap/run.py:1026-1040) returns False for every row whose interval has not expired, so zero jobs run.

Reproduction Steps

  1. Deliver a signed issues webhook with action="edited" for an open Item that holds a priority/* label.
  2. Observe that enqueue_scoped runs _intake_one on triage and never wakes the model lane.
  3. Deliver a signed issues webhook with action="labeled" or action="closed" before row timers expire.
  4. Observe that enqueue_trigger wakes status and model, and _Poll.is_due skips implement, refine, and stage.

Expected vs Actual Behavior

Expected behavior:

  • Editing an open Item runs or wakes refine and retitle on the model lane.
  • Placing a P0 item or critical fix in _intake_one immediately wakes refine on the model lane.
  • issues labeled, unlabeled, and closed webhook triggers mark refine, stage, and implement due via batch_keys.

Actual behavior:

  • Editing an open Item stops after _intake_one does nothing on triage.
  • Placing a P0 item in _intake_one stamps refine_due on disk without waking the model worker.
  • issues labeled, unlabeled, and closed triggers wake all three workers, spend a triage read, and run zero rows on status and model.

Proposed Solution & Architectural Design

  • Update roadmap_consumer (src/devops_cli/server/routes/webhooks.py) and run_scoped_update (src/devops_cli/roadmap/run.py) to inspect the JobOutcome of _intake_one.
  • Wake the model lane when outcome.placed_critical_or_p0 is True.
  • Route ("issues", "edited") for an open Item to the model lane instead of dropping it.
  • Declare batch_keys in src/devops_cli/config/constants.py and src/devops_cli/roadmap/run.py for refine, stage, and implement.
  • Update openspec/specs/roadmap-scoped-updates/spec.md and k8s/README.md so the documents match the code.

Target Subsystem

SDLC, Git & PR Governance

Existing Tool Considered

gidgethub (https://github.com/gidgethub/gidgethub, ADR 0006) parses GitHub webhooks, while ADR 0008 and ADR 0009 rejected Argo Events for roadmap-service. Neither tool schedules the in-process lane workers or tracks per-row schedules in schedule.json. Updating webhooks.py and run.py costs about 90,000 tokens to build, maintain, and fix, and 2 hours of elapsed time.

Acceptance Criteria

  • An issues edited delivery for an existing open Item wakes or runs refine and retitle on the model lane.
  • When _intake_one sets placed_critical_or_p0=True, the model lane worker wakes immediately and runs refine from refine_due.
  • issues labeled, unlabeled, and closed webhook deliveries match explicit batch_keys on the affected model and status rows instead of waking workers that run zero rows.
  • Unit tests in tests/server/ and tests/roadmap/ verify each path offline without network calls.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.
  • I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 5, zero bare exceptions, tests that cover the changed lines).

Proposed design

Problem statement

The Service drops three issues webhook paths after scoped intake. An edit of an existing Item wakes no model-lane round, so refine, retitle and stage wait for the poll. A P0 item or a critical fix stamps refine_due on disk, and no model-lane worker wakes. An issues labeled, unlabeled or closed trigger wakes three lanes, and no row declares the webhook key that makes it due, so zero rows run.

Acceptance criteria

Requirement: An edit of an Item wakes the model lane

The Service SHALL enqueue a trigger with the delivery key when a scoped intake decides nothing for an open Item.

Scenario: An edit of an issue that holds a priority label

  • WHEN a signed issues edited delivery names an open issue with the label priority/p2-medium, and the scoped intake writes nothing for it
  • THEN the Service enqueues a trigger with the key ("webhook", "issues", "edited"), and the refine and retitle rows run in the model-lane round

Requirement: A critical placement wakes the model lane

The Service SHALL wake the model lane when the scoped intake places a critical fix or a P0 item.

Scenario: An opened issue that intake places as a critical fix

  • WHEN a signed issues opened delivery names an issue with the labels type/bug and priority/p0-critical, and the scoped intake places it
  • THEN schedule.json holds a refine_due stamp, and the model-lane round runs refine

Requirement: A webhook key makes only the rows that declare it due

Each roadmap row SHALL declare in batch_keys the webhook keys that make it due.

Scenario: A labeled delivery

  • WHEN a signed issues labeled delivery arrives, and the refine, stage and implement rows declare its key while the intake and alternatives rows do not
  • THEN refine and stage are due on the model lane, implement is due on the status lane, and intake and alternatives are not due by that delivery

Requirement: The Service answers no delivery of its own write

The roadmap consumer SHALL drop a delivery that the App's own bot sent before it enqueues a trigger or a scoped update.

Scenario: The delivery of the Service's own status label

  • WHEN the issues labeled delivery of the Service's own status/planned write arrives
  • THEN the consumer counts the outcome self, and no lane wakes

Requirement: The spec and the runbook state the lane and the wake

The change SHALL state the triage lane and the model-lane wake in the scoped-update spec and in the roadmap service runbook.

Scenario: A reader of the two documents

  • WHEN a test reads openspec/specs/roadmap-scoped-updates/spec.md and steps 8 and 17 of k8s/README.md
  • THEN both documents name the triage lane for the scoped update and the model-lane wake after it

Requirement: Offline tests prove each path

The change SHALL prove each routing path with a unit test that makes no network call.

Scenario: The tests of the webhook route and the roadmap rows

  • WHEN tests/server/ and tests/roadmap/ run with no network
  • THEN the tests assert the Item edit wake, the critical placement wake, and the row set that each webhook key makes due

Existing Tool Considered

No alternatives check has run on this item. gidgethub (ADR 0006) parses the GitHub webhook payloads, and the Service already uses it. It does not schedule the in-process lane workers or track the per-row schedules in schedule.json. ADR 0008 and ADR 0009 rejected Argo Events for the roadmap-service. No open, maintained tool covers the routing need. The change therefore builds on the existing code, at the written cost of about 90,000 tokens to build, keep and fix, and 2 hours of elapsed time.

Key questions

  • Which lane runs intake, and which lane runs refine, retitle and stage?: The triage lane runs intake. The model lane runs refine, retitle, stage and the alternatives check. The status lane runs the rows that call no model. [sources: CONTEXT.md, src/devops_cli/config/constants.py, openspec/specs/roadmap-scoped-updates/spec.md]
  • What form does a batch key take?: A batch key is a tuple (source, event, action). CONST_ROADMAP_INTAKE_BATCH_KEYS holds ("webhook", "issues", "opened") and ("webhook", "issues", "reopened"). [sources: src/devops_cli/config/constants.py]
  • Which lane runs the scoped update of an issues delivery?: The triage lane runs it. Intake is the triage lane's row, and the scoped update runs intake's own decision code. (best practice) [sources: CONTEXT.md, openspec/specs/roadmap-scoped-updates/spec.md]
    • Chosen: Triage lane. CONTEXT.md gives intake to the triage lane, and the scoped update runs _intake_one.
    • Rejected: Model lane. The model lane holds no intake row, and two lanes would write the intake record.
    • Rejected: A new lane. The Service has three lanes, and a fourth lane doubles the workers for one event.
  • How does the scoped update of an edited Item make refine and retitle run?: run_scoped_update reports whether intake decided the delivered issue, and whether it placed a critical fix or P0 item. The scoped callable then enqueues a trigger with the delivery key ("webhook", "issues", "edited"). The refine and retitle rows declare that key, so both run in the model-lane round. (best practice) [sources: src/devops_cli/roadmap/run.py, src/devops_cli/config/constants.py]
    • Chosen: Read the intake outcome. The outcome states what intake did, and the call needs no second read of the issue.
    • Rejected: Route edited to the model lane. The model lane holds no intake row, so the issue would never be placed.
    • Rejected: Write a second due stamp. refine_due already holds the due time, and a second stamp adds a writer of schedule.json.
  • What does _intake_one report for an issue that is no candidate?: plan_intake holds no decision for that issue, and _apply_round writes nothing for it. The scoped update therefore reports that it decided nothing for the delivered number. [sources: src/devops_cli/roadmap/run.py]
  • Which webhook keys does each row declare?: refine declares edited, labeled and unlabeled. retitle declares edited. stage and implement declare labeled, unlabeled and closed. Each key is ("webhook", "issues", <action>). (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/roadmap/run.py]
    • Chosen: The keys above. An edit changes the text that refine and retitle read. A label change changes the set that refine, stage and implement act on. A close frees a planned_limit slot.
    • Rejected: Every key on every row. The intake row would run for a label change that it does not decide.
    • Rejected: labeled alone on every row. An edit and a close then wait for the interval, which is the gap that this item closes.
  • How does a trigger carry the batch key to a lane?: enqueue_trigger takes the (source, event, action) key and hands it to the lane poll as its batch. roadmap_consumer passes the key of the delivery, and the scoped callable passes the key that it handled. (best practice) [sources: src/devops_cli/server/routes/webhooks.py:306, src/devops_cli/roadmap/run.py]
    • Chosen: Pass the key to enqueue_trigger. The consumer knows the delivery, and _Poll.is_due already reads a batch key.
    • Rejected: Build the key in the manager. The manager receives no delivery and no event.
    • Rejected: Keep the key in the lane state. Two deliveries at once would overwrite one key, and the round would read the wrong one.
  • Does a delivery of the Service's own label write wake a lane?: No. The roadmap consumer refuses a delivery that the App's own bot sent, and counts it as the outcome self. The new labeled keys therefore make no loop. [sources: src/devops_cli/config/constants.py, k8s/README.md]
  • Which documents state the lane and the wake?: The spec openspec/specs/roadmap-scoped-updates/spec.md and steps 8 and 17 of k8s/README.md. The spec scenario that names the model lane for a scoped update is wrong, and the change corrects it. [sources: openspec/specs/roadmap-scoped-updates/spec.md, k8s/README.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/service
    status/new
    value/high
    effort/medium
    on Nov 10, 2026
  2. dan-petty commented on Nov 10, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

  3. added
    priority/p1-high
    on Nov 10, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 10, 2026
  5. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 9bb67a0 (see proposed design in issue body).

  6. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 11, 2026
  7. removed
    status/in-progress
    owner/agent
    on Nov 11, 2026
  8. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 17:36 UTC

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/mediumpriority/p1-highscope/servicesource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions