Skip to content

fix(roadmap): name a dependency cycle instead of waiting #6449

Closed

Description

@dan-petty

Problem Description

No roadmap job checks the dependencies of an item for a cycle. When item A waits on B and B waits on A, refine records the step blocked on each item. Each comment names only the next open item, and each item waits with no end. A person sees no cycle unless they follow the links by hand.

On 2026-11-19, 6 groups of open items are in a cycle. The graph uses the declared dependencies of the 778 open issues. These are refine.blocked_by of the job record and the Dependencies sections that body_dependencies reads. The stage and implement jobs use the same read.

Cycle Edges
#4692 → #4840 → #5219 → #4692, also through #4720 and #4733 #4692 record 4840. #4840 record 4860,5219,5223,5228. #5219 body "Merge first: #4692", #4720 and #4733. #4733 record holds 4720. #4720 body names #4692.
#4805 → #4809 → #4808 → #4805, also #4808 → #4806 → #4805 #4805 record 3077,4787,4809. #4809 body names #4808. #4808 record 4805,4806,3077,4787. #4806 record 4805.
#4691 ↔ #4814 #4691 record 4814. #4814 is Ready, and its body says "#4691 needs this item."
#5348 ↔ #5356 #5348 record 5356. #5356 body: "Related: #5348 adds the agent client side and depends on this item."
#4893 ↔ #4909 #4909 is Ready, and its body names "#4893 owner steps 1 to 6. Child 5 of #4893." Tracker #4893 says "Owner steps 1 to 6 come before child 5 (#4909)." No job refines or stages the tracker #4893, so only the edge #4909 → #4893 holds an item back. This pair is a case of the tracker bug.
#5134 ↔ #5135 #5135 record 5134. #5134 body names #5135.

The stage job holds #4814 and #4909 with no end. devops roadmap explain 4814 gives "Stage job: no. The item depends on the open issue #4691." #4691 waits on #4814.

Cause, at origin/main 0d90de5:

  • validate_proposal (src/devops_cli/roadmap/refine/refine.py:1418-1424) keeps each dependency of the proposal that is a known issue. It does not look at the dependencies of that issue.
  • _open_dependencies (refine.py:1498-1501) keeps each open dependency, and next_step_of (refine.py:1504-1533) makes the step blocked from it.
  • open_dependency (src/devops_cli/roadmap/dependencies.py:30-42) gives the same answer to the stage job (stage.py:771-774) and to the implement job (implement.py:379-382).
  • A search for cycle, graphlib and TopologicalSorter under src/devops_cli/roadmap/ finds no cycle check.
  • Two other bugs make some of the edges. The parse of the Dependencies section reads a related or reverse #N as a blocker (bug "read only blockers in a Dependencies section"). Refine and stage count an open tracker as a blocker (bug "an open tracker holds back no item"). A cycle check is still necessary, because a person or a scope comment can also make a cycle, as on feat(roadmap): read project review facts through a catalog #4692.

Reproduction Steps

  1. Run devops roadmap explain 4814. The stage job leaves perf(k8s): seed the uv cache of a runner pod from the image #4814 out for the open issue feat(k8s): add the CI gate WorkflowTemplate #4691.
  2. Read the job record of feat(k8s): add the CI gate WorkflowTemplate #4691: refine.blocked_by is 4814, and refine.next_step is blocked.
  3. Read the job record of feat(roadmap): read project review facts through a catalog #4692 (4840) and of feat(telemetry): rank CLI usage errors and propose fixes #4840 (4860,5219,5223,5228). Then read the Dependencies section of feat(roadmap): report job grades and fix effects in the project review #5219 (Merge first: feat(roadmap): read project review facts through a catalog #4692).
  4. Give the declared dependencies of the open issues to graphlib.TopologicalSorter(graph).prepare(). It raises CycleError with the path [5219, 4840, 4692, 5219].

Expected vs Actual Behavior

  • Expected: when a dependency of an item leads back to the item, refine records a person step. The step names the full cycle and the edges that make it, so that a person can remove one edge. Stage and implement name the cycle in their reason.
  • Actual: refine records blocked and names the next open item only. Stage and implement say "depends on the open issue #N". The items wait with no end, and no inbox line names a cycle.

Environment Diagnostics

  • DevOps CLI Version: 0.180.0 (origin/main 0d90de5).
  • Execution Environment: the roadmap Service rounds of 2026-11-14 to 2026-11-16 wrote the records. The graph was read on 2026-11-19 through the GitHub REST API.

Logs, Traces, or Terminal Output

$ devops roadmap explain 4814
Refine job: no. The item is Ready. A round takes a Ready item only when no round refined it, or when it holds a covering tool that no round asked about.
Stage job: no. The item depends on the open issue #4691.
Implement job: no. The item depends on the open issue #4691.

Pre-Submission Checklist

Existing Tool Considered

graphlib.TopologicalSorter of the Python standard library finds a cycle and names its path. src/devops_cli/core/import_graph.py:18 already uses it for the import graph. No new dependency is necessary.

