Skip to content

fix(roadmap): refine looks again at an edited Ready item #6452

Done

Description

@dan-petty

Problem Description

Refine never looks again at a Ready item that a person opened, also after a person edits the body or adds a scope comment. When the edit or the comment adds a blocker, the item keeps status/ready and the old Dependencies of the refine section. The stage job reads only the Dependencies section of the body. So a blocker that is in a comment, or in another section of the body, does not hold the stage job back.

Examples (checked 2026-11-19):

Today the stage job holds #4574 because its Dependencies section names 4 open items by quoted title (#4565, #4568, #4573, #4567, the fix of #4803). #5026, #4566 and #5504 are not in that section. When the 4 title dependencies close, the stage job can take #4574 while #5026, #4566 or #5504 is still open.

Cause, at origin/main 0d90de5:

  • _refinable (src/devops_cli/roadmap/refine/refine.py:2830-2846) takes a Ready item in three cases only. The item has no refine record (_is_unrefined_ready, refine.py:2820-2827). It holds a covering tool that no round asked about (_needs_second_look, refine.py:663-675). Or a bot opened it and the approval no longer holds (is_approved, src/devops_cli/roadmap/trust.py:54-62).
  • is_approved is always true for an item that a person opened, so a body edit does not end the Ready state.
  • The module docstring gives the wait rules: a comment after the start of the wait, a closed blocker, or a changed watched file. These rules apply only to an item that waits. A Ready item does not wait.
  • docs/roadmap/refine.md:19 says that a Ready item with an open dependency "goes back to New". No round reaches a refined Ready item, so this does not occur.
  • feat(roadmap): refine looks again when a related item merges #5515 (open) makes refine due for the dependents of a merged item. Its due mark meets the same Ready filter in _refinable. So this change also lets feat(roadmap): refine looks again when a related item merges #5515 reach a Ready dependent.

Reproduction Steps

  1. Run devops roadmap explain 4574.
  2. Read the Refine line: "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."
  3. Read the comment of 2026-11-12T10:13Z on feat(roadmap): run the reconcile sweep on a cluster schedule #4574. It names refactor(roadmap): run the stage cleanup in the status lane #5026 and feat(k8s): let Argo Workflows run roadmap pods in devops #4566 under "Merge first", and both are open.
  4. Read the refine section of feat(roadmap): run the reconcile sweep on a cluster schedule #4574: Dependencies "None.", and checked-at 818ac6f.

Expected vs Actual Behavior

  • Expected: a Ready item gets one refine round after a person edits the text outside the refine section. A trusted comment after the last round also gives one round. The round sets the item back to New when it finds an open blocker. Then the refine section names the blocker, and the stage job reads it.
  • Actual: the item stays Ready with the old section. The new blockers are only in a comment or in another section, and no job reads them as blockers.

Environment Diagnostics

  • DevOps CLI Version: 0.180.0 (origin/main 0d90de5).
  • Execution Environment: devops roadmap explain in the devcontainer on 2026-11-19. Hashes from body_hashes (src/devops_cli/roadmap/body_hash.py:63) on the current bodies, with the job record removed.

Logs, Traces, or Terminal Output

$ devops roadmap explain 4574
Phase: ready. Phase age: 5d 20h 38m.
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 #4565, #4568, #4573, #4567.

Pre-Submission Checklist

Existing Tool Considered

A change of the selection rule of refine. The record already holds refine.body_hash and refine.comments_seen, so the test needs no new read. No tool applies. Cost: about 40,000 tokens and 1 hour.

Acceptance Criteria

Dependencies

None.

Alternatives check of 2026-11-19: none.
Tool: none found.
Reason: Searches returned only unrelated tools, such as OWASP Dependency-Track and stale-issue helpers; none offers a refine selection rule, a hash of the body outside the refine section, or a Ready item trigger from an edit or trusted comment.

Proposed design

Problem statement

Refine does not select a Ready item again after a person edits the body or adds a trusted comment. The item keeps status/ready and the old Dependencies section. The stage job reads only that section. It can plan the item while a new blocker is open. Refine must select such an item again and set it back to New when it finds an open blocker.

Acceptance criteria

Requirement: Edited Ready item is refinable

Refine SHALL select an open Ready item again when the hash of the text outside its refine section differs from refine.body_hash.

Scenario: Person edits the body of a Ready item

  • WHEN a test builds an open Ready item with a refine record whose refine.body_hash is the hash of the old text outside the refine section, writes a new body, and calls _refinable with unrefined_ready=False and no trusted comment
  • THEN the test asserts that _refinable returns the item

Requirement: New trusted comment is refinable

Refine SHALL select an open Ready item again when a trusted comment is newer than its last refine round.

Scenario: Person comments on a Ready item

  • WHEN a test builds an open Ready item with a refine record and a comment by a trusted person after its last refine round, and calls _refinable with unrefined_ready=False
  • THEN the test asserts that _refinable returns the item

Requirement: Bot comment is not refinable

Refine MUST NOT select an open Ready item again for a comment that a bot wrote.

Scenario: Bot comments on a Ready item

  • WHEN a test builds an open Ready item with a comment after its last refine round from a bot, and calls _refinable with unrefined_ready=False
  • THEN the test asserts that _refinable returns an empty list

Requirement: Unchanged Ready item is not refinable

Refine MUST NOT select an open Ready item when its text matches refine.body_hash and no trusted comment is newer than its last refine round.

Scenario: Sweep with no edit and no new comment

  • WHEN a test builds an open Ready item with a matching refine.body_hash, no trusted comment after its last refine round, and calls _refinable with unrefined_ready=False
  • THEN the test asserts that _refinable returns an empty list

Requirement: Round records the edited body hash

A refine round on a Ready item SHALL record refine.body_hash as the hash of the text outside the refine section.

Scenario: A round keeps a Ready item Ready

  • WHEN a test calls apply_refine on a Ready item with a plan that adds no dependency and with a body edited outside the refine section
  • THEN the test asserts that refine.body_hash equals body_hashes(item.body)[0]

Requirement: Refine section write does not change the body hash

The value that refine.body_hash records MUST NOT change when a round writes only the refine section.

Scenario: A round writes the refine section

  • WHEN a test calls body_hashes on a body, writes a new refine section into the body, and calls body_hashes on the result
  • THEN the test asserts that the body hash is the same before and after the write

Requirement: Open blocker returns a Ready item to New

A refine round that finds an open issue as a dependency MUST set the item Status to New and name the open issue in refine.blocked_by and in the refine section.

Scenario: New scope comment names an open blocker

  • WHEN a test calls apply_refine with a plan whose proposal names an open issue as a dependency
  • THEN the test asserts that the item Status is New, that refine.blocked_by names the open issue, and that the refine section lists the open issue under Dependencies

Requirement: Explain names the edited body

devops roadmap explain MUST report the edited body as the reason that refine is due.

Scenario: Explain an edited Ready item

  • WHEN a test calls explain_item and render_explanation on a Ready item whose body differs from refine.body_hash
  • THEN the test asserts that the rendered Refine line names the edit of the body

Requirement: Explain names the new comment

devops roadmap explain MUST report a new trusted comment as the reason that refine is due.

Scenario: Explain a Ready item with a new comment

  • WHEN a test calls explain_item and render_explanation on a Ready item with a trusted comment after its last refine round
  • THEN the test asserts that the rendered Refine line names the new comment

Existing Tool Considered

The alternatives check in the issue body returned none on 2026-11-19 and found no tool. The change builds its own code: about 40,000 tokens to build, keep and fix it, and about 1 hour.

