Skip to content

feat(roadmap): handle trusted issue_comment webhook replies #4415

Done

Description

@dan-petty

Problem or Motivation

ADR 0009 dropped issue_comment from CONST_ROADMAP_WEBHOOK_EVENTS before consumer refusals and scoped updates existed, because every bot comment triggered a full round across all rows. Today, the Service has both WebhookConsumer.refusal (src/devops_cli/server/routes/webhooks.py:141-154) and SCOPED_UPDATES (src/devops_cli/roadmap/run.py:881-883), yet issue_comment remains unsubscribed.

This gap slows down three human-in-the-loop workflows and wastes GitHub API quota:

  1. clear_stops (src/devops_cli/roadmap/stop_clear.py:49-50, 345) polls comments on every Service-stopped Blocked item every 7 minutes for implement: retry. That poll spends one GitHub request per Blocked item per round even when nobody commented.
  2. When a collaborator answers open questions on an item waiting on person (src/devops_cli/roadmap/refine/refine.py:43-55), refine waits up to 31 minutes (DEFAULT_ROADMAP_REFINE_INTERVAL_MINUTES) to read the reply.
  3. When a collaborator comments to wake a suspended row (feat(roadmap): a comment by a person on an item starts a suspended row again #2754), _person_comment_stamps (src/devops_cli/roadmap/run.py:1297-1346) waits for the next poll tick.

Proposed Solution & Architectural Design

  • Extend GitHubWebhookPayload (src/devops_cli/models/webhooks.py) with an optional comment model and an issue.pull_request marker.
  • Add "issue_comment" to CONST_ROADMAP_WEBHOOK_EVENTS (src/devops_cli/config/constants.py).
  • Enforce zero-trust payload refusal in roadmap_consumer (SECURITY.md untrusted-input rule):
    • Refuse issue_comment payloads when action != "created".
    • Refuse payloads where sender.login matches service_manager.bot_login (own_write) or ends with [bot].
    • Refuse payloads where comment.author_association is outside CONST_ROADMAP_TRUSTED_AUTHORS, counting them as ignored with zero GitHub requests.
  • Route accepted trusted comments on issues (where issue.pull_request is absent):
    • For implement: retry, enqueue a status lane update to clear the stop on issue.number and call run_implement_round.
    • Otherwise, enqueue a scoped refine update for issue.number on model and pass the comment timestamp to FailureLedger.

Target Subsystem

SDLC, Git & PR Governance

Existing Tool Considered

gidgethub parses GitHub issue_comment payloads, and Probot or peter-evans/slash-command-dispatch dispatch comment commands in GitHub Actions. Neither tool integrates with RoadmapStore, FailureLedger, stop_clear.py, or the in-cluster RepoWorker lanes, and ADR 0009 routes GitHub deliveries through webhooks.py. Adding issue_comment parsing, trust refusal, and scoped handlers costs about 115,000 tokens to build, maintain, and fix, and 2.5 hours of elapsed time.

Acceptance Criteria

  • CONST_ROADMAP_WEBHOOK_EVENTS includes "issue_comment", and k8s/README.md step 8 matches.
  • roadmap_consumer refuses issue_comment deliveries from bots, edited or deleted actions, and authors outside CONST_ROADMAP_TRUSTED_AUTHORS before making any GitHub API request.
  • A trusted implement: retry comment on a Service-stopped Blocked issue clears the stop on status and submits an eligible runner Job.
  • Another trusted human comment on an open issue enqueues a scoped refine update on the model lane for that issue number.
  • Offline unit tests cover bot refusal, untrusted-author refusal, implement: retry, and trusted refine reply routing.

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.

Alternatives check of 2026-11-22: in-use.
The repository already uses this tool.
Tool: gidgethub/gidgethub (https://github.com/gidgethub/gidgethub), Apache-2.0, last activity 2026-11-20, maintained.
Reason: The searches and repository facts show gidgethub, an open maintained Python GitHub App library, parses issue_comment payloads and dispatches events to handlers, but it brings no trust refusal, roadmap state or scoped sweep, so it covers only the payload and routing part.

Covers:

  • Parses GitHub issue_comment webhook payloads
  • Dispatches webhook events to per-event handlers
  • GitHub App authentication and API calls

Lacks:

  • Trust refusal on comment author_association
  • Scoped sweep of the commented issue
  • Stop clear, FailureLedger and lane integration

Owner decision 2026-11-13

D8 (approved, tracker #5482, Phase 3) adds issue_comment to the App events (owner step). A trusted reply makes the router run a scoped sweep for that item. Refine or resolve then becomes due by its predicate. No due mark.

  • Live proof: after the merge, the release and the owner step, a trusted reply on a live item makes the due job run as the App. A comment gives the result line.

Proposed design

Problem statement

The roadmap consumer does not subscribe to issue_comment. A person's retry or reply waits for the next poll, and clear_stops spends one GitHub request on each Blocked item each round. The change adds trusted issue_comment handling with zero-trust refusal and a scoped sweep for the item.

Acceptance criteria

Requirement: Roadmap webhook event subscription

The roadmap webhook event set SHALL include issue_comment, and the intake batch keys SHALL not include it.

Scenario: Event set and intake keys

  • WHEN The roadmap webhook tests read CONST_ROADMAP_WEBHOOK_EVENTS and CONST_ROADMAP_INTAKE_BATCH_KEYS.
  • THEN CONST_ROADMAP_WEBHOOK_EVENTS contains issue_comment and CONST_ROADMAP_INTAKE_BATCH_KEYS does not.

Requirement: Onboarding step names issue_comment

Step 8 of k8s/README.md SHALL name both issues and issue_comment.

Scenario: Onboarding documentation

  • WHEN uv run devops ci --check --only docs runs after the change.
  • THEN The docs check passes and step 8 names both issues and issue_comment.

Requirement: Issue comment payload model

GitHubWebhookPayload MUST parse an optional comment with body, author_association and created_at, and an optional issue.pull_request marker.

Scenario: Issue comment payload

  • WHEN A test validates an issue_comment payload that holds a comment and a pull request marker.
  • THEN The payload exposes the comment fields and the pull request marker.

Requirement: Refuse non-created and bot comments

The roadmap consumer SHALL refuse an issue_comment payload before any GitHub API request when its action is not created or its sender login is the Service bot or ends with [bot].

Scenario: Non-created or bot comment

  • WHEN A test sends an issue_comment payload with a non-created action or a bot sender.
  • THEN The consumer refuses the payload and records zero GitHub requests.

Requirement: Refuse pull request comments

The roadmap consumer SHALL refuse an issue_comment payload before any GitHub API request when issue.pull_request is present.

Scenario: Pull request comment

  • WHEN A test sends an issue_comment payload with an issue.pull_request marker.
  • THEN The consumer refuses the payload and records zero GitHub requests.

Requirement: Refuse untrusted authors

The roadmap consumer SHALL refuse an issue_comment payload before any GitHub API request when comment.author_association is outside CONST_ROADMAP_TRUSTED_AUTHORS, and it SHALL count the payload as ignored.

Scenario: Untrusted author comment

  • WHEN A test sends an issue_comment payload with an author association outside the trusted set.
  • THEN The consumer refuses the payload, counts it as ignored, and records zero GitHub requests.

Requirement: Retry comment runs a scoped sweep

A trusted implement: retry comment on a Service-stopped Blocked issue SHALL make the router run a scoped sweep for that issue, and the implement row SHALL clear the stop and submit one eligible runner Job.

Scenario: Retry on a blocked issue

  • WHEN A test sends a trusted implement: retry comment for a Blocked issue with a Service stop.
  • THEN The router runs a scoped sweep for the issue, the stop clears, and the implement round submits one eligible runner Job.

Requirement: Trusted reply runs a scoped sweep

A trusted human comment on an open issue that is not implement: retry SHALL make the router run a scoped sweep for that issue, and refine or resolve SHALL become due by its predicate without a due mark.

Scenario: Trusted refine or resolve reply

  • WHEN A test sends a trusted human comment on an open issue that is not implement: retry.
  • THEN The router runs one scoped sweep for the issue, the refine or resolve row becomes due by its predicate, and no due mark is written.

Requirement: Offline webhook tests

Offline unit tests MUST cover non-created refusal, bot refusal, untrusted-author refusal, pull request refusal, implement: retry routing, and trusted refine or resolve routing.

Scenario: Webhook unit tests

  • WHEN A test run executes the roadmap webhook tests.
  • THEN Each of the six cases passes and makes no network request.

Existing Tool Considered

The alternatives check in the issue body records partly for gidgethub/gidgethub (Apache-2.0, last activity 2026-09-25, maintained). See that check for what the tool covers and lacks. The proposal adds the refusal, the scoped sweep route, the targeted retry stop clear, the event subscription and the README step at about 115,000 tokens and 2.5 hours.

Key questions

  • How does the event set add issue_comment without making intake treat comments as intake batches?: Keep CONST_ROADMAP_INTAKE_BATCH_KEYS unchanged. Add issue_comment only to CONST_ROADMAP_WEBHOOK_EVENTS. (best practice) [sources: src/devops_cli/config/constants.py:3913, src/devops_cli/config/constants.py:3935, src/devops_cli/roadmap/run.py]
    • Chosen: Add issue_comment only to the webhook event set. It keeps the intake batch keys separate and adds the event to the webhook set.
    • Rejected: Add issue_comment to CONST_ROADMAP_INTAKE_BATCH_KEYS. Intake would read comment events as intake batches.
    • Rejected: Replace the set with an explicit event list. It would drift when an intake webhook event changes.
  • Which payload fields does the consumer need to decide trust and route?: Add comment.body, comment.author_association, comment.created_at and issue.pull_request to GitHubWebhookPayload. Ignore the other fields. (best practice) [sources: src/devops_cli/models/webhooks.py, SECURITY.md]
    • Chosen: Add the comment fields and the pull request marker. The refusal and routing need all four fields.
    • Rejected: Add only comment.body. The trust check needs author_association and the routing needs the timestamp.
    • Rejected: Parse the raw payload in the route. It bypasses the typed model and the existing refusal signature.
  • How does the consumer tell an issue comment from a pull request comment?: Refuse an issue_comment payload when the issue.pull_request marker is present. (best practice) [sources: src/devops_cli/models/webhooks.py, src/devops_cli/server/routes/webhooks.py]
    • Chosen: Use the issue.pull_request marker. GitHub sends the marker only for a pull request, and the refusal needs no request.
    • Rejected: Look up the issue number. It needs a GitHub request, which the refusal must avoid.
    • Rejected: Read the comment URL. It is less direct and still needs the marker.
  • Which comments are trusted?: Trust only an author_association in CONST_ROADMAP_TRUSTED_AUTHORS. Refuse the Service bot, a [bot] sender and every other association. (best practice) [sources: SECURITY.md, src/devops_cli/config/constants.py:4213, src/devops_cli/roadmap/trust.py]
    • Chosen: Use the trusted author set and refuse bots. It matches the existing item-author rule and the own-write guard.
    • Rejected: Trust every comment. SECURITY.md trusts only write access and two bots.
    • Rejected: Trust the sender login only. A contributor login has no write access.
  • What does owner decision D8 of 2026-11-13 require?: D8 approves issue_comment in the App events. A trusted reply makes the router run a scoped sweep for the item. Refine or resolve becomes due by its predicate, and the handler writes no due mark. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, src/devops_cli/roadmap/run.py:881-883]
    • Chosen: Run a scoped sweep for the item. D8 makes the scoped sweep the route, and the row predicate decides the work.
    • Rejected: Set a refine or stage due mark. D8 says no due mark.
    • Rejected: Enqueue a scoped refine update on the model lane. D8 replaces the lane enqueue with a scoped sweep.
    • Rejected: Run a full round across all rows. ADR 0009 rejected a full round for every comment.
  • How does a trusted implement: retry comment clear the stop?: The scoped sweep runs the implement row for the issue. retry_asked_on sees the trusted comment, and the retry rule clears the stop without a full clear_stops pass. (best practice) [sources: src/devops_cli/roadmap/stop_clear.py:49-50, src/devops_cli/roadmap/stop_clear.py:345, src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/implement/implement.py]
    • Chosen: Run a scoped sweep and let the implement row clear the stop. The row already has the retry rule and the stop-clear path.
    • Rejected: Run clear_stops for every Blocked item. It lists comments for every Blocked item and keeps the quota cost.
    • Rejected: Clear the stop in the webhook route. It would write GitHub state from the route and bypass the row.
  • Does ADR 0009 still block issue_comment?: No. Owner decision D8 approves the event, and the scoped sweep meets the router rule. The refusal and scoped update controls exist. (best practice) [sources: docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md, docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md, src/devops_cli/server/routes/webhooks.py:141-154, src/devops_cli/roadmap/run.py:881-883]
    • Chosen: Add issue_comment with refusal and a scoped sweep. D8 approves it, and the controls meet the router rule.
    • Rejected: Keep the event unsubscribed. The poll cost and latency remain.
    • Rejected: Add issue_comment with a full round. ADR 0009 rejected full rounds for every comment.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#6554

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    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.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It removes 7 to 31 minute polling delays for three human workflows but the system still functions without it.
    • Value: Medium. It cuts wait time for retry, refine-reply, and row-wake actions and saves GitHub API quota on idle polls.
    • Effort: Medium. It needs a new payload model, constant update, refusal logic, and two routing branches plus offline tests.
    • Related: fix(service): route issues webhooks past scoped intake #4412, which asks for a different change. Both route GitHub webhooks through roadmap_consumer in webhooks.py, but #4412 fixes issues-event routing gaps while the candidate adds issue_comment subscription and comment-specific routing.
  3. added
    priority/p2-medium
    on Nov 10, 2026
  4. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 1ca0133 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • What must a person do to make the new event live? (a person decides)
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Reason: The web searches were mostly noise, but the tool facts confirm gidgethub is a maintained Python GitHub library, and the issue itself states it parses issue_comment payloads — the parsing half of this need. It does not provide the zero-trust refusal, the scoped routing into RoadmapStore/FailureLedger/RepoWorker lanes, or the targeted implement: retry stop clear, so it covers only a part.

    Tool: gidgethub/gidgethub (https://github.com/gidgethub/gidgethub)

    • License: Apache-2.0
    • Last activity: 2026-09-25
    • Maintained: yes

    Covers:

    • Parses GitHub webhook event payloads, including issue_comment payloads, into event data
    • Maintained Python library for GitHub API sessions (the project's ADR 0006 transport choice)

    Lacks:

    • Zero-trust refusal of edited/deleted actions, bot and own-write senders, and author_association outside the trusted set
    • Refusal of pull-request comments via the issue.pull_request marker
    • Scoped routing into RoadmapStore, FailureLedger and the in-cluster RepoWorker lanes
    • Targeted stop clear for a trusted implement: retry comment without a full clear_stops pass
    • Enqueueing a scoped refine update on the model lane and passing the comment timestamp to the ledger
    • Subscription change to CONST_ROADMAP_WEBHOOK_EVENTS and the matching k8s/README.md hook instructions

    Tools considered:

    Searches run:

    • gidgethub webhook event parsing issue_comment payload, results: 5
    • gidgethub sansio Event webhook payload parsing library, results: 5
    • peter-evans slash-command-dispatch issue comment commands GitHub Actions, results: 5
    • gidgethub python library GitHub API asyncio documentation, results: 5
    • gidgethub, results: 5
    • gidgethub sansio docs webhooks validate_event Event class, results: 5

    Sources:

    Checked on 2026-11-11. A person decides what this means for the item. The check changes no label and closes no issue.

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

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 79eb893 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • What must a person do to make the new event live? (a person decides)
  7. added
    status/ready
    and removed
    status/new
    on Nov 20, 2026
  8. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  9. 20 remaining items

  10. removed
    owner/service
    on Nov 23, 2026
  11. added 2 commits that reference this issue on Nov 23, 2026
  12. added
    status/planned
    owner/service
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/planned
    status/in-progress
    on Nov 23, 2026
  13. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    The draft pull request #6942 holds the final title and body. In mode on of roadmap.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: 325 model requests, 32464473 input tokens, 142416 output tokens.

  14. removed
    owner/service
    on Nov 24, 2026
  15. removed
    status/in-review
    on Nov 24, 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

    effort/mediumpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions