Skip to content

fix(roadmap): Read named pull request files to verify claims #3447

Closed

Description

@dan-petty

Problem or Motivation

The stage job accepts a claim about a prior pull request or plan without reading that pull request. #3410 is the evidence. Its body says "The plan of #3372 in pull request #3378 chose ! git grep -n -F devops_cli.roadmap.stage src/ tests/ as the whole-prefix check for a move of the stage* modules." Pull request #3378 holds no move group. Its plan adds the move-prefix check to src/devops_cli/roadmap/stage_move.py, and its tests use the literal as a case. The refine job published the claim in the proposed design. The plan of #3435 repeated it in Feasibility. The stage review made no tool call and did not catch it. A plan can therefore open a draft on a premise that the named pull request contradicts.

Proposed Solution & Architectural Design

  1. The stage verification pass reads the files of a pull request or plan that the issue or a plan line names, at the merge commit of that pull request.
  2. The pass reports a claim that the files do not support as an open finding with the path and the quoted text, so the plan returns to the planner.
  3. When the body of an issue makes the claim, the stage job returns the item with the evidence and plans nothing.
  4. Add a test with the fix(roadmap): the stage gate proves a negative search verify #3410 claim: the claim names a literal and a move, and the recorded docs(openspec): plan #3372 Check every module of a moved prefix #3378 plan holds no move group.

Target Subsystem

src/devops_cli/ai/tasks/roadmap_stage_verify.md, src/devops_cli/roadmap/stage_verify.py, src/devops_cli/roadmap/stage.py

Existing Tool Considered

The stage probe (src/devops_cli/roadmap/stage_probe.py) already reads a commit with git cat-file, git grep and git log. This change extends that read to the files of a named pull request and adds no new tool. The cost is about 5,000 tokens to build and test and about 1 hour elapsed.

Alternatives check of 2026-11-07: none.
Tool: none found.

Proposed design

Problem statement

The stage verification pass accepts a claim about a prior pull request without reading that pull request. #3410 is the evidence: its body says that the plan of #3372 in pull request #3378 chose ! git grep -n -F devops_cli.roadmap.stage src/ tests/ as the whole-prefix check of a move of the stage* modules, and the recorded #3378 plan at merge commit 6c15a64a614941629669a181e3220ae8bc7e27d0 holds no move group: it adds the move-prefix check to src/devops_cli/roadmap/stage_move.py, and its test uses the literal as a case. A plan can therefore open a draft on a premise that the named pull request contradicts. This change reads the changed files of each named pull request at its merge commit, adds them to the verification input, and reports a claim that those files do not support as a false_premise finding that returns the plan to the planner. The return of the item when its body states a false premise waits for #5701, because #3478 removed the premise_failed reply key from StageProposal.

Acceptance criteria

Requirement: Named pull request files at the merge commit

The stage verification input SHALL hold the changed files of each pull request that the issue body or the plan names, read at that pull request's merge commit.

Scenario: A named pull request is read at its merge commit

  • WHEN The issue body names pull request #3378, and the pull request read returns merge commit abc123.
  • THEN The verification input holds a pull_requests entry for 3378 with the commit abc123 and a path-to-text map of the files that the pull request changed.

Requirement: Only a named pull request number is read

The stage job SHALL read a pull request number only when the phrase pull request # or PR # names it, in the issue body or in the plan texts.

Scenario: A bare issue reference is not read

  • WHEN The issue body holds #3410 with no phrase before it and also holds pull request #3378.
  • THEN The verification input holds an entry for 3378 and no entry for 3410.

Requirement: A pull request that cannot be read leaves the plan running

The stage job MUST record a named pull request that it cannot read at a merge commit as no entry in the verification input, and SHALL go on with the plan.

Scenario: A named pull request has no merge commit

  • WHEN The issue body names pull request #3378, and the pull request read reports that it is not merged.
  • THEN The verification input holds no pull_requests entry for 3378, the pass still runs, and the plan is not stopped by the read.

Requirement: A pull request quote is evidence

The verification pass MUST treat a quote from a named pull request file as a text of its input, so that a false_premise finding with that quote is open.

Scenario: A false-premise finding quotes a pull request file

Requirement: Bounded pull request read

The verification input SHALL read no more than CONST_ROADMAP_STAGE_VERIFY_MAX_FILES files from a named pull request and SHALL cut each file to CONST_ROADMAP_STAGE_VERIFY_FILE_MAX_TOKENS tokens.

Scenario: A large pull request is bounded

  • WHEN A named pull request changes more files than the maximum, and each file is longer than the token limit.
  • THEN The input holds at most the maximum number of files, and each held file is cut to the token limit.

Requirement: The prompt names the pull request files

The stage verification prompt SHALL name the pull_requests key and SHALL tell the model to check a claim against those files.

Scenario: The verification prompt is loaded

  • WHEN The stage verification task loads src/devops_cli/ai/tasks/roadmap_stage_verify.md.
  • THEN The prompt names pull_requests, its merge commit and its path-to-text map.

Requirement: Regression case for #3410

The test suite MUST hold the #3410 claim, the literal ! git grep -n -F devops_cli.roadmap.stage src/ tests/, and the recorded #3378 plan at merge commit 6c15a64a614941629669a181e3220ae8bc7e27d0, which holds no move group.

Scenario: The #3410 claim is checked

Existing Tool Considered

gidgethub, the GitHub client of the project's session (docs/adr/0006-github-session-requests-go-through-gidgethub.md), covers the authenticated REST read of a pull request and its merge commit, and the git wrapper of src/devops_cli/roadmap/clone_git.py covers the read of a commit's tree. Neither gives the changed-file path-to-text map at the merge commit, the file and token bound, or the false_premise finding; the alternatives check of 2026-11-07 found no tool that does, and cli/cli (pull request metadata and diff, not the merge-commit tree) and guardrails-ai (schema checks on model output, no repository evidence) lack the same parts. The change adds that integration in-repo and no new dependency. The written cost is about 5,000 tokens to build, keep and fix the code and about 1 hour elapsed.

Key questions

  • Which paths hold the stage verification pass and the stage job?: src/devops_cli/roadmap/stage/stage_verify.py holds the verification pass, and src/devops_cli/roadmap/stage/stage.py holds the stage job. The body's src/devops_cli/roadmap/stage_verify.py and src/devops_cli/roadmap/stage.py name no file. [sources: src/devops_cli/roadmap/stage/stage_verify.py, src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/stage/stage_change.py:685]
  • Does the docs(openspec): plan #3372 Check every module of a moved prefix #3378 plan at its merge commit hold a move group?: No. The recorded plan of docs(openspec): plan #3372 Check every module of a moved prefix #3378 at merge commit 6c15a64a614941629669a181e3220ae8bc7e27d0 is the archived change openspec/changes/archive/2026-11-04-3372-the-stage-plan-of-a-module/: it adds move_prefix_problems to src/devops_cli/roadmap/stage_move.py and its test uses the literal ! git grep -n -F devops_cli.roadmap.stage src/ tests/ as a case. The eval fixture tests/fixtures/roadmap_eval/stage/3372-the-stage-plan-of-a-module/plan.json, which the same case file labels pull 3378, is the recorded first plan that the pass scored and does hold a move group, so the regression case reads the archived plan and not that fixture. [sources: openspec/changes/archive/2026-11-04-3372-the-stage-plan-of-a-module/proposal.md:11, openspec/changes/archive/2026-11-04-3372-the-stage-plan-of-a-module/tasks.md:9, tests/roadmap/stage/test_roadmap_stage_move_prefix.py:102, tests/fixtures/roadmap_eval/stage/3372-the-stage-plan-of-a-module/case.json:6, tests/fixtures/roadmap_eval/stage/3372-the-stage-plan-of-a-module/plan.json:21]
  • How does the stage job obtain the files of a named pull request at its merge commit?: Read the pull request with the GitHub session client (StageGitHub) for its merge_commit_sha, one GET through gidgethub. Fetch that commit from origin into the stage clone, then read the diff of the merge commit against its first parent and the text of each kept path at that commit with the git wrapper the stage probe already uses (git fetch, then git show <sha>:<path> or checkout_at). No per-file GitHub request is sent. (best practice) [sources: docs/adr/0006-github-session-requests-go-through-gidgethub.md, src/devops_cli/roadmap/stage/stage_github.py:59, src/devops_cli/github/client.py:235, src/devops_cli/roadmap/clone_git.py:39, src/devops_cli/roadmap/clone_git.py:64, ARCHITECTURE.md:207, src/devops_cli/roadmap/stage/stage_probe.py:156]
    • Chosen: GitHub metadata and git read. One API request gives the exact merge commit, the fetch follows the stage job's own rule that it plans on the commit it fetched from origin, and the local read reuses the bounded, read-only git read of the probe.
    • Rejected: GitHub changed-files and contents endpoints only. It needs one request for each kept file, each paced and charged on the identity's quota ledger, and the contents answer is cut and encoded.
    • Rejected: Local merge ref only. The ref can be absent and does not name the merge commit for every merge method.
  • Which files of the named pull request does the verification input hold?: Hold the files that the pull request changed at its merge commit, with the OpenSpec change folder and the paths that the claim names first. CONST_ROADMAP_STAGE_VERIFY_MAX_FILES bounds the list, and CONST_ROADMAP_STAGE_VERIFY_FILE_MAX_TOKENS bounds each file. (best practice) [sources: src/devops_cli/config/constants.py:3519, src/devops_cli/config/constants.py:3520, src/devops_cli/roadmap/stage/stage_verify.py:405]
    • Chosen: Changed files with priority. It gives evidence for the claim and stays inside the file and token budget.
    • Rejected: Every file at the merge commit. It exceeds the file and token budget.
    • Rejected: Only the paths in the claim. A plan file that the claim does not cite can contradict the claim.
  • How does the verifier receive the named pull request files and check a quote?: Add a pull_requests key to VerificationInput.payload. Each entry holds the number, the merge commit and a map of path to text. request_texts yields those texts, so the contains check accepts a quote from a pull request file as evidence. (best practice) [sources: src/devops_cli/roadmap/stage/stage_verify.py:473, src/devops_cli/roadmap/stage/stage_verify.py:502, src/devops_cli/roadmap/stage/stage_verify.py:516, src/devops_cli/ai/tasks/roadmap_stage_verify.md:32]
    • Chosen: Separate pull_requests key. It keeps repository files and pull request files apart and keeps a path exact.
    • Rejected: Merge into files with a prefix. A path can collide and the model cannot tell a repository file from a pull request file.
    • Rejected: Send only the pull request paths. No quoted text shows the contradiction.
  • Which finding type and return path does an unsupported pull request claim use?: Use false_premise with severity blocker or major. The locator names the plan's feasibility section (part proposal) or the text of the issue (part issue); problem names the pull request path and the claim; quote is the exact line of the pull request file. The open rules (OPEN_TYPES, OPEN_SEVERITIES, holds, contains) then return the plan to the planner. (best practice) [sources: src/devops_cli/roadmap/stage/stage_verify.py:88, src/devops_cli/roadmap/stage/stage_verify.py:104, src/devops_cli/roadmap/stage/stage_verify.py:147, openspec/specs/roadmap-stage/verification/spec.md:38]
    • Chosen: false_premise. It is already an open type with a quote check, and an open finding returns the plan.
    • Rejected: New defect type. It changes the nine-type schema and the golden set.
    • Rejected: other. It names no premise and hides the defect class from the repair round.
  • How does the job find the pull request numbers in the issue body and the plan?: Match the phrases pull request # and PR # only, without case, in the issue body and the plan texts. Read each number once, in first-seen order. Do not read a bare #. (best practice) [sources: tests/fixtures/roadmap_eval/stage/3410-a-plan-that-states-a-wrong-constant/issue.txt, src/devops_cli/roadmap/stage/stage_verify.py:473]
    • Chosen: Explicit phrases only. The fix(roadmap): the stage gate proves a negative search verify #3410 body holds pull request #3378 and bare #3410 and #3435, so the phrase avoids reads of unrelated issue numbers and keeps the input bounded.
    • Rejected: Every #. Issue references and cross-links cause unrelated reads.
    • Rejected: Let the model choose the numbers. The input is built before the model call and must be testable.
  • Does this change return the item when the issue body states a false premise?: No. The item feat(roadmap): Return a stage item when the body states a false premise #5701 delivers that path. fix(roadmap): a placeholder reply of a model moves no item #3478 removed premise_failed from StageProposal, and src/devops_cli/roadmap/stage/stage_change.py:685 holds no such key, so a body-claim return needs a reply field and a return path that this change does not add. This change reports the finding and returns the plan to the planner. (best practice) [sources: openspec/changes/archive/2026-11-04-3478-a-placeholder-reply-of-a-model/design.md:5, src/devops_cli/roadmap/stage/stage_change.py:685]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    status/new
    on Nov 4, 2026
  2. added
    value/medium
    effort/low
    on Nov 4, 2026
  3. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Priority: P2-Medium. A plan can open a draft on a false premise, but other gates still exist in the pipeline.
    • Value: Medium. Prevents plans built on false claims about prior PRs, reducing rework and bad drafts.
    • Effort: Low. The body estimates about 5,000 tokens and 1 hour elapsed.
    • Related: fix(roadmap): Check a class claim against the staged source #3407, which asks for a different change. Both verify claims in a stage plan, but #3407 checks a claim about a class against the staged source while the candidate checks a claim about a prior PR against that PR's files at its merge commit.
  4. added
    priority/p2-medium
    status/ready
    and removed
    status/new
    on Nov 4, 2026
  5. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

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

  6. changed the title [-]fix(roadmap): the plan checks a claim about a prior pull request against its files[/-] [+]fix(roadmap): Read named pull request files to verify claims[/+] on Nov 6, 2026
  7. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 68 characters, and the limit is 60. The type and the scope stay.

    • Before: fix(roadmap): the plan checks a claim about a prior pull request against its files
    • After: fix(roadmap): Read named pull request files to verify claims
    • Source of the summary: the background model
  8. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches surfaced no open, maintained tool or library that reads a named pull request's files at its merge commit and checks a stage plan's claim against the quoted text. The closest general-purpose options, the GitHub CLI (pull request metadata/diff, not the merge-commit tree) and guardrails-ai (schema/validator checks on model output, not repository evidence), do not cover that need, and the issue itself says the change extends the existing in-repo stage probe and adds no new tool.

    Tool: none found

    Lacks:

    • Reading the changed files of a named pull request at its merge commit and feeding them into the stage verification input
    • Reporting a claim that those files contradict as a false_premise finding with the path and quoted text
    • Returning the item with evidence when the issue body makes a contradicted claim
    • Bounding the pull request read by file count and per-file tokens

    Tools considered:

    Searches run:

    • tool verify LLM claims against source files evidence quote citation open source, results: 0
    • read pull request changed files at merge commit git tool, results: 0
    • verify claims against source files tool, results: 0
    • github pull request files merge commit, results: 0
    • fact checking code review, results: 0
    • openspec, results: 0
    • pull request diff, results: 0
    • GitHub CLI gh pr diff files, results: 0
    • Temporal durable workflow engine, results: 0
    • guardrails validate model output against evidence, results: 0

    Sources:

    Checked on 2026-11-07. A person decides what this means for the item. The check changes no label and closes no issue.

  9. dan-petty commented on Nov 14, 2026

    @dan-petty
    OwnerAuthor

    Returned to New: the design's third requirement cannot be built on main. It asks the planner to reply premise_failed, but #3478 removed that key from StageProposal: src/devops_cli/roadmap/stage/stage_change.py:678 says "The reply has no key to report a false premise: an issue that cannot be built as written is said in feasibility (#3478)", and src/devops_cli/ai/tasks/roadmap_stage_change.md states the same. Building requirement 3 would reverse #3478, which is outside this issue, and would need the item's body-claim path redesigned (the planner states the false premise in feasibility, and the job keeps the plan or returns it by another rule).

    Buildable remainder: requirements 1, 2, 4, 5 and 6 read the named pull request files at the merge commit into the verification input, allow a false_premise finding to quote one, bound the read, name pull_requests in the verify prompt, and add the #3410 regression. A refine round should split the body-claim rule into its own item, or decide how it replaces the removed reply key.

  10. added
    status/new
    and removed
    status/ready
    on Nov 14, 2026
  11. added
    status/ready
    and removed
    status/new
    on Nov 14, 2026
  12. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

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

    Moved to new items: #5701.

  13. dan-petty commented on Nov 17, 2026

    @dan-petty
    OwnerAuthor

    Issue 3447 is held by the branch origin/fix/3447-verify-named-pull-request-files with a commit by Daniel Petty. devops repos worktrees add refuses it.

  14. added
    status/new
    and removed
    status/ready
    on Nov 17, 2026
  15. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  16. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

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

  17. removed
    status/ready
    on Nov 17, 2026
  18. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor
  19. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-17 09:25 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