Key questions

  • Which Ready items does refine select today?: _refinable selects an open item when its Status is New, when it is a Ready item with no refine record (_is_unrefined_ready), when it is a Ready item that holds a covering tool no round asked about (_needs_second_look), or when it is a Ready item that a bot opened and is_approved no longer accepts. is_approved returns true for an item that a person opened. An edit or a comment does not end the Ready state of that item. [sources: src/devops_cli/roadmap/refine/refine.py:3297, src/devops_cli/roadmap/refine/refine.py:3287, src/devops_cli/roadmap/refine/refine.py:680, src/devops_cli/roadmap/trust.py:54]
  • What does refine.comments_seen hold today, and which round writes it?: refine.comments_seen holds an integer comment count, as str(item.comments). It is not a list of comment IDs. _refine_marks writes it only on a waiting New item. It does not write it on a Ready item. [sources: src/devops_cli/roadmap/stores/store.py:155, src/devops_cli/roadmap/stores/store.py:182, src/devops_cli/roadmap/refine/refine.py:4376, tests/roadmap/refine/test_roadmap_refine_recorded_wait.py:105, openspec/specs/roadmap-refine/waits/spec.md:107]
  • How does _refinable learn about comments and their authors?: The caller passes the comments of each item and a trust predicate to _refinable. The trust predicate accepts a comment from a person and rejects a comment from a bot. _refinable keeps no store dependency. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py:3297, src/devops_cli/roadmap/trust.py:54, src/devops_cli/roadmap/refine/refine.py:4376]
    • Chosen: Pass comments and a trust predicate into _refinable. The caller has the store. The function can then compare a trusted comment with the last round and keep one selection rule.
    • Rejected: Read comments inside _refinable. _refinable takes only a sequence of items. It has no store and cannot read comments.
    • Rejected: Use refine.comments_seen as a list of comment IDs. The key holds an integer count. _refine_marks does not write it on a Ready item.
  • How does refine tell that a person edited the body of a Ready item?: Compare the current hash of the text outside the refine section from body_hashes with refine.body_hash. (best practice) [sources: src/devops_cli/roadmap/body_hash.py:444, src/devops_cli/roadmap/refine/refine.py:3297, docs/roadmap/refine.md:19]
    • Chosen: Hash the text outside the refine section and compare it with refine.body_hash. The record already holds the hash. The refine section is left out, so a round does not make the item due again.
    • Rejected: Hash the whole body and compare it with refine.body_hash. A round writes the refine section, so every item would be due after each round.
    • Rejected: Compare the title and the body. The record holds no title hash. A new blocker is in the body or in a comment.
  • Which comments make a Ready item due again?: A comment from a trusted author after the last refine round makes the item due again. The last round time is refine.repeated_at when the record sets it, else the time of the newest refine comment. A comment from a bot does not make the item due. (best practice) [sources: docs/roadmap/refine.md, src/devops_cli/roadmap/trust.py:54, src/devops_cli/roadmap/refine/refine.py:3297]
    • Chosen: A trusted comment after the last round. It catches a new scope comment. It leaves out a bot comment, so the item does not stay due.
    • Rejected: Any comment after the last round. A bot comment, such as a stage comment, would make the item due again and again.
    • Rejected: A new comment count in refine.comments_seen. The key holds a count and is not written on Ready items. A bot comment would also change the count.
  • Does the new rule apply to every Ready item or only to the items that a person opened?: It applies to every Ready item. (best practice) [sources: src/devops_cli/roadmap/trust.py:54, src/devops_cli/roadmap/refine/refine.py:3297]
    • Chosen: Every Ready item. The record exists for each refined item. is_approved reads the body only, so a new comment on an item that a bot opened is not caught today.
    • Rejected: Only the Ready items that a person opened. It leaves the same gap for an item that a bot opened and a person later comments on.
  • What does a round do when it finds an open blocker on a Ready item?: It sets the item Status to New and names the open issue in the refine record and in the Dependencies part of the refine section. (best practice) [sources: docs/roadmap/refine.md:19, src/devops_cli/roadmap/refine/refine.py:4568]
    • Chosen: Set Status to New and name the open issue in the refine section. The stage job reads the Dependencies section of the body. The open issue then holds the stage job back.
    • Rejected: Keep Status Ready and add a note. The stage job reads only the Dependencies section. It would plan the item while the blocker is open.
  • Should devops roadmap explain report the new reason?: Yes. Add the edited body and the new trusted comment to the reason that the command prints. (best practice) [sources: tests/roadmap/test_roadmap_explain.py, src/devops_cli/roadmap/refine/refine.py:3297]
    • Chosen: Report the edit and the new comment in the reason. The reproduction reads that line. A stale reason misleads a person.
    • Rejected: Leave the reason unchanged. The line would say the item is not due while the sweep selects it.
  • Which tests prove the new rule offline?: Tests under tests/roadmap/refine/ build a Ready item with a refine record and call _refinable with comments. The helpers in tests/support/roadmap_refine.py build the item and its record. A test in tests/roadmap/test_roadmap_explain.py reads the Refine line. [sources: tests/roadmap/refine/test_roadmap_refine_selection.py, tests/roadmap/test_roadmap_explain.py, tests/support/roadmap_refine.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
  3. added
    scope/roadmap
    status/new
    value/medium
    effort/medium
    priority/p2-medium
    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 (3)

    Searches run:

    • GitHub issue dependency tracking blocked by field API, results: 5
    • open source tool detect issue body edits and new comments re-run triage, results: 5
    • GitHub issue dependencies "blocked by" REST API sub-issues, 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. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Returned to New: the refined specification for #6452 assumes a refine.comments_seen format and a _refinable signature that do not exist on origin/main.

    Evidence from origin/main:

    • src/devops_cli/roadmap/stores/store.py:155-158, 182 and openspec/specs/roadmap-refine/waits/spec.md:107: RefineRecordKey.COMMENTS_SEEN ("refine.comments_seen") holds an integer comment count (str(item.comments)), not a list of comment IDs (src/devops_cli/roadmap/refine/refine.py:2710, 2728, tests/roadmap/refine/test_roadmap_refine_recorded_wait.py:105-108).
    • src/devops_cli/roadmap/refine/refine.py:4376-4408 (_refine_marks): does not write RefineRecordKey.COMMENTS_SEEN when refining a Ready item (only _read_marks writes it on waiting New items); additionally, existing Ready fixtures in tests/roadmap/test_roadmap_explain.py:553-559 set placeholder BODY_HASH: "body" without hashing the body or setting COMMENTS_SEEN.
    • src/devops_cli/roadmap/refine/refine.py:3232-3247 (_refinable(items, *, unrefined_ready)): takes Sequence[Item] only, with no RoadmapStore parameter and no access to individual comment IDs or authors (is_person_comment), so _refinable cannot distinguish a trusted comment from a bot comment (Scenario: Bot comments on a Ready item).

    Per AGENTS.md Rule 2, no compensating change to _refinable or refine.comments_seen was made here. Refine can specify either a new record key for seen comment IDs/counts written on Ready items and passing comment/trust lookup into candidate selection, or another design matching origin/main.

  9. removed
    status/ready
    on Nov 25, 2026
  10. 3 remaining items

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

    @devops-cli-service
    Contributor

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

  12. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 25, 2026
  13. added
    status/in-review
    and removed
    status/in-progress
    on Nov 25, 2026
  14. removed
    status/in-review
    owner/agent
    on Nov 25, 2026
  15. 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