Skip to content

fix(roadmap): trace gate refuses probe and search-hit reads #4495

Closed

Description

@dan-petty

Problem Description

The Feasibility trace gate of the stage job refuses sentences that make no claim about what the run read. It also refuses a file that the run saw in a search hit or in the probe output. #4463 covers the citation forms that _claimed_path does not parse (path:N-M, path:N, a tool prefix, a trailing slash). This issue covers two other causes that #4463 does not fix.

Cause 1: the gate reads any "read" word as a claim about the run. _READ_WORD (src/devops_cli/roadmap/stage/stage_change.py:1694) and _uncalled_path (stage_change.py:1757) take each read or reads outside a negation as a claim that the run read the first path span of the sentence. _CODE_READS (stage_change.py:1699, from #4314) exempts only a code span, it or which as the subject. Other subjects are not exempt: "this plan", "the probe", "the group that changes the catalog". The gate does not parse the sentence, so it cannot tell a claim of the run from a statement about the plan or about code.

Cause 2: the read set counts only some tool arguments. _paths_in_argument (src/devops_cli/roadmap/agent_run.py:435) and TraceFacts.of (agent_run.py:461) record as reads only the path, directory and paths arguments of tool calls. A file that the run saw only in search_code hits or in the probe text counts as not read.

Both causes apply on origin/main 0ac2f76 and in the live 0.110.0 image.

Reproduction Steps

  1. Make a StageProposal whose Feasibility section holds this sentence from the refused record of fix(ai): price cached prompt tokens of chat calls #4442: This plan reads `tests/ai/client/test_ai_client_finish_reasons.py` in group 2.
  2. Make a TraceFacts that does not hold that path.
  3. Call _trace_problems(proposal, trace). The gate returns "The Feasibility section states that tests/ai/client/test_ai_client_finish_reasons.py was read, but the run did not read it."
  4. Do the same with these sentences from the refused records of 2026-11-11:

Expected vs Actual Behavior

Expected: the gate refuses only a claim that the run read a file (a first-person or run subject), and only for a file that the run never saw. A sentence whose subject is the plan, a group, the probe or code is no read claim. A path from a search_code hit or from the probe text counts as seen.

Actual: the gate refuses all three sentences above. Each refusal costs one more plan run, and two refusals end the item with "The change fails its checks, also after a second try".

48-hour data (2026-11-08T23:45Z to 2026-11-10T23:45Z):

Environment Diagnostics

  • DevOps CLI Version: 0.110.0 (the live roadmap-service pod)
  • Python Version: 3.14
  • OS & Architecture: Linux x86_64
  • Execution Environment: Roadmap Service (the stage row in the cluster)

Logs, Traces, or Terminal Output

# Loki, 2026-11-08T23:45Z to 2026-11-11T03:15Z
{namespace="devops", app_kubernetes_io_name="roadmap-service"} |= "Service job execution failed" |= "the stage job failed for"
sum(count_over_time({namespace="devops"} |= "but the run did not read it" [48h]))

# Prometheus
sum by (gate) (increase(devops_cli_roadmap_stage_gate_refusals_total[48h]))

# Refused records, read-only, in the roadmap-service pod
/home/devops/.data/roadmap/stage/dan-petty/devops-cli/4442.refused.json
/home/devops/.data/roadmap/stage/dan-petty/devops-cli/3388.refused.json

The Feasibility section states that `tests/ai/client/test_ai_client_finish_reasons.py` was read, but the run did not read it.

Related: #4463 (citation forms, open), #4314, #4290, #4281, #4257 and #3266 (closed earlier forms), #3978 (a different change).

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 refuses valid plan sentences. It treats any read word as a claim about the run. It also records as reads only some tool arguments. The gate must refuse only a run read claim for a path that the run never saw. It must also count paths from search hits and probe text as seen.

Acceptance criteria

Requirement: Non-run subjects are not read claims

The trace gate SHALL treat a read verb as a claim about the run only when its subject is first-person or names the run.

Scenario: A plan subject is not a run read

  • WHEN The Feasibility section says This plan reads tests/ai/client/test_ai_client_finish_reasons.py and the trace facts do not hold that path.
  • THEN _trace_problems returns no problem for that sentence.

Requirement: Run read claims are still refused

The trace gate SHALL refuse a first-person or run-subject read claim when the trace facts do not hold the claimed path.

Scenario: A run read claim names a missing path

  • WHEN The Feasibility section says I read src/missing.py and the trace facts do not hold src/missing.py.
  • THEN _trace_problems returns the refusal that names src/missing.py.

Requirement: Read object is the claimed path

The trace gate SHALL compare the path that the read verb takes as its object, not the first path in the sentence.

Scenario: A search hit path is not the read object

  • WHEN The Feasibility section says read_file of src/prompt.py shows the line, and search_code returned a hit in src/tf.py, and the trace facts hold src/prompt.py but not src/tf.py.
  • THEN _trace_problems returns no problem for the search hit path.

Requirement: read-only is not a read verb

The trace gate SHALL ignore the substring read when it is part of a hyphenated word such as read-only.

Scenario: A read-only root filesystem

  • WHEN The Feasibility section says k8s/devops/cronjob-runner.yaml runs the pod with a read-only root, and the trace facts do not hold that path.
  • THEN _trace_problems returns no problem for that sentence.

Requirement: Search hit paths count as seen

TraceFacts.of SHALL record as seen each path that a search_code hit line names.

Scenario: A search_code hit line names a test

  • WHEN A tool result from search_code holds tests/roadmap/implement/test_roadmap_implement_amend.py:5:....
  • THEN TraceFacts.of(trace) holds tests/roadmap/implement/test_roadmap_implement_amend.py.

Requirement: Probe output paths count as seen

TraceFacts.of SHALL record as seen each path that the probe output text names.

Scenario: The probe text names a client file

  • WHEN A probe tool result holds The path src/devops_cli/ai/client/network.py is a file of the staging commit.
  • THEN TraceFacts.of(trace) holds src/devops_cli/ai/client/network.py.

Requirement: Code subjects are not run read claims

The trace gate SHALL keep the code-span, it and which exemptions for a read verb.

Scenario: A function reads a file

  • WHEN The Feasibility section says because it reads .github/labels.yml of the default branch and the trace facts do not hold that path.
  • THEN _trace_problems returns no problem for that sentence.

Existing Tool Considered

No alternatives check has run. No open, maintained tool or library covers the need. The trace gate is specific to this project. The change edits stage_change.py and agent_run.py and builds no new component. Estimated build cost is about 5,000 tokens. The keep and fix cost is about 1,000 tokens. Elapsed time is under two hours.

Key questions

  • Where do the trace gate and the trace facts live?: The gate is _uncalled_path in src/devops_cli/roadmap/stage/stage_change.py. The facts are TraceFacts.of in src/devops_cli/roadmap/agent_run.py. [sources: src/devops_cli/roadmap/stage/stage_change.py:1757, src/devops_cli/roadmap/agent_run.py:461]
  • How should the gate tell a run read claim from a statement about the plan, a group, the probe or code?: Use a subject allowlist. Only a first-person subject or a run subject counts as a run read claim. Keep the existing code-span, it and which exemptions. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:1694, src/devops_cli/roadmap/stage/stage_change.py:1699, src/devops_cli/roadmap/stage/stage_change.py:1757]
    • Chosen: Subject allowlist. It matches the expected behavior and does not add a parser dependency.
    • Rejected: Exemption list for plan, group, probe and code. A new non-run subject would cause another false refusal.
    • Rejected: Full sentence parser. It adds a dependency and is more than the gate needs.
  • Which path should the gate compare for a read claim?: Compare the path that follows the read verb and is its object. Do not compare the first path in the sentence. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:1726, src/devops_cli/roadmap/stage/stage_change.py:1757]
  • How should the gate treat read inside read-only?: Match a read verb only when the next character is not a hyphen. Treat read-only as no read claim. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:1694]
    • Chosen: Negative lookahead for a hyphen. It removes the false refusal without a word list.
    • Rejected: Keep the word-boundary match. read in read-only still matches.
  • Which tool results should add paths to the read set?: Add paths from search_code hit lines and from probe output text. Keep the existing path, directory and paths arguments. (best practice) [sources: src/devops_cli/roadmap/agent_run.py:435, src/devops_cli/roadmap/agent_run.py:461]
    • Chosen: Parse structured search hits and probe text. These are paths that the run saw, and the issue shows both false refusals.
    • Rejected: Keep only tool arguments. It leaves cause 2 in place.
    • Rejected: Parse every path token in every tool result. It adds noise and is not needed for the two named sources.

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/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. 34 item failures in 48 hours and refusals still occur on the live 0.110.0 image.
    • Value: High. Each false refusal costs a plan run and two refusals end the item, blocking roadmap work.
    • Effort: Medium. Two functions in two files need targeted changes; the logic is well scoped by the reproduction steps.
    • Related: fix(roadmap): the trace gate counts code that reads a file #4314, which asks for a different change. Both touch _READ_WORD and _uncalled_path for false-positive 'reads' refusals, but #4314 exempts code/it/which subjects while the candidate extends the exemption to plan, probe, and group subjects and adds search_code and probe text to the r
  3. added
    priority/p1-high
    on Nov 11, 2026
  4. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Two more causes of the same type, from a replay of the stored refused records of the Service (2026-11-11, 9 items, 32 trace refusals) with the change of #4463. The change of #4463 fixes the citation forms and quoted probe lines. These 7 bare-path refusals stay:

    Item Refused path Cause
    #3049 k8s/devops/cronjob-runner.yaml read inside read-only: "k8s/devops/cronjob-runner.yaml runs the pod as user 1000 with a read-only root". _READ_WORD matches read before the -.
    #3387 tests/roadmap/implement/test_roadmap_implement_plan_reason.py subject is "the groups that change ..." (cause 1 of this issue)
    #3388 tests/roadmap/implement/test_roadmap_implement_amend.py subject is "the group that changes the catalog" (cause 1)
    #4442 tests/ai/client/test_ai_client_finish_reasons.py subject is "This plan" (cause 1)
    #3398 src/devops_cli/roadmap/stage_form.py subject is "the check" (cause 1); the probe line is quoted in a code span without its inner backticks
    #3453 src/devops_cli/commands/tf.py the gate judges the first path of the sentence, not the object of the read: "read_file of that prompt at lines 24 and 26 shows ..., and search_code with Adds: returned one unrelated hit in src/devops_cli/commands/tf.py" (cause 2 of this issue covers the search hit)
    #3453 src/devops_cli/roadmap/plan_read.py not known: "read_file of src/devops_cli/roadmap/plan_read.py line 478 shows ..."; the record holds no trace

    So two causes are not in the body above: the word read inside read-only, and a claim judged on the first path of the sentence when the read names another object.

  5. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  6. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

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

  7. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 11, 2026
  8. 4 remaining items

  9. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Pull request #4544 changes two acceptance criteria of this issue.

    The requirement "A search match supports a citation of its line" replaces "Search hit paths count as seen" and "Probe output paths count as seen". TraceFacts.of keeps the path:line of each search_code or callers match line. A Feasibility citation of that line (path:line or path:line:text) counts as seen. A claim of the whole file does not count as seen. A probe line gives no support to a path.

    Evidence (2026-11-11, _sentence_trace_problem on the branch of #4544):

    The false refusals that the two criteria were to stop do not occur without them: a cited match line is seen, and #4463 removes a quoted probe sentence. Thus the narrower rule is not a missing part, and no new issue is necessary. The proposal ## Feasibility section of the change records the same evidence.

  10. removed
    status/in-review
    owner/agent
    on Nov 11, 2026
  11. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 15:02 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