Skip to content

fix(roadmap): trace gate misses the tool call citation form #4547

Closed

Description

@dan-petty

Problem Description

The Feasibility trace gate of the stage job does not read the path of a citation in the form of a tool call with arguments, such as read_file("tests/commands/test_test_selection.py", 60, 80). _claimed_path (src/devops_cli/roadmap/stage/stage_change.py) removes a toolbox tool name only when a space follows it (#4463). For the call form it keeps the whole span as the path, so _was_read finds no match, also when the run read the file.

Reproduction Steps

  1. Make a StageProposal whose Feasibility section says: The run read `read_file("src/devops_cli/sample.py", 60, 80)` and found the line.
  2. Make a TraceFacts with the tool read_file and the path src/devops_cli/sample.py.
  3. Call check_proposal(...) with that trace. It returns "The Feasibility section states that read_file("src/devops_cli/sample.py", 60, 80) was read, but the run did not read it."

Expected vs Actual Behavior

Expected: the gate takes src/devops_cli/sample.py as the claimed path of read_file("src/devops_cli/sample.py", 60, 80), as it does for read_file src/devops_cli/sample.py.

Actual: the gate compares the whole span with the read paths and refuses the claim.

Evidence: the stored record 4472.refused.json of the roadmap-service pod (2026-11-11) holds the refusal "The Feasibility section states that read_file("tests/commands/test_test_selection.py", 60, 80) was read, but the run did not read it." The change of #4495 lets that sentence pass, because the gate now judges the object of the read, but the form stays unparsed. It is 1 of the 14 stored trace refusals.

Environment Diagnostics

Logs, Traces, or Terminal Output

/home/devops/.data/roadmap/stage/dan-petty/devops-cli/4472.refused.json

Related: #4463, #4495.

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 Feasibility trace gate reads the space form read_file src/devops_cli/sample.py but not the call form read_file("src/devops_cli/sample.py", 60, 80). It keeps the whole call as the claimed path. It then refuses a claim even when the run read the file. The fix takes the first string argument of a known stage-tool call as the path.

Acceptance criteria

Requirement: Tool-call citation path

The Feasibility trace gate SHALL use the first string argument of a known stage-tool call as the claimed path.

Scenario: Double-quoted tool call matches a read path

  • WHEN A Feasibility line cites read_file("src/devops_cli/sample.py", 60, 80) and the trace holds tool read_file and path src/devops_cli/sample.py.
  • THEN check_proposal returns no trace-path problem for the line.

Requirement: Single-quoted tool-call citation path

The Feasibility trace gate SHALL accept a known stage-tool call with a single-quoted path argument.

Scenario: Single-quoted tool call matches a read path

  • WHEN A Feasibility line cites read_file('src/devops_cli/sample.py', 60, 80) and the trace holds tool read_file and path src/devops_cli/sample.py.
  • THEN check_proposal returns no trace-path problem for the line.

Requirement: Unread tool-call citation

The Feasibility trace gate SHALL refuse a tool-call citation when the trace holds no matching read path.

Scenario: Unread tool call names its path

  • WHEN A Feasibility line cites read_file("src/devops_cli/sample.py", 60, 80) and the trace holds tool read_file but no path src/devops_cli/sample.py.
  • THEN check_proposal returns the trace-path problem that names src/devops_cli/sample.py.

Requirement: Existing space-form citation

The Feasibility trace gate SHALL keep the current result for a stage-tool citation in the space form.

Scenario: Space-form tool call still matches

  • WHEN A Feasibility line cites read_file src/devops_cli/sample.py and the trace holds tool read_file and path src/devops_cli/sample.py.
  • THEN check_proposal returns no trace-path problem for the line.

Existing Tool Considered

No alternatives check has run. No open, maintained tool or library covers this internal trace-citation parser. The project builds and keeps the parser itself. Build cost: about 6,000 tokens to write and test the parser. Keep and fix cost: about 2,000 tokens per year. Elapsed time: about 3 hours.

Key questions

  • How should _claimed_path extract the path from a tool call with arguments?: _claimed_path SHALL parse a call to a known stage tool and take its first string literal argument as the path. It then applies the existing citation and ./ rules. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:1727, src/devops_cli/ai/tools/builtin_tools.py, docs/roadmap/stage.md:41]
    • Chosen: Parse the first string argument of a known tool call. It uses the existing stage-tool set and keeps one path extractor for the space form and the call form.
    • Rejected: Extend _CITATION_PATH with the call form. The pattern starts at a path and cannot skip a tool name, an opening parenthesis and a quote.
    • Rejected: Cut every span at its first quote. It would change spans that are not tool calls and could accept a false claim.
  • Should the call form be recognized only for a tool in the stage toolbox?: Yes. _claimed_path SHALL remove the call only when the tool name is in tool_names(HOLDER_STAGE_EXTENDED), as it does for read_file path. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:1727, docs/roadmap/stage.md:41]
    • Chosen: Restrict the call form to stage tools. It matches the existing space form and leaves an unknown program in the path, so the gate refuses it.
    • Rejected: Accept any name before a quoted path. It would let a plan claim a file with a call that the run never made.
  • Which test module should hold the regression case?: tests/roadmap/stage/test_roadmap_stage_trace_spans.py already holds the trace-span cases, so the regression case belongs there. [sources: tests/roadmap/stage/test_roadmap_stage_trace_spans.py, tests/roadmap/stage/test_roadmap_stage_trace_subject.py]
  • Should the call parser accept both quote characters and optional whitespace after commas?: Yes. The parser MUST accept single and double quotes and optional whitespace after commas, because a plan may write either form. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:1727, src/devops_cli/ai/tools/builtin_tools.py]
    • Chosen: Accept both quote characters and optional whitespace. It handles the same call that a Python reader accepts and avoids a second refusal for a minor form.
    • Rejected: Accept only the exact double-quoted form. It leaves a valid call form unparsed and repeats the defect.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    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: P2-Medium. A false refusal in the trace gate blocks valid plans, but it affects one of several citation forms and is 1 of 14 stored refusals.
    • Value: Medium. It removes a false refusal for a citation form the planner can produce, unblocking valid stage proposals.
    • Effort: Low. The fix is a targeted parse addition in _claimed_path, similar in scope to the space-form fix in #4463.
    • Related: fix(roadmap): the trace gate refuses valid citation forms #4463, which asks for a different change. Both target _claimed_path in stage_change.py for citation form parsing, but #4463 handles the space-separated tool prefix while the candidate handles the parenthesized call form with arguments.
  3. added
    priority/p2-medium
    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 5f75d25 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Live since 2026-11-11 19:36 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/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions