Skip to content

feat(service): clear status labels when an issue closes #4660

Description

@dan-petty

Problem or Motivation

  • Onboard row 5 (src/devops_cli/roadmap/onboard.py:33 and :41) requires a hand copy of .github/workflows/clear-status.yml. 0 of the 6 other repositories hold it, and dotfiles and homelab have no workflows folder.
  • src/devops_cli/roadmap/inbox.py:6 and src/devops_cli/roadmap/pull_status.py:10 rely on a closed item that holds no status/* or owner/* label.

Proposed Solution & Architectural Design

Owner decision 6 (2026-11-11) chose the Service path:

  • The Service removes the status/* and owner/* labels on the issues.closed webhook event.
  • The 5-minute poll reconciles the closed items that still hold one. When the reconcile sweep of feat(roadmap): move Service work to Workflows and Valkey #4517 replaces the poll, the sweep does this.
  • Remove onboard row 5 and devops-cli's clear-status.yml with no shim.
  • No file goes into a repository. The GitHub App already has issues: write.

Target Subsystem

SDLC, Git & PR Governance (the Service webhook router and src/devops_cli/roadmap/onboard.py).

Existing Tool Considered

GitHub webhooks and the REST labels API, which the Service already uses. A reusable workflow called from each repository was considered; it needs a file in each repository, and the owner chose the Service path. Cost: about 40 lines and 3 tests, about 150,000 tokens and 2 hours to build.

Acceptance Criteria

  • A webhook test: an issues.closed event with status/ready gives one label removal request.
  • A poll test: a closed issue that holds owner/agent loses the label in the next round.
  • git ls-files .github/workflows/clear-status.yml gives nothing, and onboard has 5 base rows.
  • In a live check, a closed test issue in one other repository loses its status label within 5 minutes.

Dependencies

#4652, #3772 (the webhook of each repository) and #4412 (the issues webhook route changes first).

Source: #4627

Alternatives check of 2026-11-20: partly.
Tool: probot/probot (https://github.com/probot/probot), ISC, last activity 2026-11-18, maintained.
Reason: Searches found no tool that removes the labels on close and reconciles the missed ones: Probot only supplies App auth and webhook receipt for a handler still written, and action-remove-labels needs the per-repo workflow the item removes.

Covers:

  • App installation auth and webhook receipt built in
  • issues.closed handler with Octokit label calls
  • One App serves every repository with no file

Lacks:

  • No reconcile of closed items that still hold a label
  • Handler and tests still written, in Node.js
  • A second receiver beside the existing Python router

Proposed design

Problem statement

ADR 0016 requires a closed issue to hold no status/* and no owner/* label. src/devops_cli/roadmap/inbox.py and src/devops_cli/roadmap/pull_status.py rely on this rule. Today only a hand copy of .github/workflows/clear-status.yml removes the labels, and 0 of the 6 other repositories hold it. The change moves the removal into the status sweep of the Service, removes the workflow and onboard row 5 with no shim, and updates the records.

Acceptance criteria

Requirement: The router makes the next sweep due

The webhook router SHALL make the next sweep due when an issues.closed delivery arrives for a repository in service.repos, and SHALL send no label removal request.

Scenario: An issues.closed delivery

  • WHEN A test sends an issues.closed delivery for an issue of a repository in service.repos to the router.
  • THEN The router records one due mark for the next sweep and sends no request to the labels API.

Requirement: A closed issue loses its managed labels

The status sweep SHALL remove every status/* and every owner/* label from a closed issue, and SHALL remove no other label.

Scenario: A closed issue with three label families

  • WHEN A test runs the status sweep with a closed issue that holds status/in-review, owner/agent and type/bug.
  • THEN The sweep sends one label removal request for status/in-review and one for owner/agent, and no request for type/bug.

Requirement: One request for each managed label

The status sweep SHALL send exactly one label removal request for each status/* and each owner/* label that a closed issue holds.

Scenario: A closed issue with two status labels

  • WHEN A test runs the status sweep with a closed issue that holds status/ready, status/in-review and priority/p2-medium.
  • THEN The sweep sends exactly two label removal requests, one for status/ready and one for status/in-review, and no request for priority/p2-medium.

Requirement: No request for a closed issue with no managed label

The status sweep SHALL send no label removal request when a closed issue holds no status/* and no owner/* label.

Scenario: A closed issue with only a priority label

  • WHEN A test runs the status sweep with a closed issue that holds only priority/p2-medium.
  • THEN The sweep sends no label removal request.

Requirement: The status sweep clears a label that the webhook missed

The status sweep SHALL remove each status/* and owner/* label from a closed issue that still holds one when no issues.closed delivery arrived for it.

Scenario: A closed issue that no delivery named

  • WHEN A test runs the status sweep with a closed issue that holds owner/agent and no issues.closed delivery.
  • THEN The sweep sends one label removal request for owner/agent.

Requirement: A second round sends no second request

The status sweep MUST send no label removal request for a managed label that its issue listing no longer holds.

Scenario: The round after the clear

  • WHEN A test runs a status sweep that removed status/ready from a closed issue, then runs the next sweep with the issue listing updated.
  • THEN The next sweep sends no label removal request for that issue.

Requirement: The per-repository workflow is removed

The repository MUST hold no .github/workflows/clear-status.yml file.

Scenario: The workflow file is absent

  • WHEN A test checks the repository tree with git ls-files .github/workflows/clear-status.yml.
  • THEN The command prints nothing.

Requirement: The onboard command checks six prerequisites

The onboard command MUST check six prerequisites, and its service.repos row MUST be row 5.

Scenario: Onboard dry run after the removal

  • WHEN A test runs devops roadmap onboard --repo <owner>/<name> --dry-run.
  • THEN The output has six rows, row 5 is The repository is in service.repos, row 6 is the webhook row, and the dry run plans no read of .github/workflows/clear-status.yml.

Requirement: The records name the Service as the remover

docs/ROADMAP_WORKFLOW.md, docs/roadmap/onboard.md and the docstrings of inbox.py and pull_status.py MUST name the Service as the remover, and ADR 0016 MUST hold an amendment that names the Service.

Scenario: The records are read

  • WHEN A test reads docs/ROADMAP_WORKFLOW.md, docs/roadmap/onboard.md, src/devops_cli/roadmap/inbox.py, src/devops_cli/roadmap/pull_status.py and docs/adr/0016-labels-hold-the-roadmap-items-fields.md.
  • THEN Each of the four files names the Service as the remover, ADR 0016 holds an amendment line that names the Service, and the onboard page names six prerequisites.

Existing Tool Considered

probot/probot, verdict partly. The alternatives check in the issue body records what the tool covers and lacks. The proposal does what the tool lacks: it adds clear_closed_labels to the existing Python status sweep in src/devops_cli/roadmap/status_sync.py and reuses store.unlabel_issue, with no Node.js receiver. Written cost: about 40 lines and 3 tests, about 150,000 tokens and 2 hours to build, keep and fix.

Key questions

  • Which component removes the status/* and owner/* labels when an issue closes?: The Service status sweep, as owner decision 6 chose. The issues.closed delivery makes the next sweep due. The sweep calls clear_closed_labels. The webhook router writes no label, and no file goes into a repository. (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, CONTEXT.md, docs/ROADMAP_WORKFLOW.md]
    • Chosen: The Service status sweep. The round already runs the status sync, the router only routes (ADR 0021 section 1), and no file goes into a repository.
    • Rejected: The webhook router writes the labels. ADR 0021 section 1 keeps only the router in the Service, so a write in the route adds a second writer with a store and a session.
    • Rejected: A reusable workflow called from each repository. It needs a workflow file in each repository, which is onboard row 5 that this item removes.
    • Rejected: Keep the hand copy in each repository. 0 of the 6 other repositories hold the file, and dotfiles and homelab have no workflows folder.
    • Rejected: Probot GitHub App. It is a framework, so the handler and its tests are still written, and it adds a second receiver beside the router.
  • Which GitHub API call removes one managed label and keeps the other labels?: store.unlabel_issue(number, label) removes only the named label with the labels API and the App token. The sweep calls it once for each status/* and owner/* label of a closed issue. (best practice) [sources: src/devops_cli/roadmap/stores/github_store.py, .github/workflows/clear-status.yml]
    • Chosen: One unlabel_issue call for each label. It removes only the named label, keeps type/* and priority/*, and reuses the store method that the jobs use.
    • Rejected: PUT the full label list minus the managed labels. It replaces every label and can drop a label that another writer adds between the read and the write.
    • Rejected: gh issue edit --remove-label from a workflow. It needs a workflow file in each repository, and the Service uses the store and the session, not a shell command.
  • Where does the reconcile of closed items that still hold a managed label run?: In clear_closed_labels, beside sync_statuses in src/devops_cli/roadmap/status_sync.py. sync_statuses calls it after it writes the open items. The poll and the feat(roadmap): move Service work to Workflows and Valkey #4517 sweep share one path. No second schedule is added. (best practice) [sources: src/devops_cli/roadmap/status_sync.py, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, CONTEXT.md]
    • Chosen: In the status sweep, beside sync_statuses. The round already runs the status sweep, so one code path keeps one behavior and no second schedule.
    • Rejected: A separate cron schedule. It duplicates the round and can run at the same time as the poll.
    • Rejected: Webhook only, with no reconcile. A missed delivery or a label written after the close leaves the label, and the inbox then reads a closed item with a label.
    • Rejected: A new function that the router calls. The router would need a store and a session and would write labels, against ADR 0021 section 1.
  • Does the clear break the rule that one writer writes a Status label?: No. src/devops_cli/roadmap/status_sync.py holds write_status, the one writer of a Status label. clear_closed_labels lives in that module, so the one-writer rule holds. (best practice) [sources: src/devops_cli/roadmap/status_sync.py, docs/ROADMAP_WORKFLOW.md]
    • Chosen: Put the clear in status_sync.py. That module holds the one Status writer, and the one-writer rule stays in one module.
    • Rejected: Put the clear in a new module. A Status label write outside status_sync.py breaks the one-writer rule that docs/ROADMAP_WORKFLOW.md records.
  • How does the onboard command renumber its rows after row 5 is removed?: Remove the row-5 prerequisite and its returns. Renumber the webhook row and the later rows so row 5 is service.repos and row 6 is the webhook. Change the module and check_onboarding docstrings, and docs/roadmap/onboard.md, from seven to six. (best practice) [sources: src/devops_cli/roadmap/onboard.py, docs/roadmap/onboard.md]
    • Chosen: Remove row 5 and renumber rows 6 and 7. The spec says one row for each prerequisite, and a gap would make the output and the spec disagree.
    • Rejected: Keep row 6 with a gap. The output would show six rows numbered 1 to 4, 6 and 7, and the spec says one row for each prerequisite.
    • Rejected: Keep row 5 and check another file. The row exists only for the clear-status workflow that this item removes, so a replacement file adds a new prerequisite.
  • Does the Service's GitHub App hold issues: write?: Yes. The App installation of the Service holds Issues read and write, and each installation token of the Service and the Jobs is scoped to it. [sources: docs/CLUSTER.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#3772

Moved to new items

#6563

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/service
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 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/service. The (service) scope of the title gives the scope.
    • Priority: P2-Medium. Automates a manual step but does not block delivery or fix a defect.
    • Value: Medium. Removes a manual copy step and keeps closed items clean without per-repo files.
    • Effort: Low. The body estimates about 40 lines, 3 tests, and 2 hours to build.
    • Related: feat(roadmap): onboard writes the labels file and the status workflow #3753, which asks for a different change. Both address clearing status labels on close, but #3753 writes a workflow file into each repository while this item uses the Service webhook with no file in the repository.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches found only per-repository workflow steps (actions-ecosystem/action-remove-labels, a workflow action) and Probot, a framework for writing your own GitHub App. Neither provides a centrally deployed handler that strips status/*/owner/* on issues.closed with a poll reconcile and no file in each repository, so the ~40 lines belong in the project's own Service webhook router, as the owner decided.

    Tool: none found

    Lacks:

    • No tool removes the labels on an issues.closed delivery from a single app installation with no file in each repository; action-remove-labels is a workflow step that needs a workflow file in every repository, which is the onboard row 5 the issue removes.
    • No tool reconciles the closed items that still hold a status/* or owner/* label on the 5-minute poll (or the feat(roadmap): move Service work to Workflows and Valkey #4517 sweep).
    • Probot is a framework for building a GitHub App, so the handler and the tests would still be written, and it would be a second receiver beside the existing webhook router of ADR 0021.

    Tools considered:

    Searches run:

    • github action remove labels on issue close workflow, results: 5
    • GitHub App remove status labels when issue closed automatically, results: 5
    • actions-ecosystem/action-remove-labels github, results: 5
    • probot app remove label issue closed github app, results: 5
    • "remove labels" github action issue closed marketplace, results: 5
    • github webhook issues closed label cleanup service, results: 5
    • probot github app framework, results: 5
    • github app marketplace remove stale labels issues closed automatically, results: 5

    Sources:

    Checked on 2026-11-13. 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 0410772 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.

    • How is the live behavior verified after the deploy? (a person decides)
  7. dan-petty commented on Nov 14, 2026

    @dan-petty
    OwnerAuthor

    Blocked on #3772: the issue declares #4652, #3772 and #4412 as dependencies. #4652 and #4412 are closed, but #3772 (the webhook of each repository) is still open on 2026-11-14. The webhook removal path cannot land before that route exists, and the item also changes the webhook router, the poll, the onboard rows and the workflow removal (about 2 hours and 150,000 tokens per the issue). Return after #3772 merges.

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

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at c212f77 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.

    • How is the live behavior verified after the deploy? (a person decides)
  9. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Owner question: How is the live behavior verified after the deploy? (a person decides)

    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

  10. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: none, no tool. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • probot app remove status labels on issue closed webhook, results: 5
    • GitHub App remove labels automatically when issue is closed, results: 5
    • actions-ecosystem/action-remove-labels github action, results: 5
    • probot github app framework webhooks node, results: 5
    • label-cleaner GitHub App removes labels when issue closed, results: 5
    • github-label-cleaner remove labels closed issue app, results: 5
    • probot/stale close stale issues remove labels, results: 5
    • "on: issues" "types: [closed]" remove labels workflow yaml, results: 5
    • CrazyMax label-cleaner github app, results: 5
    • probot/probot a framework for building GitHub Apps, results: 5

    Sources:

  11. added
    status/ready
    and removed
    status/new
    on Nov 20, 2026
  12. 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.

  13. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 22, 2026
  14. added a commit that references this issue on Nov 22, 2026
  15. removed
    status/in-review
    on Nov 22, 2026
  16. removed
    owner/agent
    on Nov 22, 2026
  17. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-22 23:51 UTC

  18. dan-petty commented on Nov 23, 2026

    @dan-petty
    OwnerAuthor

    Live check after the deploy of v0.196.0 (the Service pod started 2026-11-22 23:51 UTC), 2026-11-23:

    • Before the deploy, 125 closed issues in 5 repositories held a status/* or owner/* label (vibes 63, homelab 22, 5 each in devops-cli, danielpetty.com and devcontainer-features).
    • Now a search of closed issues in all 7 repositories for each of the 9 labels (status/new, status/ready, status/planned, status/in-progress, status/in-review, status/blocked, owner/agent, owner/human, owner/service) gives 0.
    • Example: vibes#166 (closed 2026-11-20) lost status/in-review at 00:13:33 and owner/agent at 00:13:47, both removed by devops-cli-service[bot].

    So the round of the row implement removes the labels in other repositories. The time from a new close to the removal is not measured here: no issue with such a label closed after the deploy yet.

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/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions