Skip to content

fix(roadmap): a kept plan fails the trace gate #4281

Closed

Description

@dan-petty

Problem

The trace gate refuses a plan that the job kept, because the kept plan carries no trace.

The stage job keeps a plan after it passes the gates (#4064, #4167). The gates include the trace gate (#3266): it refuses a Feasibility sentence that names a tool or reads a path that the run did not call. The trace gate reads the tool calls of the plan runs of this process (_Planner._trace_facts in src/devops_cli/roadmap/stage/stage.py; it joins every plan run since #4267). The plan record (StagePlanRecord in src/devops_cli/roadmap/stage/stage_plan_record.py) holds the key, the proposal and the request. It holds no trace facts.

So a plan that is read back from the file has no run in this process that can support its claims:

  • On a hit, the first reply is the kept plan and _trace_facts() is None, so the gate is skipped. The claims pass without a check.
  • A run of the planner that follows a hit has only its own calls as facts. This happens when another gate refuses the kept plan on a moved commit and the planner is asked again, and when the model review returns the plan and the planner repairs it. The new reply keeps the Feasibility claims of the kept plan, but its run did not call those tools. The trace gate then refuses it.

Evidence: the live run of 2026-11-09 21:53Z on item #4062 (model claude-sonnet-5-5) found a kept plan (the plan record of #4167, the key matched), ran the gates again, and the trace gate refused it twice: "The Feasibility section names the tool read_issue, but the run did not call it. The Feasibility section names the tool find_issues, but the run did not call it." The kept plan at .data/roadmap/stage/dan-petty/devops-cli/4062.json names both tools in its Feasibility section and had passed the gates, trace gate included, in the run that wrote it. I did not see the full log of that run; I read the code path above.

Expected

  • The plan record holds the trace facts of the run that made it: the set of tool names, and the paths that the Feasibility section of the plan cites and that the run read. The set is small and bounded by the toolset and by the text of the plan.
  • A hit uses these facts, joined with the facts of each later plan run of the item, as the facts of the trace gate. The gate then neither skips a kept plan nor refuses its claims.
  • A record without the facts field (an old record) still loads. It counts as a miss: the planner plans again. It does not count as a pass.
  • Answer to the question "should a kept plan be reused when the planner model changes?": no, and the code already does this. The key holds the model name (PlanFiles.key passes settings.ai.for_task("stage").model to plan_key), so a new model gives a new key, a miss, and a new plan. The facts need no extra rule.

Acceptance criteria

  • uv run devops ci test tests/roadmap/stage/test_roadmap_stage_plan_record_facts.py passes. It fails today (the record has no facts):
    • A plan whose Feasibility names read_issue, written after a gated run that called read_issue, holds read_issue in the facts of its record.
    • A record that is read back in a fresh planner (no trace in the process), where another gate refuses the kept plan and the planner revises it with a run that calls no tool, passes the trace gate.
    • The same flow with facts that lack read_issue is refused by the trace gate (the gate is not skipped).
    • A record in the old format (no facts field) loads, and the planner plans again with a new request.
    • A facts list of a plan that read many paths holds only the paths that the Feasibility section cites.
  • uv run devops roadmap eval stage --replay still accepts 5 of 5 good plans.
  • uv run devops ci fail-to-pass --base origin/main names the new tests as fail-to-pass.

Existing tool considered

TraceFacts and RunTrace.combined in src/devops_cli/roadmap/agent_run.py already hold the facts and join runs. The change stores a bounded copy of TraceFacts in the existing pydantic record and reads it back. No new library is needed. Skipping the gate for a kept plan was considered and rejected: it would keep the vacuous pass, and it would weaken the gate.

Cost

About 40 000 tokens to build (one model, one record field, one planner change, five tests, one spec delta), about 5 000 to keep, and 1 hour of elapsed time. The flaw costs two more planner calls for each such item, and the item fails.

Related

#4167, #4170, #4257, #4204, #4267

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    status/new
    value/high
    effort/medium
    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 either skips validation of a kept plan or refuses a valid one, blocking the planning pipeline or letting unverified claims pass.
    • Value: High. The stage job is the core planning path; a broken trace gate on kept plans blocks valid plans or admits unchecked ones.
    • Effort: Medium. The change adds a bounded facts field to StagePlanRecord, updates the gate to use it, handles old records, and adds targeted tests.
    • Related: fix(roadmap): the trace gate reads only the last run #4257, which asks for a different change. Both address the trace gate refusing valid Feasibility claims, but #4257 joins in-process runs while the candidate persists facts to the plan record for a kept plan read from disk.
  3. added
    priority/p1-high
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 9, 2026
  4. added a commit that references this issue on Nov 9, 2026
    cb2287e
  5. removed
    status/in-review
    owner/agent
    on Nov 9, 2026
  6. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-09 23:58 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