Skip to content

fix(roadmap): refine keeps a cycle step after the edge is gone #6515

Description

@dan-petty

Problem Description

Since #6449 (PR #6505, 494de4f), refine gives an item in a dependency cycle the step person with the text "The item is in a dependency cycle: #A → #B → #A". Two faults keep that step after the edge that made the cycle is gone:

  1. Refine builds the graph once for each round, before it refines an item (plan_refine, graph = DependencyGraph.of(open_items), src/devops_cli/roadmap/refine/refine.py:3724). The cycle check of the refined item uses that graph (held.cycle_of(item.number), refine.py:3388-3389). So the edges of the refined item come from its old job record and its old body (_edges_of, refine.py:1325), not from the new proposal. The open blockers of the same round come from the new proposal (_open_dependencies(store, proposal), refine.py:3387). When a person answers "#A does not depend on #B", the new proposal has no dependency, but the round still names the cycle and sets person. The answer is then used up, so the person must reply a second time.
  2. _still_waiting checks the cycle only in the blocked branch (refine.py:2704-2710). No rule ends a person wait when its cycle is gone. When a person removes the edge #B → #A from the body of #B, #B becomes Ready, but #A keeps person with the old cycle text until #B closes or a person replies.

#6451 will make body_dependencies narrower and remove false edges (for example the "needs this item" link of #4691 ↔ #4814). Each item that refine moves to the cycle step before that release then keeps a stale person wait (fault 2).

docs/roadmap/refine.md also lists no cycle step (lines 9-13), and line 19 still says "The item waits on that issue" for each open dependency.

Reproduction Steps

  1. In a test store, make Release v0.1.8 #1 depend on feat(release): v0.1.8 #2 in its record, and feat(release): v0.1.8 #2 depend on Release v0.1.8 #1 in its Dependencies section. Run a refine round: both items get person with the cycle.
  2. Add a person reply on Release v0.1.8 #1 ("Release v0.1.8 #1 does not depend on feat(release): v0.1.8 #2"), and let the fake model give a proposal with no dependency. Run a refine round on Release v0.1.8 #1.
  3. Actual: Release v0.1.8 #1 gets person with "The item is in a dependency cycle: Release v0.1.8 #1 → feat(release): v0.1.8 #2 → Release v0.1.8 #1", and its section says "Dependencies: None.". Only the next round, after a second reply, gives ready.
  4. Second case: remove the edge feat(release): v0.1.8 #2 → Release v0.1.8 #1 from the body of feat(release): v0.1.8 #2 and run refine on both. feat(release): v0.1.8 #2 goes to ready; Release v0.1.8 #1 keeps person with the old cycle text.

A reviewer reproduced both cases with a fake store and a fake model on 4f0a86f.

Expected vs Actual Behavior

  • Expected: the cycle check of a refined item uses the edges of its new proposal. A person wait whose cycle is gone ends in the next round.
  • Actual: a cycle that the round itself removes still sets person, and a person wait keeps a cycle that no longer exists.

Environment Diagnostics

devops-cli at main 494de4f (2026-11-20), after #6505.

Dependencies

None.

Acceptance Criteria

  • A test written first: a person reply removes the edge, and the model gives no dependency. The same refine round gives no cycle step.
  • A test written first: the edge leaves the body of the other item. The next refine round ends the person wait of the first item.
  • docs/roadmap/refine.md names the cycle step, and says that only an open dependency outside a cycle makes the item wait.

See #6449, #6451.

Alternatives check of 2026-11-20: none.
Tool: none found.
Reason: Searches returned only Python import-cycle tools (depcycle, pydeps, DepMapper), which analyze module imports, not GitHub issue dependency state. Nothing covers refine's internal cycle-step logic; the fix belongs in src/devops_cli/roadmap/refine/refine.py.

Proposed design

Problem statement

Refine can keep a person cycle step after the edge that made the cycle is gone. The cycle check uses the graph built before the round, so a reply that removes an edge still sets the step. No rule ends a person wait whose cycle the current bodies no longer hold. The change decides the cycle step from the new proposal, ends a stale cycle wait, and names the cycle step in the refine guide.

Acceptance criteria

Requirement: Cycle step from proposal edges

The refine round SHALL decide the cycle step of an item from the dependencies of its new proposal and the open blockers of the round, and not from the graph that the round builds before it refines the item.

Scenario: Reply removes the last edge

  • WHEN a person reply removes the last edge of a cycle, the model proposal names no dependency, and uv run pytest tests/roadmap/refine/test_roadmap_refine_cycle.py -k reply_removes_edge runs
  • THEN the test asserts that the same round gives the item no person cycle step and sets its Status to Ready.

Requirement: Stale cycle wait ends

A refine round SHALL end a person wait whose recorded cycle no longer exists in the current bodies and records of the open items.

Scenario: Other body removes the edge

  • WHEN a person removes the edge #2 → #1 from the body of feat(release): v0.1.8 #2, the next round refines Release v0.1.8 #1, and uv run pytest tests/roadmap/refine/test_roadmap_refine_cycle.py -k stale_cycle_wait_ends runs
  • THEN the test asserts that the round clears the person wait of Release v0.1.8 #1 and sets its Status to Ready.

Requirement: Refine guide names the cycle step

The refine guide SHALL name the cycle step and state that only an open dependency outside a cycle makes an item wait.

Scenario: Guide text check

  • WHEN uv run pytest tests/roadmap/refine/test_roadmap_refine_cycle.py -k guide runs
  • THEN the test asserts that docs/roadmap/refine.md names the cycle step and the rule that only an open dependency outside a cycle makes an item wait.

Existing Tool Considered

The alternatives check in the issue body (2026-11-20) gives the verdict none and names no tool. depcycle, pydeps and DepMapper analyze Python module imports, not the dependency state of issues. No open, maintained tool or library covers the cycle step of refine. The change edits existing code in src/devops_cli/roadmap/refine/refine.py. Written cost: about 3,000 tokens to build, keep and fix that code, and about 2 hours of work. The existing refine tests keep it.

Key questions

  • Which dependency edges decide the cycle step of the refined item?: Use the dependencies of the new proposal and the open blockers of the round. Do not use the graph built before the round for the refined item. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py, src/devops_cli/roadmap/dependencies.py, tests/roadmap/refine/test_roadmap_refine_cycle.py]
    • Chosen: Dependencies of the new proposal plus the open blockers of the round. The reply changes the proposal, so the same round must see the removed edge.
    • Rejected: Edges of the graph built before the round. The graph holds the old job record and the old body of the item, so it keeps the cycle that the reply removed.
    • Rejected: Wait for fix(roadmap): read only blockers in a Dependencies section #6451 to narrow the body edges. Items already on the cycle step keep a stale person wait until that release, so the fix must land now.
  • How does a person wait end when its cycle is gone?: Recompute the cycle from the current bodies and records in each round. End the person wait when the recorded cycle no longer exists. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py, docs/roadmap/refine.md]
    • Chosen: Recompute the cycle from the current bodies and records in each round. The body edit removes the edge, so the next round can see that the cycle is gone.
    • Rejected: Wait for the other item to close. The other item becomes Ready when the edge leaves its body, and no close follows.
    • Rejected: Wait for a second person reply. The first reply is used up, so the person must reply again for no reason.
  • Where does the guide describe the cycle step?: Add the cycle step to the list of next steps in docs/roadmap/refine.md. State that only an open dependency outside a cycle makes the item wait. (best practice) [sources: docs/roadmap/refine.md]
    • Chosen: Add the cycle step to the list of next steps in docs/roadmap/refine.md. The list of next steps is the place where the guide names each step.
    • Rejected: Leave the guide unchanged. The guide keeps the false rule that every open dependency makes the item wait.
    • Rejected: Put the rule only in the OpenSpec spec. The issue asks for the guide, and readers use the guide for the next steps.
  • Does this change need a new version of the refine rules?: Yes. Set a later time in CONST_ROADMAP_REFINE_RULES_SINCE, so each item that the old rule left in a cycle wait gets one new look. (best practice) [sources: docs/roadmap/refine.md]
    • Chosen: Set a later time in CONST_ROADMAP_REFINE_RULES_SINCE. The change sets a next step, so the guide requires a later time in the constant, and each item in a stale cycle wait gets one new look.
    • Rejected: Keep the current version of the rules. An item that waits on a person under the older rule then keeps the stale cycle wait until a reply or a body edit.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    on Nov 20, 2026
  2. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor
    • Priority: P2-Medium. A person must reply twice and items stay in a stale person state, but no service, CI, or data is affected. The regression commit 494de4f does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.
    • Related: fix(roadmap): refine looks again when the cause of a wait ends #3483, which asks for a different change. Both address a refine wait that persists after its cause ends; #3483 covers blocked and stage-return waits, while the candidate covers the new cycle person step from #6449.
  3. added
    status/new
    value/medium
    effort/medium
    priority/p2-medium
    on Nov 20, 2026
  4. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  5. 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: no check. A person decides what the new result means for the item.

    Searches (2)

    Searches run:

    • dependency cycle detection library Python graph recompute stale state, results: 5
    • Python library detect dependency cycles between issues roadmap, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 22, 2026
  7. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  8. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 25, 2026
  9. removed
    status/in-review
    owner/agent
    on Nov 25, 2026
  10. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor
  11. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 17:09 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/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions