Skip to content

fix(roadmap): closure closes the items delivered into a release whose milestone has already closed #1362

Closed

Description

@dan-petty

Problem

On 2026-10-07 the v0.2.28 milestone closed at 23:44:21Z while four of its items were still open. The pull requests that deliver them had already merged into release/v0.2.28, each with Closes #N in its body:

Item Opened into v0.2.28 Pull request Merged into release/v0.2.28 Closed
#1295 20:58:15Z #1304 21:41:20Z by hand, 2026-10-08 00:35:47Z
#1296 20:58:17Z #1305 21:41:11Z by hand, 00:35:50Z
#1297 20:58:18Z #1306 21:40:59Z by hand, 00:35:52Z
#1341 22:28:15Z #1342 23:02:44Z by hand, 00:35:55Z

All four were opened straight into v0.2.28 after its release pull request #1283 had opened (12:37:24Z), so they joined a cut release (#1294, #1349). GitHub honours Closes #N only in a pull request into the default branch, so closure (devops roadmap close, #743) is the only automated closer of delivered items (src/devops_cli/roadmap/close.py:4-6).

Closure never reads a release again once its milestone is closed

  • plan_close reads only the branch of the current release, which is the lowest-numbered open Release (src/devops_cli/roadmap/close.py:226-229, :308-312).
  • Once v0.2.28 closed, the current release was v0.2.29, so no later run would have read release/v0.2.28. A delivered item that is still open when its milestone closes stays open for good, and nothing reports it.
  • ADR 0003 makes polled state the source of truth so that a miss "only delays a job until the next tick" (docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md:3). Closure decides what to read from which release is current, not from state it can read again, so one missed run before the ship is never recovered.
  • The state closure needs is already in hand. store.releases() returns closed milestones with their state and closed_at (src/devops_cli/roadmap/store.py:206-218, listing milestones?state=all), and store.issues() returns every issue with its milestone (src/devops_cli/roadmap/github_store.py:1407-1409). plan_close reads both already.

Every path that closes a milestone ignores its items, and some can't be gated

  • release.yml's "Close Release Milestone" step runs uv run devops gh milestones close "<version>" || echo ... (.github/workflows/release.yml:124-129). That calls close_milestone (src/devops_cli/commands/gh.py:364-375), which calls GitHubRoadmapStore.close_release, which is edit_release(state=CLOSED) (src/devops_cli/roadmap/github_store.py:1256-1258).
  • devops release tag --push (src/devops_cli/commands/release.py:1972-1981, :2058-2073).
  • Reprioritize closes shipped milestones last (src/devops_cli/roadmap/reprioritize.py:1292-1296, used at :1757, :1797, :1888).
  • devops gh milestones edit <v> --state closed calls edit_release directly (src/devops_cli/commands/gh.py:378-412).
  • The MCP tools gh_milestone_close and gh_milestone_edit run those two commands (src/devops_cli/ai/mcp/server.py:1764-1802).
  • A person can also close a milestone in the GitHub web UI.

Reprioritize's design already accepts open items in a shipped release: release.yml closes the milestone after it publishes (reprioritize.py:34), and "the job moves no item out of a shipped release" (reprioritize.py:128-130). So the fix belongs in what closure reads. Gating six writers, one of them the web UI, cannot work.

Why closure missed the window on 2026-10-07

Release run 37703867864 ran on the push of 910b823 to main (#1283 merged at 23:43:26Z). Its "Close Release Milestone" step ran from 23:44:16 to 23:44:22Z and logged Successfully closed milestone '0.2.28'. Closure's last success for this repository was at 20:59:16Z, according to the service's schedule state. It runs hourly, or on a pull_request closed webhook (src/devops_cli/roadmap/run.py:513-518; src/devops_cli/config/defaults.py:800; src/devops_cli/config/constants.py:2459-2461). Service logs (Loki, {namespace="devops", container="service"}) show this sequence:

  • Close was not in the round that followed 21:39:04Z.
  • No job ran for this repository from 22:44 to 23:06Z. From 22:44:41 to 23:05:39Z every round stopped before any job, on the GraphQL reserve check (85 down to 52 points left until 23:06 UTC).
  • Intake ran first again after the GraphQL reset. The next round spent about 26 minutes in intake, which failed at 23:32:05Z (#1348 is not on the board after intake added it).
  • Close then failed at the rate limiter's reset boundary. It failed at 23:32:07.7Z in plan_close -> merged_pull_requests with GitHubRateLimitError: Rate limit state for subcommand 'core' is in an unknown or broken state (src/devops_cli/github/rate_limiter.py:886), at the end of the hourly core window. 0.5 s later the same pod logged a 0.72 s core pause, which is a fresh window's spacing (3,600 s / 5,000).
  • Close did not run again before the milestone closed. No close run appears between 23:32:07Z and 23:44:21Z.

Each of these is a separate defect from the same investigation (see Related). A budget stop, a rate-limit error, a pod restart or a dropped webhook can each miss the window between the last item merge and the release merge. This item makes such a miss cost one run instead of the closings.

After the ship, close could not run at all until the next release branch existed. It checks out the current release's branch (src/devops_cli/roadmap/run.py:215-228; needs_clone at :518), and release/v0.2.29 was created at 2026-10-08 00:37:37Z, when reprioritize started v0.2.29 (#1366 covers that window).

No closed milestone holds an open issue today (gh api 'repos/dan-petty/devops-cli/milestones?state=all&per_page=100', 2026-10-08), because the four were closed by hand. A milestone's open_issues count includes pull requests: v0.2.28's closed_issues of 29 is 22 issues and 7 pull requests.

Acceptance criteria

  • plan_close also plans closings for each closed Release that holds an open issue.

    • It finds these releases from the store.issues() it already reads, not from Release.open_issues, which also counts pull requests.
    • For each such release, it reads the pull requests merged into release/<title> and runs the same _closings (close.py:245-284). It uses the same comment template and the same rule that a pull request whose check runs can't be read closes nothing.
    • These closings come before the current release's.
  • When no closed Release holds an open issue, a run makes the same requests it makes today, with no extra listing.

  • A shipped release's items don't affect the current release's cut, and _held and the cut still read only the current release (close.py:334-363, :366-373):

    • An open item in a shipped release that no merged pull request delivers stays open and does not hold the cut. The output names it under its release.
    • A shipped release's pull request whose check runs can't be read is named in unread, and devops roadmap close exits 1 as it does today (src/devops_cli/commands/roadmap.py:477-479). It does not hold the current release's cut.
  • The text output names each shipped release it read, with its closings and its undelivered open items.

  • The dry run lists the shipped-release reads under their own condition, before the current release's reads (src/devops_cli/roadmap/request_plan.py:549-588). It still makes no request.

  • These texts say that closure also covers a closed release that still holds an open issue:

    • close.py's module docstring (:15);
    • HELP.roadmap.close (src/devops_cli/lang/en/help.py:990-999);
    • the roadmap_close MCP docstring (src/devops_cli/ai/mcp/server.py:742-743);
    • docs/ROUTINE_TASKS.md:245 and :262.

    The generated references that quote these texts (README.md, docs/CLI_REFERENCE.md, docs/MCP_TOOLS.md) are regenerated, not hand-edited.

  • Tests in tests/test_roadmap_close.py run on the InMemoryRoadmapStore fixture with the fake checks reader (:64-110). They make no network call, and each test's call phase stays under 1 s:

    • Delivered. Closed v0.2.25 holds open #A, delivered by a pull request merged into release/v0.2.25, and current v0.2.26 holds a delivered #B. One run closes #A, with a comment naming release/v0.2.25 and the merge commit, and closes #B. A second run writes nothing and names no shipped release. The case runs twice: once with the milestone closed through close_release, once through edit_release(state=CLOSED).
    • Undelivered. Closed v0.2.25 also holds open #C, which no pull request closes. #C stays open and is named, and the current release's cut is still planned when v0.2.26 qualifies.
    • Unreadable checks. #A's pull request has check runs that can't be read. #A stays open, the CLI exits 1 naming it, and the current release's cut is still planned.
    • Requests. A GitHubRoadmapStore with a fake gh runner at the process edge (the runner seam, github_store.py:1187, or refactor(github): the github session owns transport, ledger, error classes and link pagination #983's session fake if that lands first) is used. With no closed milestone holding an open issue, a run requests no pulls?state=closed&base=release%2Fv0.2.25 listing. With one, it requests that listing once.
    • Dry run. The dry run lists the shipped-release listing under its condition, and test_the_dry_run_lists_the_closes_and_the_cut_without_a_request (:483) still passes.
  • uv run devops ci passes within its 5-minute budget.

  • changelog.d/<n>.md records the change. CHANGELOG.md and docs/ROADMAP.md are untouched, and uv run devops pr check-readiness passes.

  • Pending a person, after merge and the service image rollout:

    • After the next release ships and the release after it has started (its release/v… branch exists), let one close run finish. Then gh api 'repos/dan-petty/devops-cli/milestones?state=closed&per_page=100' --jq '.[] | select(.open_issues > 0) | .title' prints nothing. The exception is a release whose open items uv run devops roadmap close --plan names as delivered by no merged pull request.

Key questions

  • Fix what closure reads, or gate every milestone closer? Proposed: what closure reads.
    • A gate would have to cover six paths, and it cannot cover the web UI.
    • A gate would also make release.yml a second closure writer, with new checks: read and statuses: read permissions.
    • Reading state covers every path, needs no workflow change, and follows ADR 0003.
  • Which closed releases does closure read? Proposed: every closed Release that holds an open issue.
    • None does today, so the normal case costs nothing.
    • Each such release costs one listing, plus one files listing per merged pull request, per close run. That is core REST: 30 pull requests merged into release/v0.2.28 and 40 into release/v0.2.27, against 5,000 an hour.
    • An item a person leaves open in a shipped release on purpose keeps that read going. The output names the item on every run, so a person can close or move it.
    • Alternative: bound the read by Release.closed_at (closed in the last N days). That adds a setting and loses a late merge into an older branch.
  • Does an open item that no merged pull request delivers hold anything? Proposed: no. Reprioritize keeps such an item in a shipped release by design (reprioritize.py:128-130). Closure names it and moves on.
  • Does an unreadable check run in a shipped release hold the current release's cut? Proposed: no.
    • The item stays open, the run names it and exits non-zero, and the next run retries.
    • The current cut depends only on its own items.
    • Alternative: one rule for both. That is simpler, but it ties the release train to an older branch whose checks may stay unreadable.
  • Does release.yml's step change? Proposed: no.
    • Its || echo hides a failed close (release.yml:126).
    • A milestone left open is harmless: reprioritize closes shipped milestones last, and with this fix the order of closing no longer matters.
    • A ::warning:: annotation in place of || echo is a separate one-line change if wanted.
  • Should the release pull request wait for closure (a readiness check)? Proposed: no, not here. fix(roadmap): a critical fix joins the current release while its release pull request is open, so the release branch holds every change before it merges #1294 owns what a release branch must hold before it merges. This item makes a missed run recoverable.
  • Can closure catch up right after a ship? Not at 910b823: close checks out the current release's branch (run.py:215-228), which does not exist until reprioritize starts the next release.
  • Is this a patch on a patch? No.

Strategic alignment

Update 2026-10-08: delivered scope

Delivered scope differs from the body in these ways:

  • A shipped release closes only its own items. The shipped _closings call gets only the issues in that release. Otherwise an issue a person reopened and moved to another release would be closed again on every run through the old branch, and a current-release item closed that way would briefly hold the cut on OPEN_ITEMS. An issue with no milestone that a shipped PR names stays open, as before.
  • A person's reopen stands (ADR 0002). A shipped read never closes an open item whose state_reason is reopened; the text names it as reopened by a person. That reason is in the issue listing, so it costs no request. A closed release whose only open items a person reopened gets no pull-request listing. A PR merged into that branch after the reopen does not close the item either, so a person closes it; telling those apart needs the issue's timeline, which fix(roadmap): closure does not close again an item a person reopened in the current release #1417 weighs together with the same gap in the current release's read.
  • One issue is closed once, and named once. The current release's _closings skips the numbers the shipped reads already planned. A shipped item that a PR into the current branch closes is dropped from its release's still-open and reopened lists.
  • Branch names. Both reads use release_cut_branch (release/vX.Y.Z), not release/<title>, so a milestone titled without its v is read from the branch the cut makes.
  • _held and the plan's shape. _held takes the current release's own unread, open and completed items. ClosePlan.closings and ClosePlan.unread list the shipped entries first, and a new ClosePlan.shipped (ShippedClosure) carries each section. apply_close, has_writes, the Service adapter and the CLI's exit 1 are unchanged.
  • With no current release. Shipped closings are still planned, and the run then holds NO_RELEASE. The issues listing is read only when a release is current or a closed milestone's open_issues > 0. That count includes PRs, so it is an upper bound used only to skip the read. The dry run lists this read under its own condition.
  • Request order. When no closed release holds an open issue no person reopened, the requests are the same as before, but the issues listing now comes before the current release's merged-PR listing.
  • Output wording. The shipped section prints "Still open in vX.Y.Z, holding no cut:", which includes items whose PR's check runs could not be read, and "Reopened by a person in vX.Y.Z, so closure leaves it open, holding no cut:".
  • Tests. The requests test is in tests/test_roadmap_dry_runs.py (test_a_close_runs_gh_argv_sequence_is_its_plan, five cases), and its follows matcher now reads URL-quoted placeholders. test_closure_reads_the_cut_branch_of_a_release_titled_without_its_v sits beside it. InMemoryRoadmapStore.reopen_issue now sets state_reason to reopened, as GitHub does.
  • One more generated file. docs/commands/roadmap.md was regenerated too.
  • GraphQL cost. A shipped read is not GraphQL-free. Each shipped PR whose body names an open item of that release costs one gh pr checks, which gh sends as GraphQL; the listings and /files are core REST.
  • Out of scope, each its own issue. The Service's close adapter ignores plan.unread and does not report a shipped release's open or reopened items (fix(roadmap): the close job runs in a repository's first round, fails on unreadable check runs and reports the items a shipped release leaves open #1414). run_gh classes gh's GraphQL porcelain commands as core (fix(github): run_gh paces gh pr checks, gh pr list and gh issue list as core REST though gh sends them as GraphQL #1415). _reprioritize_cross_job re-reads the board and issues closure already read (refactor(roadmap): roadmap run decides whether closure made reprioritize due from the milestones closure read, with no board or issue read #1416). The current release's read still re-closes an item a person reopened (fix(roadmap): closure does not close again an item a person reopened in the current release #1417).
  • Line references. The cited lines have moved on the release branch; the task file cites the current ones.
  • Pending a person. The post-merge check's exception now covers items close --plan lists under their release as still open or as reopened by a person.

Activity

  1. added
    type/bug
    priority/p1-high
    scope/release
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. Delivered items are stuck open with no recovery path, corrupting roadmap state, but the system still functions for the common case where the milestone is still open at the next tick.
    • Value: High. Correctly closing delivered items is a core promise of the roadmap tool, and the bug leaves items open forever with no alert, undermining trust in the tracked state.
    • Effort: Medium. The needed data (closed milestones with closed_at, issues with milestone) is already returned by the store, so the fix is to extend plan_close to also scan recently-closed milestones, but it must handle idempotency and the timing window car
  3. added
    source/agent
    and removed
    priority/p1-high
    on Oct 8, 2026
  4. added this to the v0.2.29 milestone on Oct 8, 2026
  5. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Placed in v0.2.29 by the owner on 2026-10-08. The owner's instruction was to pull every issue that keeps the roadmap service from working into the current milestone and complete them. This is a person's placement and should stay in the release (#1349). Implementation started the same day, so the board Status is In Progress.

  6. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1422, merged into release/v0.2.29 as 7abac58.

    Closes #1362

    17 file(s) changed.

    How it was verified

    Check runs at 3c7303d:

    • Prune PR DevContainer Images: pass
    • CodeQL: pass
    • Analyze (python): pass
    • Tests & Coverage: pass
    • Static Analysis: pass
    • Analyze (actions): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1362-closure-reads-shipped-releases.md:

    • plan_close also plans closings for each closed Release that holds an open issue, found from store.issues(). It reads that release's merged pull requests and runs the same _closings, with the same comment template and the same unread rule, and those closings come before the current release's (test_an_item_delivered_into_a_shipped_release_closes_before_the_current_releases, run once with close_release and once with edit_release(state=CLOSED); a second run writes nothing and names no shipped release).
    • When no closed Release holds an open issue, a run makes the same requests it makes today, with no extra listing. With one, it lists pulls?state=closed&base=release%2Fv0.2.25 once. Both hold with and without a current release (test_a_close_runs_gh_argv_sequence_is_its_plan in tests/test_roadmap_dry_runs.py, five cases, a GitHubRoadmapStore over a fake gh runner at the process edge).
    • A shipped release's items don't affect the current release's cut:
      • An open item no merged pull request delivers stays open, is named under its release, and the cut is still planned (test_an_open_item_of_a_shipped_release_no_pull_request_delivers_stays_open_and_named).
      • A shipped pull request with unreadable check runs is named in unread, and devops roadmap close exits 1 and still prints the cut (test_a_shipped_pull_request_with_unreadable_checks_fails_the_run_and_holds_no_cut).
      • A shipped pull request closes no item of another release (test_a_shipped_pull_request_closes_no_item_of_another_release).
      • With no open Release, a shipped release's delivered item still closes and the run holds NO_RELEASE (test_with_no_open_release_a_shipped_releases_delivered_item_still_closes).
    • An item a person reopened in a shipped release stays open, the run writes nothing, and the text names it as reopened by a person (test_a_shipped_item_a_person_reopened_stays_open_and_is_named). A closed release whose only open item a person reopened costs no listing (test_a_close_runs_gh_argv_sequence_is_its_plan[shipped-reopened]).
    • A shipped release's open item that a pull request into the current release's branch closes is listed once, as a closing, and not also as still open (test_a_shipped_item_a_current_pull_request_closes_is_not_also_named_still_open).
    • Closure reads release/vX.Y.Z for a milestone titled without its v, for both a shipped and the current release (test_closure_reads_the_cut_branch_of_a_release_titled_without_its_v, through a GitHubRoadmapStore over the fake gh runner).
    • The text output names each shipped release it read, with its closings and the items left open (the same tests, through render_close).
    • The dry run lists the shipped-release reads under their own condition, before the current release's reads, and still makes no request (test_the_dry_run_lists_a_shipped_releases_reads_before_the_current_releases). test_the_dry_run_lists_the_closes_and_the_cut_without_a_request still passes, and a real run's argv follows the plan (test_a_close_runs_gh_argv_sequence_is_its_plan).
    • The module docstring, HELP.roadmap.close, the roadmap_close MCP docstring and docs/ROUTINE_TASKS.md:245 and :262 say that closure also covers a closed release that still holds an open issue, and the module docstring, HELP.roadmap.close and :262 that it leaves an item a person reopened open. The generated references were regenerated.
    • The tests use the InMemoryRoadmapStore fixture with the fake checks reader, or a fake gh runner at the process edge. They make no network call, and each call phase stays under 1 s (--durations, run serially).
    • uv run devops ci passes within its 5-minute budget: 3m 25s in all and 3m 13s for its test step, measured on 2026-10-08 with one other gate running alongside it.
    • changelog.d/1362.md records the fix. CHANGELOG.md and docs/ROADMAP.md are untouched.
    • Pending a person, after this fix ships in a release and Argo CD rolls out its service image: once a release ships with no item left open by mistake, and one close run has finished after the ship, gh api 'repos/dan-petty/devops-cli/milestones?state=closed&per_page=100' --jq '.[] | select(.open_issues > 0) | .title' prints nothing. The exception is a release whose open items uv run devops roadmap close --plan lists under that release's heading as still open or as reopened by a person.
  7. added a commit that references this issue on Oct 8, 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

    scope/releasesource/agenttype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions