Skip to content

fix(roadmap): the trace gate refuses a read file's citation #4290

Closed

Description

@dan-petty

Problem

The trace gate of the stage job refuses a Feasibility sentence that is true. It compares a whole code span with the paths that the run read, and it takes the word read inside a quoted line of code as a claim that the run read a file.

The stage prompt asks a plan to cite a line as path:line:text and a symbol as path:def name (the citation rule of #3422). _uncalled_path in src/devops_cli/roadmap/stage/stage_change.py tests span not in trace.paths. A span in one of these forms is never in trace.paths, which holds the bare path, so the gate refuses every citation of a file that the run did read.

Evidence: the Service logs of 2026-11-09 (job failures of the stage job, Loki, 7 days). Of 25 "was read, but the run did not read it" sentences from 15:00Z on, 14 name a citation span. Examples, word for word:

The trace gate counted 15.3 refusals in the last 6 hours, the most of any gate.

Expected

  • The gate judges the path of a path:line:text or path:def name citation, and the path of a span with a leading ./.
  • A claim that names a file by its name, or by the end of its path, is true when the run read a path that ends with it.
  • A code span that is no name of a toolbox tool does not make a claim of a read. The word read inside a quoted line is not a verb of the plan.
  • A claim of a path that the run did not read is still refused. The refusal names the path, not the whole citation.

Acceptance criteria

  • uv run devops ci test tests/roadmap/stage/test_roadmap_stage_trace_spans.py passes. It fails on the base: a citation of a read path is refused, and a quoted line with the word read is refused.
  • A claim of an unread path in any of these forms is still refused (same test file).
  • uv run devops roadmap eval stage --replay keeps its result: every gate refuses what it must refuse, and 5 of 5 good plans pass.

Existing tool considered

No library judges a sentence of a plan. The change reuses _CITED_PATH and _CODE_SPAN of the same module and adds no parser. Cost: about 25 000 tokens to build, 3 000 to keep, and 1 hour.

Proposed design

Problem statement

The trace gate of the stage job refuses true Feasibility sentences. _uncalled_path in src/devops_cli/roadmap/stage/stage_change.py compares a whole code span with trace.paths. A path:line:text or path:def name citation never matches, because trace.paths holds bare paths. The gate also reads the word read inside a quoted line of code as a claim that the run read a file. A file named by its short name, or with a leading ./, is refused too. The result is the most refusals of any gate.

Acceptance criteria

Requirement: Line citation names its path

The trace gate SHALL judge the path of a path:line:text citation and not the whole span.

Scenario: Citation of a read file with a line

  • WHEN a Feasibility sentence says that src/a.py:12:def f() -> int: was read and the trace holds src/a.py
  • THEN _trace_problems returns no problem

Requirement: Symbol citation names its path

The trace gate SHALL judge the path of a path:def name or path:class name citation.

Scenario: Citation of a read file with a symbol

  • WHEN a Feasibility sentence says that src/a.py:def repository_file was read and the trace holds src/a.py
  • THEN _trace_problems returns no problem

Requirement: Leading dot slash is ignored

The trace gate SHALL remove a leading ./ from a cited path before it compares the path.

Scenario: Span with a leading dot slash

  • WHEN a sentence says that ./src/a.py was read and the trace holds src/a.py
  • THEN _trace_problems returns no problem

Requirement: A short name matches the end of a read path

The trace gate SHALL treat a file named by its name or by the end of its path as read when the run read a path that ends with it at a path boundary.

Scenario: Name of a file under a hidden folder

  • WHEN a sentence says that devcontainer.json was read and the trace holds .devcontainer/devcontainer.json
  • THEN _trace_problems returns no problem, and a name such as ontainer.json that ends no path at a boundary is still refused

Requirement: Read inside a quoted line is no claim

The trace gate MUST NOT take the word read inside a code span as the verb of a claim.

Scenario: Quoted line with the word read

  • WHEN a sentence quotes src/a.py:308: (("ai", "read"), 60.0, True, False), and holds no other read verb outside code spans
  • THEN _trace_problems returns no problem

Requirement: An unread path is still refused by its path

The trace gate SHALL refuse a claim that a path was read when the run did not read it, and the refusal SHALL name the path and not the whole citation.

Scenario: Unread path in each form

  • WHEN a sentence claims a read of src/b.py, of src/b.py:3:x = 1 or of src/b.py:def g, and the trace holds no such path
  • THEN _trace_problems returns one problem that names src/b.py in each case

Requirement: The replay keeps its result

The replay of the stage gates SHALL keep its result after the change.

Scenario: Replay of the golden set

  • WHEN uv run devops roadmap eval stage --replay runs
  • THEN every gate refuses what it must refuse and 5 of 5 good plans pass

Existing Tool Considered

No open, maintained library judges a sentence of a plan against a run trace. The change reuses _CITED_PATH, _LINE_CITATION, _SYMBOL_CITATION and _CODE_SPAN of the same module and adds no parser. Cost of own code: about 25 000 tokens to build, 3 000 to keep, and 1 hour.

Key questions

  • Why does the gate refuse a citation of a read file?: _uncalled_path tests span not in trace.paths. The span of a citation holds the line or the symbol, so it never equals a bare path. The word search for read runs on the whole sentence, so a quoted line adds a false verb. [sources: src/devops_cli/roadmap/stage/stage_change.py]
  • How does the gate get the path of a citation?: Match each span with _LINE_CITATION and _SYMBOL_CITATION first, and take the path group. Remove a leading ./. A span with no citation form is the path itself. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py]
  • How does the gate decide that a short name was read?: A claimed path is read when it equals a trace path or when a trace path ends with / and the claimed path. The match is at a path boundary, so ontainer.json does not match. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py]
    • Chosen: Boundary suffix match. It accepts devcontainer.json for .devcontainer/devcontainer.json and refuses a partial name.
    • Rejected: Plain string suffix match. It accepts a partial file name, which is a false claim.
  • How does the gate avoid the false verb inside a quoted line?: Search for the read word in the sentence with each code span removed, except a span that is the name of a toolbox tool. A code span that is no tool name makes no read claim. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py]
    • Chosen: Blank the code spans before the verb search. It keeps the verb in prose and drops the verb in quoted code, with no new pattern.
    • Rejected: Add read to a list of excluded words. It fixes one word and fails for ran and reads in other quoted lines.
  • Does the plan record keep the paths that the new check compares?: PlanFacts.of keeps the paths that appear in a line of proposal.feasibility, matched by code span. After the change the check compares the extracted path, so the record must keep a trace path that the extracted path matches by the same rule, or a recheck of a kept plan can differ from the first check. The change must keep the two rules equal. [sources: src/devops_cli/roadmap/stage/stage_plan_record.py:57, openspec/changes/archive/2026-11-09-4281-a-kept-plan-fails-the-trace/design.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/high
    effort/low
    on Nov 9, 2026
  2. dan-petty commented on Nov 9, 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. The gate is the top refusal source at 15.3 refusals in 6 hours and blocks valid plans.
    • Value: High. It unblocks every valid plan that cites a read file by path.
    • Effort: Low. The body states about 1 hour and 25 000 tokens, reusing existing regexes in the same module.
    • Related: fix(roadmap): the trace gate reads only the last run #4257, which asks for a different change. Both fix bugs in the trace gate comparison logic, but #4257 fixes reading only the last run while the candidate fixes comparing a full citation span to a bare path.
  3. added
    priority/p1-high
    on Nov 9, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 10, 2026
  5. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

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

  6. added a commit that references this issue on Nov 10, 2026
    7fcba76
  7. added a commit that references this issue on Nov 10, 2026
    c70d673
  8. removed
    status/ready
    on Nov 10, 2026
  9. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-10 01:54 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/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