Skip to content

fix(roadmap): a reply made while a refine round posts its comment is lost #6371

Description

@dan-petty

Problem Description

A refine round reads the comments of an item before its model calls (refine_one_item in src/devops_cli/roadmap/refine/refine.py). It posts its comment at apply time, after the model calls. The next round reads the replies since refine's last comment, and a reply ends the wait only when it is at or after the start of the wait. A person can reply after the read and before the comment posts. That reply is older than the comment, so no later round sends it to the model, and it ends no wait. The reply is lost until another event ends the wait.

PR #6353 (#6196) closes this gap for a round that posts no comment: it records the time of the read as refine.repeated_at. A round that posts its comment still starts the wait at the time of the comment.

Reproduction Steps

  1. Refine posts a frame on an item at time T.
  2. A round at T+10 min reads the comments and calls the model. The result changes, so the round posts a comment at apply time T+12 min.
  3. A person replies at T+11 min.
  4. The next round runs at T+17 min.

Expected vs Actual Behavior

Expected: the next round sends the reply of T+11 min to the model.
Actual: the reply is older than refine's last comment (T+12 min), so the round keeps the item waiting and the model never reads the reply.

Environment Diagnostics

The base of main after #6196. The test test_a_reply_made_while_a_round_with_no_comment_runs_ends_the_wait in tests/roadmap/refine/test_roadmap_refine_event_comment.py shows the case of a round with no comment.

Logs, Traces, or Terminal Output

None. A time-travel test with plan_refine, a reply, and then apply_refine shows the case.

Source: #6353

Alternatives check of 2026-11-19: none.
Tool: none found.
Reason: Searches found no tool or library for comment cursors or read-time watermarks; the need is an internal fix to the project's own refine loop, recording the read time as PR #6353 already does.

Lacks:

  • No external tool for comment cursors or read watermarks
  • Wait boundary must be the read time, not the comment time
  • Replies older than refine's own comment must still reach the model

Proposed design

Problem statement

Refine reads the comments of an item before its model calls. It posts its comment after the model calls. A person can reply between the read and the comment. That reply is older than refine's last comment, so no later round sends it to the model and it ends no wait. The fix records the time of the read on every round and starts the wait and the reply cursor at that time.

Acceptance criteria

Requirement: The read time is recorded

A refine round that writes a result for an item SHALL record the time at which it read the comments of the item.

Scenario: A round that posts a comment records its read time

  • WHEN a round reads the comments of an item at time T and posts its comment at time T+2
  • THEN the job record of the item holds the time T under RefineRecordKey.READ_AT

Requirement: A reply made during the round reaches the model

The next round MUST send to the model each comment of a trusted person that a person made after the recorded read time.

Scenario: A reply between the read and the comment is in the next request

  • WHEN a person replies at time T+1, after the read at time T and before the comment of the round at time T+2
  • THEN the request of the next round holds that reply in replies and the round refines the item

Requirement: A reply already read does not end the next wait

A comment of a trusted person made at or before the recorded read time SHALL NOT end the wait of the item.

Scenario: A reply before the read does not end the wait

  • WHEN the only comment of a person follows refine's last comment of an earlier round and is older than the recorded read time
  • THEN the next round keeps the item waiting and sends no reply to the model

Requirement: Refine's own comment does not end the wait

A comment that refine wrote MUST NOT end the wait of the item.

Scenario: The comment of the round does not make the next round look again

  • WHEN the round posts its comment at time T+2, after its read at time T, and no person replies
  • THEN the next round keeps the item waiting and sends no reply to the model

Requirement: A failed round records no read time

A round that fails its job MUST NOT record a read time for the item.

Scenario: A reply read by a failed round is sent again

  • WHEN a round reads a reply of a person and then fails with a job failure
  • THEN the job record of the item holds no read time from that round and the next round sends the reply to the model

Requirement: An item with no recorded read time uses refine's last comment

A round SHALL start the wait at the time of refine's last comment when the job record of the item holds no read time.

Scenario: An item whose record holds only the earlier repeat time keeps its wait

  • WHEN the job record of the item holds RefineRecordKey.REPEATED_AT and no RefineRecordKey.READ_AT
  • THEN the round sends the replies that follow refine's last comment and records the read time of this round

Existing Tool Considered

The alternatives check of 2026-11-19 in the issue body records the verdict none, and its block names the need and what no tool covers. The change is therefore an internal fix to the refine loop of this repository. The written cost is about 25,000 tokens to build it and about 5,000 tokens for each later fix. The elapsed time is about half a day.

Key questions

  • Which job-record key holds the time at which a round read the comments?: Add RefineRecordKey.READ_AT and write it on every round that writes a result. No round writes RefineRecordKey.REPEATED_AT after this change. An item whose record holds only the older key starts its wait at refine's last comment for one round, and it loses no reply. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py, src/devops_cli/roadmap/stores/store.py]
    • Chosen: new READ_AT key. The key names the time that it holds. The repeated flag still decides whether the round posts a comment.
    • Rejected: reuse REPEATED_AT. The name states that the result is the one of the round before. A round that posts a comment does not repeat the round before.
    • Rejected: no new record. This is the defect: the wait starts at the time of refine's last comment, which is after the lost reply.
  • What ends the wait of an item that a round refined and commented on?: A comment of a trusted person made after the recorded read time. A comment that refine wrote does not end the wait. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py, src/devops_cli/roadmap/trust.py]
    • Chosen: read time with a trusted author. It catches the reply between the read and the comment. It leaves out refine's own comment, so no round looks at the item again for its own comment.
    • Rejected: refine's last comment. This is the defect: the reply of time T+1 is older than the comment of time T+2.
    • Rejected: read time with no author filter. Refine's own comment follows the read time, so each round would look at the item again with no end.
  • Which comments reach the model as replies?: The comments of trusted authors made after the recorded read time. Use refine's last comment when the record holds no read time. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py, src/devops_cli/roadmap/trust.py]
    • Chosen: since the recorded read time. It sends the reply that the round before did not read, and it sends no reply twice.
    • Rejected: since refine's last comment. It drops the reply made between the read and the comment. This is the defect.
  • Does a round that fails its job record the read time?: No. The next round reads the same comments again and sends them to the model. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py]
    • Chosen: record no read time on a job failure. A job failure writes no body and no comment. A recorded time would drop the replies that the round read.
    • Rejected: record the read time on every round. The replies of a failed round would never reach the model.
  • Which start of the wait does an item use when its record holds no read time?: Refine's last comment, as before. The round then records the read time of its own read. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py, tests/roadmap/refine/test_roadmap_refine_event_comment.py:222, tests/roadmap/refine/test_roadmap_refine_recorded_wait.py]
    • Chosen: fall back to refine's last comment. An item that waits now holds only the older repeat key. It loses no reply, and its next round records the read time.
    • Rejected: read the older repeat key as the read time. It keeps a key that no round writes after this change.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 19, 2026
  2. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
  3. added
    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:

    • open source tool comment thread reply cursor timestamp lost replies sync, results: 5
    • GitHub event cursor read timestamp comment sync race condition library, results: 5
    • library track comments since timestamp avoid missing replies between read and write, 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/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/lowpriority/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