Acceptance Criteria

  • Test first: a store with items A and B, where the record of A names B and the Dependencies section of B names A. Refine gives each item a person step that names the cycle A → B → A. The test fails on the base.
  • A test: the stage and implement reason for an item in a cycle names the cycle, not only "depends on the open issue".
  • A test: an item whose dependency is open but not in a cycle keeps the step blocked.
  • The graph is read once for each round from the listing that the round already holds. The round sends no extra GitHub request.
  • Live proof: after the release, the next refine round gives feat(k8s): add the CI gate WorkflowTemplate #4691 or feat(roadmap): read project review facts through a catalog #4692 a person step that names its cycle.

Dependencies

None.

Alternatives check of 2026-11-19: in-use.
The item already names this tool.
Tool: python/cpython (https://github.com/python/cpython), NOASSERTION, last activity 2026-11-19, maintained.
Reason: Searches found no cycle-detection tool beyond the standard-library sorter that the issue already names and uses for the import graph; it finds a cycle and names its path, so only a small adapter remains.

Covers:

  • Raises CycleError that names the cycle path
  • Standard library module, no new dependency
  • Graph build makes no network or store call

Lacks:

  • Reads no issue record or Dependencies section
  • Writes no refine step or stage/implement reason
  • Names one cycle per prepare(); a repeat pass per group is needed

Proposed design

Problem statement

Refine, stage and implement read the declared dependencies of an open item one edge at a time. When item A waits on B and B waits on A, each job names only the next open item, so both items wait with no end and no inbox line names the cycle. The change adds a cycle check to the shared dependency read. It records a person step that names the path, so a person can remove one edge.

Acceptance criteria

Requirement: Refine records a person step for a cycle

Refine SHALL record a step that asks a person, and not blocked, for an open item that a dependency leads back to.

Scenario: Two items in a cycle

  • WHEN a test refines a fake store with items A and B, where the record of A names B and the Dependencies section of B names A
  • THEN the refine record of A and of B holds a step that is not blocked, and its reason names the cycle A → B → A.

Requirement: Stage and implement name the cycle

The shared dependency read MUST give a reason that names the full cycle for an item that a dependency leads back to.

Scenario: The reason that stage and implement give

  • WHEN a test calls open_dependency, which the stage and implement jobs call, for item A with a fake store and the item sequence that holds the cycle A → B → A
  • THEN the reason names the cycle A → B → A, and not only the open issue B.

Requirement: An open dependency outside a cycle stays blocked

An item whose open dependency is in no cycle MUST keep the step blocked.

Scenario: Open dependency with no cycle

  • WHEN a test refines a fake store where item A depends on the open item B, and B depends on no open item
  • THEN the refine record of A holds the step blocked and its reason names no cycle.

Requirement: One graph for each round

The cycle check MUST build its graph from the item sequence of the round and MUST make no store or GitHub call.

Scenario: The check makes no call

  • WHEN a test gives the check the item sequence of a round that holds the cycle A → B → A and a fake store that counts each call
  • THEN the check returns the path A → B → A and the fake store counts no call.

Requirement: Each item of a shared cycle is named

The check SHALL name a path for each item of a cycle, also when two cycles share an edge.

Scenario: Two cycles that share an edge

  • WHEN a test gives the check the items of the cycles A → B → A and A → B → C → A
  • THEN the check returns a path for each of A, B and C.

Requirement: The live roadmap names the cycle

After the release, devops roadmap explain MUST name the cycle that holds an item of a group that a person made.

Scenario: Explain names the cycle

Existing Tool Considered

graphlib.TopologicalSorter of the Python standard library (python/cpython), verdict in-use: the issue already names the tool, and src/devops_cli/core/import_graph.py:18 uses it for the import graph. The alternatives check of 2026-11-19 in the issue body gives what the tool covers and what it lacks. The proposal fills the one gap that the block names, and it does so without a repeat pass: the round calls TopologicalSorter(graph).prepare() once, and when it raises CycleError the check walks the one graph from each item's open dependencies back to that item. An edge that two cycles share then cannot hide one of them. The adapter is about 15 lines in src/devops_cli/roadmap/dependencies.py and adds no dependency.

Key questions

  • Which tool detects a dependency cycle?: graphlib.TopologicalSorter of the Python standard library. The alternatives check of 2026-11-19 gives the verdict in-use, and the project already uses the module for the import graph. (best practice) [sources: src/devops_cli/core/import_graph.py:18]
    • Chosen: graphlib.TopologicalSorter. Standard library, already used at src/devops_cli/core/import_graph.py:18; no new dependency.
    • Rejected: networkx. Adds a dependency for a check that the standard library gives.
    • Rejected: a hand-written topological sort. Keeps a sort and a cycle check in the project that the standard library gives and tests.
  • Where does the cycle check live?: In src/devops_cli/roadmap/dependencies.py, beside open_dependency. The stage and implement jobs call that function, and refine reads the same body dependencies, so one change reaches all three jobs. (best practice) [sources: src/devops_cli/roadmap/dependencies.py, src/devops_cli/roadmap/refine/refine.py:1498, src/devops_cli/roadmap/stage/stage.py:771, src/devops_cli/roadmap/implement/implement.py:379]
    • Chosen: dependencies.py beside open_dependency. The shared read; stage and implement call it and refine reads the same section.
    • Rejected: a new module src/devops_cli/roadmap/cycle.py. A second module for one function; each call site imports two modules.
    • Rejected: inside refine.py only. Stage and implement keep the old reason and name no cycle.
  • How does the round build the graph one time and send no request?: The round builds one graph from the item sequence that it already holds and gives it to each call. The check reads no issue and sends no request. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py:1418, src/devops_cli/roadmap/dependencies.py]
    • Chosen: one graph for each round, passed to each call. The round holds the item listing, so one build and no request.
    • Rejected: build the graph in each call. The same graph is built one time for each item of the round.
    • Rejected: read each dependency record from GitHub. An extra request for each item, and the round already holds the listing.
  • How does the check name the cycle of each item, also when two cycles share an edge?: The round calls TopologicalSorter(graph).prepare() once. When it raises CycleError, the check walks the one graph from each item's open dependencies back to that item and records the path. Each item in a cycle gets its own path. (best practice) [sources: src/devops_cli/core/import_graph.py:18]
    • Chosen: prepare() once as the gate, then a walk for each item. A path for each item; an edge that two cycles share cannot hide one of them, as feat(roadmap): read project review facts through a catalog #4692's group shows.
    • Rejected: one prepare() and the first CycleError path. Names one cycle for each round, so the other groups keep waiting.
    • Rejected: repeat prepare() with the closing edge removed. An edge removed for one cycle breaks another cycle that shares it, so its items stay unnamed.
  • What does refine record for an item in a cycle?: A step that asks a person, with the path in its reason. blocked says the item waits on an outside event, and a cycle waits on no outside event, so a person must remove one edge. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/refine/refine.py:1504, src/devops_cli/roadmap/refine/refine.py:3308]
    • Chosen: the step that asks a person, with the cycle in the reason. The issue asks for a person step, and a person must remove one edge.
    • Rejected: keep blocked and add the cycle to its reason. CONTEXT.md gives blocked as a wait on an outside event, and no person acts on it.
    • Rejected: a new step value for a cycle. A new value in the step vocabulary for one case.
  • What do the stage and implement jobs say for an item in a cycle?: open_dependency returns the cycle reason. The stage and implement call sites change nothing and name the path. (best practice) [sources: src/devops_cli/roadmap/dependencies.py, src/devops_cli/roadmap/stage/stage.py:771, src/devops_cli/roadmap/implement/implement.py:379]
    • Chosen: open_dependency returns the cycle reason. One change gives stage and implement the cycle at their call sites.
    • Rejected: change each call site in stage and implement. Three copies of the same logic.
  • Does the round hold the item records that the graph needs?: Yes. Refine holds the items of the round and gives that sequence to the dependency read, so the check builds its graph from it and sends no request. [sources: src/devops_cli/roadmap/refine/refine.py:1418, src/devops_cli/roadmap/dependencies.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

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

    @dan-petty
    OwnerAuthor
    • Priority: P1-High. Six groups of open items are permanently stuck with no end, blocking downstream work.
    • Related: fix(roadmap): refine holds back an item with an open dependency #3500, which asks for a different change. Both deal with refine blocking an item on an open dependency, but #3500 fixes a single open dependency blocking while the candidate detects a multi-edge cycle that no single fix can resolve.
  3. added
    scope/roadmap
    status/new
    effort/medium
    value/high
    priority/p1-high
    on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 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 19, 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 (8)

    Tools considered:

    Searches run:

    • Python graphlib TopologicalSorter CycleError detect dependency cycle, results: 5
    • find dependency cycles between GitHub issues library, results: 5
    • docs.python.org graphlib TopologicalSorter CycleError, results: 5
    • networkx simple_cycles find_cycle documentation, results: 5
    • "graphlib" "Functionality to operate with graph-like structures" TopologicalSorter, results: 5
    • TopologicalSorter prepare CycleError path python standard library, results: 5
    • python 3 graphlib module reference topological sort stdlib, results: 5
    • https://docs.python.org/3/library/graphlib.html, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 19, 2026
  7. devops-cli-service commented on Nov 19, 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/service
    and removed
    owner/service
    on Nov 20, 2026
  9. 12 remaining items

  10. added
    status/in-review
    and removed
    status/in-progress
    on Nov 20, 2026
  11. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Pull request #6505 is ready for review. The checks passed.

    Spend: 225 model requests, 21620705 input tokens, 88542 output tokens.

  12. removed
    owner/service
    on Nov 20, 2026
  13. removed
    status/in-review
    on Nov 20, 2026
  14. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor
  15. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-20 16:25 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/p1-highscope/roadmapsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions