Repository navigation
Description
Problem
Refine reads the comments of each item that waits, also when nothing changed on the item. These reads are the largest part of the Service GET requests. Evidence from #3497, in the window 2026-11-03T15:05Z to 2026-11-04T15:05Z:
- The Service sent 39248 GitHub requests. 38179 of them were GET requests (97.3%).
- Refine sent 7727 GET requests, 7069 of them in devops-cli. 7069 reads over 160 New items fit about 44 reads for each item. This is inferred, because the metric has no endpoint label.
The code at origin/main f6d57ec:
_Selection.considercalls_still_waitingfor an unchanged item (src/devops_cli/roadmap/refine.py:1813)._still_waitingcallscomments_on(item.number)to find a reply, and uses the time of the last comment for two more exits:_cited_code_changed(feat(roadmap): refine looks at a blocked item again when the code its block cites changes on main #2005) and_named_cause_ended(fix(roadmap): refine looks again when the cause of a wait ends #3483) (src/devops_cli/roadmap/refine.py:1701).- The module docstring (
src/devops_cli/roadmap/refine.py:15and:34) says that an unchanged item costs no body read, and one comment read for each item that waits.
A conditional GET does not repair this cost. A page with no next link is not stored, so a single-page comment list never answers 304 (ADR 0006).
Expected
A refine round reads the comments of a waiting item only when its updated_at changed since refine last read them. The round keeps the other exits with no comment read: a closed blocker, a commit that changed a cited path, and an issue or file that a wait on a person names. So the job record keeps what these exits need, such as the time of the last refine comment and the text of the wait.
Acceptance criteria
- A test: a refine round with no changed item makes no comment read.
- A test: a closed blocker and a changed cited path still end a wait with no change of
updated_at. - The docstring of
src/devops_cli/roadmap/refine.pystates the new cost. - After this change is live,
sum(increase(devops_cli_github_requests_total{job="roadmap-service"}[24h]))is lower than the baseline of 39248 by a share that the plan states. This query gives the baseline at 2026-11-04T15:05Z. This criterion moved here from fix(service): the rows stop repeating reads that find no change #3497 because this part removes the largest cost. The plan states the other changes that are live at the time of the measure.
Existing tool considered
Item.updated_at covers the main cost, and the job record already holds the state of refine. hishel is a maintained HTTP cache for httpx, but it meets the same last-page rule, so it does not help. This change adds no library.
Related
Split from #3497, which holds the evidence. It holds criteria 2, 3, 4 and 10 of that issue.
Related: #3497, #2005, #3483, #1758, #3631, #3495
Source: #3497
Proposed design
Problem statement
Refine reads the comments of every waiting item in each round, even when the item did not change. These reads are the largest part of the Service GET requests. The change reads comments only when the item's updated_at changed, and it keeps the other wait exits from recorded state.
Acceptance criteria
Requirement: Unchanged item reads no comments
A refine round SHALL make no comment read for a waiting item whose updated_at equals the value recorded when refine last read its comments.
Scenario: Unchanged item skips the comment listing
- WHEN A refine round considers a waiting item with an unchanged
updated_at. - THEN The fake store records no
comments_oncall for that item.
Requirement: A reply still ends the wait
A refine round SHALL read comments and end a wait when updated_at differs from the recorded value and a reply follows refine's last comment.
Scenario: Changed item reads a reply
- WHEN A waiting item has a different
updated_atand a reply after refine's last comment. - THEN The round reads the comments and ends the wait.
Requirement: A closed blocker ends the wait with no comment read
A refine round SHALL end a wait on an unchanged item when every recorded blocker is closed, without reading the item's comments.
Scenario: Closed blocker ends the wait
- WHEN A waiting item has an unchanged
updated_atand every recorded blocker is closed. - THEN The round ends the wait and the fake store records no
comments_oncall.
Requirement: A changed cited path ends the wait with no comment read
A refine round SHALL end a wait on an unchanged item when a commit changed a recorded block path at or after the recorded time of refine's last comment, without reading the item's comments.
Scenario: Changed cited path ends the wait
- WHEN A waiting item has an unchanged
updated_atand a later commit changed a recorded block path. - THEN The round ends the wait and the fake store records no
comments_oncall.
Requirement: A named cause ends the wait with no comment read
A refine round SHALL end a wait on an unchanged item when the issue or file named in the recorded wait text ends, without reading the item's comments.
Scenario: Named cause ends the wait
- WHEN A waiting item has an unchanged
updated_atand the issue or file named in its recorded wait text is closed or changed. - THEN The round ends the wait and the fake store records no
comments_oncall.
Requirement: The job record holds the wait state
Refine SHALL record the item's updated_at after a comment read, the time of its last comment, and the text of its wait in the job record.
Scenario: Record holds the state for later rounds
- WHEN Refine writes a wait on an item.
- THEN The job record holds the item's
updated_at, the time of the last refine comment, and the wait text.
Requirement: The docstring states the new cost
The module docstring of src/devops_cli/roadmap/refine.py SHALL state that an unchanged waiting item costs no comment read and one body read.
Scenario: Docstring states the cost
- WHEN A test reads the module docstring.
- THEN The docstring states that refine reads comments only when
updated_atchanges and states the remaining body read cost.
Existing Tool Considered
No alternatives check has run. Item.updated_at and the existing refine job record cover the need, and the change adds no library. hishel is an open, maintained HTTP cache for httpx, but it lacks the ability to cache a single-page comment list under ADR 0006: GitHub does not store a page with no next link, so the list never answers 304. The change builds no new library.
Key questions
- How does an unchanged refine item avoid a comment read while a reply still ends its wait?: Record the item's
updated_atwhen refine reads comments. Read comments again only whenupdated_atdiffers. A reply with a newupdated_atstill ends the wait. (best practice) [sources: src/devops_cli/roadmap/refine.py:1813, src/devops_cli/roadmap/refine.py:1701]- Chosen: Record the last comment read
updated_atin the job record. The job record already holds refine state, andupdated_atchanges on a new comment. - Rejected: Use a conditional GET for the comment list. A single-page comment list is not stored, so it never answers 304 (ADR 0006).
- Rejected: Read comments in every round. This keeps the largest part of the Service GET requests.
- Chosen: Record the last comment read
- What state must the refine job record keep so a closed blocker, a changed cited path and a named cause end a wait without comments?: Keep the item's
updated_atat the last comment read, the time of refine's last comment, and the text of the wait. These three values feed the exits that no longer read comments. (best practice) [sources: src/devops_cli/roadmap/refine.py:1723, src/devops_cli/roadmap/refine.py:1772, openspec/changes/archive/2026-10-24-2005-refine-block-paths/design.md:23, docs/adr/0001-github-is-the-roadmap-source.md]- Chosen: Store the watermark, last comment time and wait text. The three exits then need no comment read.
- Rejected: Store only the comment read watermark.
_cited_code_changedneeds the last comment time and_named_cause_endedneeds the wait text. - Rejected: Read comments to get the time and text. That keeps the cost that the change removes.
- Where does refine keep this state?: In the hidden refine job record in the issue body, as ADR 0001 requires. [sources: docs/adr/0001-github-is-the-roadmap-source.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 5, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.It removes the largest share of GET requests but does not break a feature or expose a security risk.It cuts the largest cost in the Service GET budget and lowers rate-limit pressure for all users.It needs a new field in the job record, a conditional read in _still_waiting, updated docstrings, and two tests.Both reduce refine API cost, but #1539 targets settled items and body or model reads while this candidate targets waiting items and comment reads.fix(service): count each GitHub request with its HTTP status (#3686)
devops-cli-service commentedon Nov 6, 2026
Status set to Ready at a0f9557 (see proposed design in issue body).
Moved to new items: #3866.
dan-petty commentedon Nov 7, 2026
Answer from project standards, under the owner's instruction of 2026-11-05.
Question: the issue proposes the
updated_atof the item as the mark for "comments read". Does that work, and what does refine still read?Answer:
updated_atdoes not work as the mark. Every write to an issue moves it, the write of the job record and the comment of refine included (contract casetest_every_write_to_an_issue_a_comment_included_moves_its_updated_at). A mark that holds theupdated_atof the last read cannot match the value after the write that stores it, so each round would read again. The issue listing already carriescomments, the count of comments (checked on 2026-11-07 withdevops gh api repos/dan-petty/devops-cli/issues). Only a comment moves it, so the change keeps the intent of the issue with that count: refine reads the comments of a waiting item only when the count moved.What a waiting item still costs after the change (the answer to the review note of 2026-11-06, "check what is still read"):
refine.commented_at,refine.wait_refs).Rule and code: AGENTS.md rule 3 (an open tool first: hishel meets the same rule of ADR 0006, so it does not help),
src/devops_cli/roadmap/refine.py(_still_waiting), ADR 0001 (the record lives in the issue body). The measure of the drop of requests stays with #3866.devops-cli-service commentedon Nov 7, 2026
Released in v0.77.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.77.1
devops-cli-service commentedon Nov 7, 2026
Live since 2026-11-07 05:06 UTC