Skip to content

perf(roadmap): status lane reads the snapshot, skips idle stops #4854

Closed

Description

@dan-petty

Problem or Motivation

  • Measured on 2026-11-11 at 20:45Z (devops_cli_github_requests_total, 1 hour): the roadmap Service used all of its GitHub budget (3,000 requests an hour), and no round started from 20:01Z to 20:48Z.
  • The row implement sent 820 requests an hour for devops-cli, and the row metrics sent 611. No runner Job ran since 02:25Z and no item was Staged. Loki shows that each implement round of the hour did nothing ("reported 0 Job(s), cleared 0 stop(s), created None").
  • Cause 1, the listing. The status lane (metrics, implement, stage_ready, pr_conflicts, release_comments) reads the whole state=all listing in each round: 49 pages at fix(ai): the review prompt digest leaves out the chat persona prompts #4829. Only the triage lane reads through the listing snapshot of perf(roadmap): intake reads only the issues that changed #4448 (service_jobs in src/devops_cli/roadmap/run.py). ETags do not help: GitHub pages the listing newest first by offset, so each new issue or pull request changes every page. 37 were opened in the hour, and the 304 share of the row implement fell from 34% (24 hours) to 6% (1 hour).
  • Cause 2, the stop comments. The stop pass (clear_stops in src/devops_cli/roadmap/stop_clear.py) lists the comments of each Blocked stop in each round, before it checks a rule. 19 stops in 15 rounds give 285 requests an hour. The comments change only when the issue changes, and a one-page listing never gets a 304, because the session keeps no last page (session_transport.py).
  • The counts agree: 11 rounds x (49 + 19) + 4 rounds x 19 = 824 requests. In 4 rounds the row metrics read the listing first in the same store.

Proposed Solution & Architectural Design

  1. service_jobs gives the status lane its own snapshot, IncrementalListing(FileSnapshotStore(<state_dir>/listing/status)), with the code of perf(roadmap): intake reads only the issues that changed #4448. A separate directory keeps one writer for each snapshot file. A round then reads one page of changes (since=), and the whole listing once in 24 hours.
  2. The stop pass and the implement judge list the comments of a stop only when the updated_at of the issue moved since the last read that the process holds. A new comment moves updated_at, so an issue that did not change keeps its answer.

Expected saving at the measured hour:

Step Saving
1, status lane snapshot about 48 requests for each listing read: about 720 an hour (implement 528, metrics 192)
2, stop comments about 285 an hour

The row implement goes from 820 to about 20 requests an hour, and the row metrics from 611 to about 420 (#3634 and #3941 cover the rest of metrics).

Target Subsystem

Roadmap Service: src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/stop_clear.py, src/devops_cli/roadmap/implement/implement.py.

Existing Tool Considered

Acceptance Criteria

  • A test with a recorded request count: a status-lane round with a kept snapshot reads one page of changes, not the whole listing.
  • A test: a second stop pass on a Blocked stop whose issue did not change lists no comments, and a pass after the issue changed lists them again.
  • The triage lane and the status lane keep separate snapshot files.

Dependencies

None. Related: #3634 (label times after a pod start), #3941 (metrics gh reads), #4668, #4415, #4563.

Proposed design

Problem statement

The roadmap Service used its whole GitHub budget of 3,000 requests an hour on 2026-11-11, and no round started for 47 minutes. The status lane reads the whole state=all listing in each round, and the stop pass lists the comments of every Blocked stop in each round, before it checks a rule. The change gives the status lane its own listing snapshot, like the triage lane's, and skips the comment listing of a stop whose issue gained no comment.

Acceptance criteria

Requirement: Status lane listing snapshot

The status lane SHALL read every issue through an IncrementalListing with a FileSnapshotStore under listing/status/ of the Service's state directory.

Scenario: A kept snapshot reads one page of changes

  • WHEN a status-lane round runs with the snapshot of the previous round and no issue changed since
  • THEN the store sends one issues listing request with since= and no request for a page without since=

Requirement: One snapshot file for each lane

The triage lane and the status lane MUST keep their listing snapshots in separate directories.

Scenario: Both lanes run a round

  • WHEN the triage lane and the status lane each run a round for the same repository
  • THEN each lane writes only its own snapshot file and neither round changes the watermark of the other lane

Requirement: Stop pass skips an unchanged stop

The stop pass SHALL list the comments of a Blocked stop only when the count of comments that the issue listing carries differs from the count of its last read.

Scenario: A second pass on an unchanged stop

  • WHEN a second stop pass runs and the comment count of a Blocked stop's issue did not move
  • THEN the pass sends no comments listing request for that issue

Requirement: Stop pass reads a changed stop

The stop pass MUST list the comments of a Blocked stop again when the count of comments on its issue moved.

Scenario: A retry after a new comment

  • WHEN a person comments implement: retry on a Blocked stop's issue and the next stop pass runs
  • THEN the pass lists the comments of the issue and clears the stop by the rule retry

Requirement: One comment read for each stop in a round

The round MUST keep one comment answer for each issue and comment count, and the implement judge SHALL take the answer that the stop pass read.

Scenario: The stop pass and the judge in one round

  • WHEN a round runs the stop pass and then the implement judge on a Blocked stop whose issue gained a comment
  • THEN the store sends one comments listing request for that issue in the round

Requirement: The documents name both snapshots

k8s/README.md item 11 and the section The issue listing of docs/roadmap/intake.md MUST name the snapshot directory of each lane and say that the model lane alone reads the whole listing.

Scenario: The documents list the state files

  • WHEN the documentation test reads k8s/README.md item 11 and the section The issue listing of docs/roadmap/intake.md
  • THEN item 11 names listing/ for the triage lane and listing/status/ for the status lane, and the section names listing/ for intake and listing/status/ for the status lane and no longer says that the status lane reads the whole listing

Existing Tool Considered

The GitHub REST issue listing with its since parameter, already wrapped by the project's IncrementalListing and FileSnapshotStore (#4448), covers the listing reads: it lacks a way to skip the comment listing of an issue that gained no comment, and its ETags do not help because GitHub pages the listing by offset, newest first. The nearest open, maintained library is hishel, the HTTP cache for httpx that #3667 considered: it lacks this need too, because GitHub stores no page without a next link (ADR 0006), so a one-page comment listing never answers 304, and ADR 0006 keeps every GitHub request in the gidgethub session with its budget and egress ledger. The change builds the skip itself at the cost that the body writes: about 150,000 tokens and 2 hours to build; the body writes no cost to keep or fix it.

Key questions

  • Where does the status lane keep its listing snapshot?: In FileSnapshotStore(<state_dir>/listing/status), a directory of its own beside the triage lane's listing/. The status lane runs one round at a time on its worker, so one writer keeps each snapshot file. (best practice) [sources: src/devops_cli/roadmap/run.py:1736, src/devops_cli/roadmap/run.py:1758, src/devops_cli/roadmap/stores/listing_snapshot.py:145, src/devops_cli/roadmap/stores/listing_snapshot.py:212, k8s/README.md:699]
    • Chosen: A separate directory for each lane. Each snapshot file gets one writer, so a round of one lane never replaces the watermark of the other, and the triage lane's listing/<owner>/<name>.json stays where it is.
    • Rejected: One snapshot directory for both lanes. Two workers write the same file, and the last write loses the watermark of the other lane.
  • Does ADR 0021, which moves the Service's shared state to Valkey, forbid a file snapshot now?: No for this change. The code at this commit still runs the three lanes in the Service, whose state is files on volume roadmap-service-home, and the triage lane already keeps its snapshot as a file there. ADR 0021 moves that state to Valkey at the end of tracker feat(roadmap): move Service work to Workflows and Valkey #4517; the body's perf(roadmap): share the listing snapshot and tool facts in Valkey #4668 is the later move of this snapshot. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:42, src/devops_cli/roadmap/run.py:1758, k8s/README.md:687]
  • How does the stop pass know that the comments of a Blocked stop did not change?: It keeps, in the process, the count of comments that the issue listing carried at the last read of each issue, and lists the comments only when the count differs. The listing already carries the count in IssueRecord.comments, and only a comment moves it, so the check costs no request. (best practice) [sources: src/devops_cli/roadmap/stores/store.py:467, src/devops_cli/roadmap/stop_clear.py:345, openspec/changes/archive/2026-11-07-3667-refine-unchanged-reads-no-comments/design.md:9, src/devops_cli/roadmap/refine/refine.py:1847, docs/ROADMAP_WORKFLOW.md:125]
    • Chosen: Keep the count of comments. Only a comment moves the count, the listing already carries it, and fix(roadmap): an unchanged refine item reads no comments #3667 uses the same mark for the same need of reading comments only when one arrived.
    • Rejected: Keep updated_at in the process. Any write to the issue moves it, the Service's own label and record writes included, so a write would cost one comment read; fix(roadmap): an unchanged refine item reads no comments #3667 rejected this mark for that reason.
    • Rejected: Pass since= to the comments listing. It still sends one request for each stop in each round.
    • Rejected: Use conditional requests on the comment pages. The session keeps no last page and holds 64 answers for all lanes, and GitHub stores no page without a next link (ADR 0006), so the pages never answer 304.
  • Does a new comment move the updated_at of an issue?: Yes, as the project records it: updated_at is when the issue last changed, and any write to it, a comment included, moves it. The store contract test pins a comment among the writes that move it. The status lane's since= read depends on this, because a commented issue is read again and its comment count refreshes. [sources: src/devops_cli/roadmap/stores/store.py:466, tests/roadmap/stores/test_roadmap_store_contract.py:870, docs/roadmap/intake.md:88]
  • Which rows of the status lane read the issue listing?: metrics, implement, stage_ready, release_comments and pr_conflicts. The rows github_status and cloudflare_status read a status page and no issue. [sources: src/devops_cli/roadmap/run.py:821, src/devops_cli/roadmap/run.py:868]
  • Where does the implement judge get the comment answer of a stop?: From one map that the round keeps for each issue and comment count. The stop pass fills it, and the judge takes the entry when the count still matches, else it lists the comments itself. The stop pass runs before the judge in the same round. (best practice) [sources: src/devops_cli/roadmap/implement/implement_submit.py:493, src/devops_cli/roadmap/implement/implement.py:322, src/devops_cli/roadmap/stop_clear.py:345]
    • Chosen: Share the map of the stop pass. One round lists the comments of a stop at most once, and a count that moved still costs the judge one read.
    • Rejected: Let the judge list the comments again. It sends a second request for the same issue in the same round.
  • What does a stop cost after a restart of the Service?: One comment listing for each Blocked stop in the first round, then no request until a comment moves the count. The map lives in the process and no state file holds it. (best practice) [sources: src/devops_cli/roadmap/stop_clear.py:345, src/devops_cli/roadmap/stop_clear.py:49, k8s/README.md:699]
    • Chosen: Keep the map in the process. A restart costs one read for each stop, and no state file needs a format or a rollback.
    • Rejected: Keep the map in a file beside schedule.json. It adds a state file that a restart must keep and that no other row reads.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/infra
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/infra. The perf prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P1-High. The Service exhausted its full GitHub budget and no roadmap round ran for 47 minutes.
    • Value: High. The roadmap Service is completely blocked when the budget is exhausted, stopping all item processing.
    • Effort: Medium. Reuses the existing IncrementalListing code from #4448 and adds one updated_at check across three files.
    • Related: perf(roadmap): intake reads only the issues that changed #4448, which asks for a different change. Both use IncrementalListing to avoid a full listing read, but #4448 applies it to the intake lane and this candidate applies it to the status lane.
  3. added
    priority/p1-high
    owner/agent
    on Nov 11, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 9208717 (see proposed design in issue body).

  6. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 12, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  8. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor
  9. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 04:08 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/infravalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions