Skip to content

fix(roadmap): the trace gate refuses valid citation forms #4463

Closed

Description

@dan-petty

Problem Description

The Feasibility trace gate of the stage job (_trace_problems in src/devops_cli/roadmap/stage/stage_change.py) refuses plans that cite a file that the run did read. The function _claimed_path gets the path from a code span. It accepts only the forms path:N:text and path:def name (_CITATION_PATH). Other citation forms that the planner writes do not match, so the gate compares the full span with the read paths and does not find it:

  • path:N-M (a line range), for example src/devops_cli/roadmap/run.py:770-861.
  • path:N (one line with no text).
  • a toolbox tool name before the path in the same code span.
  • a directory with a trailing slash, for example tests/telemetry/.

The trace and citation gates are the largest active cause of stage refusals: 62 refusals on 42 items in 48 hours. Three earlier fixes did not stop them (#4299, #4329, #4305). The study of 2026-11-11 found that 18 of the 62 trace refusals use one of these forms. A skeptic pass confirmed the cause.

Reproduction Steps

  1. Make a StageProposal whose Feasibility line is I read `src/devops_cli/roadmap/run.py:770-861`.
  2. Make a TraceFacts whose paths holds src/devops_cli/roadmap/run.py.
  3. Call _trace_problems(proposal, trace).

Expected vs Actual Behavior

Expected: no problem, because the run read the file.

Actual: the gate returns "The Feasibility section states that src/devops_cli/roadmap/run.py:770-861 was read, but the run did not read it."

Fix: _claimed_path removes :N, :N-M, a leading toolbox tool name (the names of tool_names(HOLDER_STAGE_EXTENDED), not a second list) and a trailing /. A path that the run did not read stays refused. The gate reads no claim from a quoted probe line.

Out of scope (separate issues): re-anchor a stale citation that matches one line at the staged commit, and name the right file in stage_problem_missing_test_file.

Environment Diagnostics

  • DevOps CLI: main at 6cf78e7
  • Execution environment: the roadmap Service (stage job) and the devcontainer

Logs, Traces, or Terminal Output

The Feasibility section states that `src/devops_cli/roadmap/run.py:770-861` was read, but the run did not read it.
The Feasibility section states that `tests/roadmap/test_roadmap_limit_classes.py:1-70` was read, but the run did not read it.
The Feasibility section states that `tests/telemetry/` was read, but the run did not read it.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Proposed design

Problem statement

The trace gate refuses valid Feasibility citations. It accepts only path:N:text and path:def name. Plans also cite path:N-M, path:N, a toolbox tool name before a path, and a directory with a trailing slash. The gate then reports that the run did not read a file that it read. The fix normalizes these forms before the read check.

Acceptance criteria

Requirement: Line range citation

The trace gate SHALL accept a line-range citation when the run read the cited file.

Scenario: Read file with a line range

  • WHEN A Feasibility line states that src/devops_cli/roadmap/run.py:770-861 was read, and TraceFacts.paths holds src/devops_cli/roadmap/run.py.
  • THEN _trace_problems returns no problem.

Requirement: Single line citation

The trace gate SHALL accept a single-line citation when the run read the cited file.

Scenario: Read file with one line

  • WHEN A Feasibility line states that src/devops_cli/roadmap/run.py:770 was read, and TraceFacts.paths holds src/devops_cli/roadmap/run.py.
  • THEN _trace_problems returns no problem.

Requirement: Toolbox prefix

The trace gate SHALL accept a code span that puts a toolbox tool name before the cited path.

Scenario: Read file with a toolbox prefix

  • WHEN A Feasibility line states that read_file src/devops_cli/roadmap/run.py:770 was read, read_file is in tool_names(HOLDER_STAGE_EXTENDED), and TraceFacts.paths holds src/devops_cli/roadmap/run.py.
  • THEN _trace_problems returns no problem.

Requirement: Directory citation

The trace gate SHALL accept a directory citation with a trailing slash when the run read that directory.

Scenario: Read directory with trailing slash

  • WHEN A Feasibility line states that tests/telemetry/ was read, and TraceFacts.paths holds tests/telemetry.
  • THEN _trace_problems returns no problem.

Requirement: Unread path refused

The trace gate SHALL refuse a citation when the run did not read the cited path.

Scenario: Citation of an unread file

  • WHEN A Feasibility line states that src/devops_cli/roadmap/run.py:770-861 was read, and TraceFacts.paths does not hold src/devops_cli/roadmap/run.py.
  • THEN _trace_problems returns the trace path problem for src/devops_cli/roadmap/run.py.

Requirement: Quoted probe line

The trace gate SHALL read no path claim from a quoted probe line.

Scenario: Quoted probe line with a path

  • WHEN A Feasibility line quotes a probe line in a code span and holds no read verb outside that span.
  • THEN _trace_problems returns no trace path problem for the path in the quoted line.

Existing Tool Considered

No check has run. No open, maintained tool covers the repository-specific citation parser in _claimed_path. The change edits existing code and adds no new subsystem. The written cost is about 8k tokens to build and 4k tokens to keep and fix, and 2 hours.

Key questions

  • Which function and pattern read the path from a Feasibility code span?: _claimed_path matches _CITATION_PATH and returns the path group, else the span, with a leading ./ removed. _uncalled_path calls it for each code span of a sentence. [sources: src/devops_cli/roadmap/stage/stage_change.py:1717, src/devops_cli/roadmap/stage/stage_change.py:1727, src/devops_cli/roadmap/stage/stage_change.py:1768]
  • Which citation forms must _claimed_path remove before the read check?: It must remove a line number, a line range, a def or class symbol suffix, a leading toolbox tool name, and one trailing slash. A path that remains unread stays refused. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:1717, src/devops_cli/roadmap/stage/stage_change.py:1727]
    • Chosen: Anchored regular expression. The existing _CITATION_PATH is anchored and already handles path:N:text and path:def name; one pattern keeps one parse path.
    • Rejected: Split the span on colons. The text after a colon can hold colons, and a tool name can precede the path, so a split is fragile.
    • Rejected: Add line ranges only. It leaves the single-line, tool-name and trailing-slash forms refused.
  • Which list supplies the toolbox tool names that the parser removes?: tool_names(HOLDER_STAGE_EXTENDED) supplies the names. _trace_problems already builds its tool set from that list. (best practice) [sources: src/devops_cli/roadmap/tools.py, src/devops_cli/roadmap/stage/stage_change.py:1797]
    • Chosen: The existing toolbox list. The trace gate and the parser use one list, so a new tool needs one edit and the two checks cannot drift.
    • Rejected: A second list in the parser. A new tool would need two edits, and one edit would be missed.
  • Should _claimed_path remove a trailing slash from a directory citation?: Yes. It removes one trailing slash before _was_read compares the path with TraceFacts.paths. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py, src/devops_cli/roadmap/agent_run.py]
    • Chosen: Remove one trailing slash. The trace records the directory path without a slash, so the exact comparison then matches.
    • Rejected: Keep the slash. It keeps the false refusal that the issue reports.
  • Should the gate still refuse a path that the run did not read?: Yes. Normalization removes citation syntax only. A path that TraceFacts.paths does not hold stays refused. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:1768]
    • Chosen: Keep the refusal. The gate must catch a false claim of a read.
    • Rejected: Accept every normalized path. It would hide an unread file.
  • How does the gate avoid a claim from a quoted probe line?: The gate reads a read claim from the sentence text outside code spans. A quoted probe line in a code span gives no read verb, so it gives no path claim. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py]
    • Chosen: Read claims outside code spans. _claim_words already blanks code spans, so a quoted probe line cannot add a read verb.
    • Rejected: Read every code span as a claim. A quoted probe line would produce a false refusal.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    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/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P1-High. It is the largest active cause of stage refusals with 62 refusals on 42 items in 48 hours, and three earlier fixes did not stop them.
    • Value: High. It unblocks valid plans that are currently refused, removing the top cause of stage job failures.
    • Effort: Medium. The fix is scoped to one function and four citation forms with a clear specification, but requires testing each form and the exclusion of quoted probe lines.
    • Related: fix(roadmap): the trace gate refuses a read file's citation #4290, which asks for a different change. Both fix the trace gate refusing valid citations in stage_change.py, but #4290 fixed the comparison of span to bare path while this candidate fixes _claimed_path to extract the path from line-range, single-line, tool-prefixed, and trailing-
  3. added
    priority/p1-high
    owner/agent
    on Nov 11, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

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

  6. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Service data, 48 hours to 2026-11-10T23:45Z: trace gate refusals

    Count: 34 item failures on 30 items had a trace-path refusal ("The Feasibility section states that <path> was read, but the run did not read it"), with 74 refused sentences. 5 more item failures on 5 items had a trace-tool refusal. devops_cli_roadmap_stage_gate_refusals_total{gate="trace"} increased by about 89 refusal rounds. By final item failures, trace is the largest gate.

    First and last: the first failure at 00:21Z on 2026-11-09, the last in the window at 20:24Z on 2026-11-10. After the window, #4442 and #3388 failed at 02:27Z on 2026-11-11 on the current image. Still occurring: yes. 3 item failures in the last 6 hours of the window (#4401, #4412, #3387).

    By deploy: 30 of the 34 item failures came before the #4299 and #4329 fixes went live (0.106.0, 03:19Z on 2026-11-10). 35 of their sentences used the path:N:text or path:def forms that #4299 fixed. After that, 4 item failures: #4043 at 07:43Z (SAMPLE.md), #4401 at 18:33Z (src/devops_cli/config/constants.py), #4412 at 20:24Z (13 sentences) and #3387 at 20:24Z (one test path). For #4043, #4412 and #3387, the trace gate was the only problem. About 20 trace refusal rounds came in the 20 hours after the #4329 deploy; the repair round fixed most of them, but each refusal costs one more plan run.

    This issue's form is the largest share after the fix: 12 of the 16 refused sentences after the #4329 deploy are path:N-M spans, all from the #4412 failure. I ran _sentence_trace_problem with a trace that holds src/devops_cli/roadmap/run.py, and the span run.py:430-570 was still refused. _CITATION_PATH (src/devops_cli/roadmap/stage/stage_change.py:1717) and _claimed_path (stage_change.py:1727) parse only path:N:text and path:def|class name.

    Causes that this issue does not cover (filed as a separate issue, which links here):

    Bare names that are not repository files (SAMPLE.md in #4043, schedule.json in #4412) can be correct refusals.

    Cost: each refusal ends one plan run and one repair run. Stage error rows took about 71,951 s of the model lane in 48 hours for all gates together; the trace share is not measured apart.

    Priority: P1 fits the evidence.

    Queries:

    Loki: sum(count_over_time({namespace="devops"} |= "but the run did not read it" [48h]))   (at 2026-11-10T23:45Z: 25 job-failure lines)
    Loki: {namespace="devops", app_kubernetes_io_name="roadmap-service"} |= "Service job execution failed" |= "the stage job failed for"   (2026-11-08T23:45Z to 2026-11-11T03:15Z, 49 lines)
    Prometheus: sum by (gate) (increase(devops_cli_roadmap_stage_gate_refusals_total[48h]))
    kubectl exec (read-only): cat /home/devops/.data/roadmap/stage/dan-petty/devops-cli/{4442,3388}.refused.json
    
  7. added
    status/in-progress
    and removed
    status/ready
    on Nov 11, 2026
  8. removed
    status/in-progress
    owner/agent
    on Nov 11, 2026
  9. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor
  10. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 05:46 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/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions