Skip to content

Strip stale agent-* labels mechanically instead of by hand #738

Closed

Description

@Birfy

Problem

Status labels outlive the work. On 2026-10-22 the board counted as in flight 11 issues and 43 pull requests that were already closed or merged, because nothing removes agent-working / agent-pr / agent-ready when an item stops being open.

Cleaning these by hand is a recurring chore and it silently rots between cleanups, so the board lies about what is being worked on.

Data at the time of filing

What to build

  1. .github/scripts/label-hygiene.mjs — Node, no dependencies, GITHUB_TOKEN plus the repository from the event or an argument. It lists issues and pull requests with state != open that carry any of agent-working, agent-pr, agent-ready, agent-task, awaiting-approval and removes only those labels.
    • default is a dry run that prints one line per item (#NNN <title> -<label>); --apply performs the removals.
    • idempotent: a second run on a clean repository reports 0 items.
    • never touches bug, area:*, risk:*, hold, needs-*, status:done.
    • paginates; rate-limit friendly (one list call per kind, one remove call per label).
  2. .github/workflows/label-hygiene.yml — schedule once a day (pick a quiet hour, e.g. 30 19 * * * UTC) plus workflow_dispatch; least permissions (issues: write, pull-requests: write, contents: read); runs --apply.
  3. .github/scripts/label-hygiene.test.mjs — node:test, fixture pages: an open issue with agent-working stays untouched, a closed issue has exactly the status labels removed and bug/risk:T1 kept, a merged PR loses agent-pr, an issue with only bug produces no removal call.

Acceptance

  • running --apply against this repository leaves zero non-open issues and pull requests carrying those five labels; a second run reports 0.
  • the test file fails if the state != open filter is dropped, and fails if the keep-list is dropped (a fixture that carries bug loses it).
  • workflow passes actionlint / the repo's workflow test (test-workflow.test.mjs) if that check covers new workflows.

Out of scope

Changing the label set, deleting labels from the repository, touching hold (only a human removes it), and any change to the merge queue.

Before the first --apply

The run must print its own work count so the cleanup can be verified rather than trusted: a before: N items / M labels line in the dry run, and the same figures in the --apply run followed by after: 0 items.

The first --apply against this repository is expected to report 43 pull requests and 0 issues (measured 2026-10-22 with is:closed is:pr label:agent-pr and the three issue queries, all 0). If the numbers differ, stop and report the difference in the pull request instead of adjusting the expectation.

Activity

  1. added
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    area:automationScheduled tasks and automation
    on Oct 22, 2026
  2. Birfy commented on Oct 22, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Dev2

    Claiming this one. Branch feat/738-label-hygiene.

    Taking it as written, including the two red checks ("drop the state != open filter" and "drop the keep-list") and the before:/after: lines so the first --apply can be verified rather than trusted. #739 next, in its own pull request.

  3. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 22, 2026
  4. self-assigned this
    on Oct 22, 2026
  5. removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 22, 2026
  6. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:automationScheduled tasks and automation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions