Skip to content

chore(roadmap): measure the stage re-reads of the request context #6240

Open

Description

@devops-cli-service

Split from #5466.

Problem or Motivation

The stage planner reads again the files that its request holds. The change of #5466 adds a given set to the trace gate and numbers the context code lines. Nobody can say how many re-reads the change removes until real Service runs exist. The sample of 2026-11-06 to 2026-11-13 holds 383 read_file calls on cited files that the capped context kept, in 42 of 52 items. The count of 383 does not split the reads for line numbers from the reads that the gate forced. The run index of #5460 makes the measure exact for each run.

Why this part is deferred

The count needs 7 days of real Service stage runs. #5433 has merged and logs the subject of each refused claim (src/devops_cli/roadmap/stage/stage_findings.py:227), so the baseline can be taken from the runs before the gate change reaches the Service. No pull request delivers a 7-day observation, so this part waits on an outside event. The rest of #5466 stays in its own item.

Acceptance Criteria

  • Baseline first: from the runs before the gate change reaches the Service, count for 7 days the refused paths that the capped context held. Record that count in ## Feasibility as the baseline, not 383.
  • Measure: report the re-reads of context paths in two parts: re-reads for line numbers (a ranged read of a given range) and re-reads that the gate forced.
  • Live proof after release: on real Service stage runs for 7 days, give the read_file calls on context paths (sample baseline 383 in 42 of 52 items), the own read_issue and no-argument read_spec calls (baseline 33), and the share of stage_problem_trace_path in the stage gate returns lines (baseline 10 of 60).

Proposed design

Problem statement

The stage planner reads again the files that its request context holds. No report splits these re-reads by cause. Nobody can say how many re-reads the trace-gate change of #5466 removes. This change adds one report command over the per-run stage records of the run index of #5460. The report counts the context reads, their causes, the issue and spec reads, the trace path share and the refused context paths of a window.

Acceptance criteria

Requirement: The report counts the reads of context paths

The stage re-read report SHALL print the count of the read_file calls on the paths that the request context of the run held, for its window.

Scenario: Two context reads and one read outside the context

  • WHEN uv run pytest tests/roadmap/stage/test_stage_rereads.py serves the report a run index with two read_file calls on context paths and one read_file call on a path outside the context
  • THEN the report prints context_reads=2

Requirement: The report splits the reads of context paths by cause

The stage re-read report SHALL split the reads of context paths into line-number reads and gate-forced reads.

Scenario: One ranged read and one read after a trace refusal

  • WHEN uv run pytest tests/roadmap/stage/test_stage_rereads.py serves the report one read_file call with a start line and an end line on a context path, and one read_file call with no range on a path that a stage_problem_trace_path finding of the reply before it names
  • THEN the report prints line_number=1 gate_forced=1

Requirement: The report counts the issue read and the no-argument spec read

The stage re-read report SHALL count the read_issue calls and the read_spec calls with no argument of the runs in its window.

Scenario: Two issue reads and one no-argument spec read

  • WHEN uv run pytest tests/roadmap/stage/test_stage_rereads.py serves the report a run index with two read_issue calls and one read_spec call with no argument
  • THEN the report prints read_issue=2 read_spec_noarg=1

Requirement: The report gives the share of the trace path code

The stage re-read report SHALL give the share of stage_problem_trace_path in the stage gate returns lines of its window.

Scenario: One of three returns names the trace path code

  • WHEN uv run pytest tests/roadmap/stage/test_stage_rereads.py serves the report three stage gate returns lines, and one of them names stage_problem_trace_path in its codes=
  • THEN the report prints trace_path_share=1/3

Requirement: The report gives the refused context paths of a window

The stage re-read report SHALL print the number of distinct subject paths of the stage_problem_trace_path findings of the last refused reply of each run that the request context held.

Scenario: One refused reply with three findings on two context paths

  • WHEN uv run pytest tests/roadmap/stage/test_stage_rereads.py serves the report one refused reply with three stage_problem_trace_path findings on two distinct context paths
  • THEN the report prints baseline_refused_paths=2

Requirement: The report counts only the runs inside its window

The stage re-read report MUST leave out each run whose time is outside the window that the report names.

Scenario: A run one day before the window

  • WHEN uv run pytest tests/roadmap/stage/test_stage_rereads.py serves the report one run inside the window with two context reads and one run one day before the window with three context reads
  • THEN the report prints context_reads=2

Requirement: Pending a person after the merge

The change MUST give the counts of the report over the real Service stage run records of the 7 days before the trace-gate change of #5466 reaches the Service and of the 7 days after it.

Scenario: The two live windows on the Service records

  • WHEN a person runs uv run devops roadmap eval stage rereads --since <start> --until <end> on the Service stage run records of each 7-day window
  • THEN the report prints context_reads, line_number, gate_forced, read_issue, read_spec_noarg, trace_path_share and baseline_refused_paths for each window, and the person records the baseline count in a comment on this issue

Existing Tool Considered

No alternatives check has run for this item. jq and DuckDB are open and maintained, and they read and count JSON records. They lack the stage run record schema, the pairing of a read with a finding code, the request-context check and the parse of the stage gate returns lines. The change builds a report module of the roadmap eval group and one command. The module is about 200 lines with its tests. The written cost is about 80k tokens to build, keep and fix that code, and about one day of elapsed work.

Key questions

  • Which records does the report read?: The per-run records of the run index of feat(roadmap): run records give the run, step and path class of tool calls #5460. Each record holds the tool calls of one run with their arguments, the findings of its replies and the paths that the request context held. (best practice) [sources: src/devops_cli/roadmap/stage/stage_plan_record.py:53, src/devops_cli/roadmap/agent_run.py:419, openspec/changes/archive/2026-11-29-5460-run-records-tool-calls/proposal.md]
    • Chosen: Read the run index of feat(roadmap): run records give the run, step and path class of tool calls #5460. It keeps each run's tool calls with their arguments, so the report splits a read by cause and counts the calls.
    • Rejected: Read the per-item plan records. They hold the request, the proposal and PlanFacts only, and no per-call line range.
    • Rejected: Read the trace comments of the staged pull requests. A refused run opens no pull request, so its reads have no comment.
  • How does the report tell a line-number read from a gate-forced read?: A read_file call with a start line and an end line is a line-number read. A read_file call with no range is a gate-forced read when a stage_problem_trace_path finding of the reply before it names the same path. Any other read counts in neither part. (best practice) [sources: src/devops_cli/roadmap/stage/stage_findings.py:227, src/devops_cli/roadmap/stage/stage_tools.py:406]
    • Chosen: Pair the read with the finding subject. The finding holds its code and its subject path, so the pair is exact and the same records give the same count.
    • Rejected: Pair the read with the call before it. The order of the calls differs between runs, so the pair is not exact.
    • Rejected: Classify the reads with a model. The same records must give the same count, and a model gives no stable count.
  • Which log line holds the share of stage_problem_trace_path?: The stage gate returns line. The share is the count of these lines whose codes= names stage_problem_trace_path, over all stage gate returns lines of the window. [sources: src/devops_cli/roadmap/round_log.py:72, src/devops_cli/roadmap/stage/stage_finding_classes.json:132]
  • Which calls are the own issue read and the no-argument spec read?: A read_issue call, and a read_spec call with no capability. read_spec with no capability lists the capabilities, so the call reads no spec body. [sources: src/devops_cli/roadmap/stage/stage_tools.py:343, src/devops_cli/roadmap/stage/stage_tools.py:406]
  • Does the report wait for the run index of feat(roadmap): run records give the run, step and path class of tool calls #5460?: No wait. feat(roadmap): run records give the run, step and path class of tool calls #5460 has merged: the change openspec/changes/archive/2026-11-29-5460-run-records-tool-calls added the run_index and row fields to ToolCallRecord (src/devops_cli/roadmap/agent_run.py:419). The report reads that merged run index. The per-item plan and refused records hold no per-call line range and no count of the read_issue and read_spec calls, so the report reads the run records. [sources: openspec/changes/archive/2026-11-29-5460-run-records-tool-calls/proposal.md, src/devops_cli/roadmap/agent_run.py:419, src/devops_cli/roadmap/stage/stage_plan_record.py:53]
  • Does the item continue while the stage job is re-architected?: No. The project records chore(roadmap): hold incremental stage and implement work #6521 as an open hold issue: incremental work on the stage, implement and fix-checks jobs waits for the re-architecture of refactor(roadmap): re-architect stage and implement on Coder #6519. chore(roadmap): hold incremental stage and implement work #6521 has no sub-issue and no type/epic label, so it is no tracker, and it holds the item back. The item continues when a person closes chore(roadmap): hold incremental stage and implement work #6521. [sources: docs/roadmap/refine.md:24, tests/roadmap/refine/test_roadmap_refine_dependencies.py:23]
  • Where does the baseline count go, and who takes it?: A person runs the new command on the runs of the 7 days before the trace-gate change reaches the Service, and records the count in a comment on this issue. The merge archives the change folder, and a later edit of an archived folder is a commit that only updates tracking. (best practice) [sources: CONTEXT.md, AGENTS.md]
    • Chosen: Record the count in a comment on this issue. CONTEXT.md keeps roadmap state in issues, and the merge archives the change folder.
    • Rejected: Record the count in the ## Feasibility of the change folder. The merge archives the folder, and AGENTS.md rule 8 refuses a commit that only updates tracking.
    • Rejected: Keep the sample 383 as the baseline. The sample does not split the reads by cause, so it is no baseline for the gate change.

Fit

Fits in one pull request.

Suspected block

The release of #5466 must reach the Service. The 7-day baseline window closes then, and the live window needs 7 days of real Service stage runs after it.

Dependencies

#6521

Activity

  1. added
    type/chore
    source/agent
    scope/roadmap
    status/new
    value/medium
    on Nov 18, 2026
  2. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    ContributorAuthor
  3. added
    effort/low
    priority/p2-medium
    on Nov 18, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    ContributorAuthor

    Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.

  5. dan-petty commented on Nov 20, 2026

    @dan-petty
    Owner

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  6. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  7. devops-cli-service commented on Dec 1, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block and Watched files in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  8. devops-cli-service commented on Dec 1, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

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/agentstatus/newtype/chorevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions