Skip to content

feat(roadmap): detect already-merged issue changes in stage #4113

Not planned

Description

@dan-petty

Problem or Motivation

When devops roadmap stage plans an issue whose requested code changes have already been merged into origin/main in an earlier pull request, the stage job has no automated check to detect that the functional premise is already delivered.

In issue #4057 (perf(roadmap): cache registry_table in stage eval replay), commit 8476163 (pull request #3981) had already threaded registry_table through PlanUnderTest, _path_gate, replay_case, and replay_all. When devops roadmap stage planned #4057, it discovered in its probe that the code already existed on origin/main. Because the stage pipeline lacks a mechanism to detect that an issue is already merged or functionally resolved, it was forced to contrive a skip_specs: true plan with regression tests only, which then had to go through the full 2-PR service cycle (plan PR waiting for human merge, followed by a separate implement runner job).

Proposed Solution & Architectural Design

  1. In src/devops_cli/roadmap/stage/stage_probe.py, detect when the functions, arguments, or fixes cited in the issue body or refine section are already present on the staging base tree (origin/main).
  2. When the functional fix is already merged:
    • Provide an automated diagnostic that returns the issue with evidence citing the merged commit (devops roadmap return <issue> --comment "... already merged in <commit>"), so a maintainer can close it as already resolved or superseded;
    • If tests are genuinely missing, suggest splitting or re-titling the candidate to test debt (type/test, priority/p3-low) rather than consuming high-priority service slots.

Target Subsystem

AI & Agentic Review Pipeline

Existing Tool Considered

git log and ast inspection in stage_probe.py. Checking whether cited symbols and signatures already exist in the staging tree requires approximately 3,000 tokens to implement and test.

Standards Compliance

  • I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 5, zero bare exceptions, tests that cover the changed lines).
  • I am willing to submit a pull request implementing this feature with accompanying tests.

Dependencies

Alternatives check of 2026-11-25: in-use.
The repository already uses this tool.
Tool: git/git (https://github.com/git/git), NOASSERTION, last activity 2026-11-24, maintained.
Reason: Searches found no standalone tool for this; git, which the probe already runs, supplies the existence and adding-commit facts, but not the delivered-premise judgement, the reply field, or the stage return path.

Covers:

  • Names the commit that last added a cited identifier
  • Confirms a cited path or symbol exists at the staging commit
  • Finds the commit that added a cited path with --diff-filter=A

Lacks:

  • No judgement that a present symbol means the change is delivered
  • No plan-reply field or prompt rule recording the premise
  • No return-to-New path that quotes the adding commits
  • No accounting of the extra reads against the probe command bound

Proposed design

Problem statement

The stage job has no check for an item whose cited change a merged commit already delivered. Issue #4057 showed the cost: the job planned regression tests only, and the plan took a plan pull request and a separate runner job. The stage job must report the merged commit and return the item to New with evidence.

Acceptance criteria

Requirement: Probe reports the commit of a cited identifier

When the staging commit defines an identifier that the issue cites, the premise probe SHALL report the commit that last added its text.

Scenario: A cited identifier already exists

  • WHEN The issue cites an identifier that a commit added before the staging commit.
  • THEN The probe line for that identifier names the short hash and the date of that commit.

Requirement: Probe reports the commit of a cited path

When the staging commit holds a path that the issue cites, the premise probe SHALL report the commit that added that path.

Scenario: A cited path already exists

  • WHEN The issue cites a path that a commit added before the staging commit.
  • THEN The probe line for that path names the short hash of the adding commit.

Requirement: Probe states that the premise is already present

The premise probe MUST add one summary line when every path and identifier that the issue cites exists at the staging commit.

Scenario: Every cited item exists

  • WHEN Each cited path and each cited identifier exists at the staging commit.
  • THEN The probe text holds one line that says the premise is already present and names the cited items.

Requirement: New probe reads stay inside the command bound

The probe MUST count each read of an adding commit against CONST_ROADMAP_STAGE_PROBE_MAX_COMMANDS.

Scenario: The bound stops the new reads

  • WHEN The issue cites more identifiers than the remaining commands can serve.
  • THEN The probe runs no more than the bound and lists each item that it did not probe.

Requirement: The stage reply holds the premise field

The stage plan reply MUST hold a boolean premise_delivered field that defaults to false.

Scenario: A recorded reply omits the field

  • WHEN A recorded plan reply holds no premise_delivered key.
  • THEN The reply parses with premise_delivered false.

Requirement: The prompt gives the rule of the premise field

The staging prompt SHALL state that the planner sets premise_delivered true only when the probe reports the premise already present.

Scenario: The prompt text is read

  • WHEN The staging prompt text is read.
  • THEN It holds the field name, the rule that limits it to the probe evidence, and the instruction to quote the premise line.

Requirement: A delivered premise returns the item

When the plan sets premise_delivered true, the stage job MUST return the item to New with a comment that names each adding commit.

Scenario: The plan marks the premise delivered

  • WHEN The reply holds premise_delivered true and the probe found an adding commit.
  • THEN The job writes no branch and no pull request, and its comment names each adding commit.

Requirement: The return comment offers the test-debt path

The return comment SHALL state that a person may re-title the item as test debt with the type test.

Scenario: The comment of a delivered premise

  • WHEN The job returns an item whose premise is already present.
  • THEN The comment states the test type and that a person sets the title and the labels.

Requirement: A claim without probe evidence is refused

When the plan sets premise_delivered true and the probe found no present cited item, the stage job MUST refuse the reply.

Scenario: The claim has no evidence

  • WHEN The reply holds premise_delivered true and the probe reports no cited item present.
  • THEN The job refuses the reply with a form problem and returns no item.

Existing Tool Considered

The alternatives check in the issue body records the verdict in-use for git/git (https://github.com/git/git). The block covers the detection. git cat-file, git grep, git log -S and git log --diff-filter=A find a cited path or identifier and its adding commit at the staging commit. The block lacks the delivered-premise judgement, the premise_delivered reply field and the prompt rule. It also lacks the return-to-New path and the accounting of extra reads against the probe command bound. The proposal adds these parts in src/devops_cli/roadmap/stage/stage_probe.py, src/devops_cli/roadmap/stage/stage_models.py, the staging prompt and the stage return path.

Key questions

  • Which tool detects that a cited path or identifier already exists at the staging commit?: git/git at the staging commit. probe_premise already runs git cat-file, git grep, git log and git ls-tree, and definition_lines finds the definition of each cited identifier. The alternatives check records in-use for git/git. (best practice) [sources: src/devops_cli/roadmap/stage/stage_probe.py, src/devops_cli/roadmap/premise.py]
    • Chosen: git/git. The probe already runs git at the staging commit, and the alternatives block records it as in-use.
    • Rejected: A second probe module. It repeats the checkout and the command budget, and the model reads two texts.
    • Rejected: Existing stage_probe_defined lines only. Those lines name no commit, so the return comment cannot cite the merged commit.
  • Where does the probe report an item that already exists?: In probe_premise, with new fields and lines on Probe. One pass keeps one command bound and one text for the model. (best practice) [sources: src/devops_cli/roadmap/stage/stage_probe.py, src/devops_cli/config/constants.py:3827]
    • Chosen: Extend Probe and probe_premise with the adding commit of each present item. The probe holds the checkout, the commit and the budget, so a second pass would double the commands.
    • Rejected: Add a second probe module for merged changes. It repeats the checkout and the budget, and the model reads two texts.
    • Rejected: Let the planner read the existing stage_probe_defined lines only. Those lines name no commit, so the return comment cannot cite the merged commit.
  • How does the stage job learn that the premise is already delivered?: From a boolean premise_delivered in the plan reply. The planner sets it from the probe lines, and the job acts only on that field. (best practice) [sources: src/devops_cli/roadmap/stage/stage_models.py, AGENTS.md]
    • Chosen: A premise_delivered boolean in the plan reply. A cited symbol that exists is no proof that the requested change is delivered, so the judgement needs a record.
    • Rejected: Return the item whenever every cited item exists. An item that asks for tests around existing code cites symbols that exist, so this rule would return a real item.
    • Rejected: Comment the evidence and stage the item. The item still takes a plan pull request and a runner job, which is the cost that this item removes.
  • What does the stage job do when the plan marks the premise delivered?: It returns the item to New with a comment that names each adding commit. It writes no branch and no pull request. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, CONTEXT.md]
    • Chosen: Return the item to New with the evidence. This is the existing path for a false premise, and refine reads the evidence of a stage return.
    • Rejected: Close the item as not planned. A close is a decision on the record that the maintainer makes after the evidence.
    • Rejected: Stage the plan with a comment. It keeps the two-pull-request cycle that this item removes.
  • Does the stage job re-title the item as test debt?: No. The return comment states the option, and a person sets the title and the labels. (best practice) [sources: CONTEXT.md, AGENTS.md]
    • Chosen: State the option in the return comment. The stage job changes no label that a person set, and the title is a person's edit.
    • Rejected: Re-title the item with the type test and priority/p3-low. The stage job changes no label that a person set, and intake sets the priority.
  • Which commit does the probe name as the adding commit?: git log -S<name> for an identifier, and git log --diff-filter=A for a path. The probe uses the existing newest_commit helper. (best practice) [sources: src/devops_cli/roadmap/stage/stage_probe.py]
    • Chosen: -S for an identifier and --diff-filter=A for a path. -S finds the commit that changed the count of the text, and --diff-filter=A finds the commit that added a path.
    • Rejected: --diff-filter=A for both. It finds the commit that added a file, not the commit that added an identifier to an existing file.
    • Rejected: git blame on the definition line. It names the last commit of the line, which may be a later edit, and it reads one file for each hit.
  • Which command bound holds the new reads?: CONST_ROADMAP_STAGE_PROBE_MAX_COMMANDS, the existing bound of the probe. (best practice) [sources: src/devops_cli/config/constants.py:3827, src/devops_cli/roadmap/stage/stage_probe.py]
    • Chosen: The existing bound. One probe has one budget, and a second bound would need a second skip message.
    • Rejected: A new constant for the merged check. Two bounds for one run give two rules to keep.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 8, 2026
  2. dan-petty commented on Nov 8, 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/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It prevents wasted two-PR service cycles but does not block the pipeline from functioning.
    • Value: Medium. It saves maintainer time and service slots by catching already-delivered issues early in staging.
    • Effort: Medium. The body estimates roughly 3000 tokens of implementation and testing across stage_probe.py and related modules.
    • Related: fix(roadmap): Read named pull request files to verify claims #3447, which asks for a different change. Both verify claims about prior work in the stage pipeline, but the candidate detects already-merged code on origin/main while #3447 reads named PR files to check specific claims.
  3. added
    priority/p2-medium
    on Nov 8, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 8, 2026
  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

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

  6. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: Searches found no separate maintained tool for "is this issue's premise already merged"; the only tool that covers the detection is git, whose ls-tree/cat-file/grep already tell whether a cited path or identifier exists at the staging commit and whose log -S / log --diff-filter=A give the adding commit, and the issue itself says probe_premise already runs these. It covers only that detection step: the premise_delivered reply field, the prompt rule, the return-to-New comment and the refusal of an unevidenced claim are stage-pipeline code that no external tool supplies.

    The item already names this tool.

    Tool: git/git (https://github.com/git/git)

    • License: NOASSERTION
    • Last activity: 2026-11-10
    • Maintained: yes

    Covers:

    • Reports whether a cited path exists at the staging commit (git ls-tree, git cat-file)
    • Reports whether a cited identifier is defined at the staging commit (git grep)
    • Names the commit that added an identifier's text (git log -S) or added a path (git log --diff-filter=A)
    • Runs read-only at a fixed commit, so the new reads fit the existing probe command bound

    Lacks:

    • A judgement that an existing symbol or path means the issue's requested change is delivered; existence alone is not proof of intent
    • The boolean premise_delivered field on the stage plan reply and its default of false
    • The staging prompt rule that limits the field to probe evidence and requires quoting the premise line
    • The stage-job return path: no branch, no pull request, a comment naming each adding commit
    • Refusing a premise_delivered claim that has no probe evidence, and the test-debt suggestion in the return comment

    Tools considered:

    Searches run:

    • open source tool detect whether a feature or fix is already merged in a git repository, results: 5
    • find the commit that introduced a symbol or line of code with git log -S pickaxe, results: 5
    • git log --diff-filter=A find commit that added a file, results: 5
    • git log -S "pickaxe" documentation find commit that added a string git-scm, results: 5
    • git-scm.com git-log documentation pickaxe -S<string>, results: 5
    • stackoverflow how to find which commit introduced a string with git log -S, results: 5
    • git cherry patch-id detect change already applied upstream commit, results: 5

    Sources:

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

  7. added
    owner/service
    and removed
    owner/service
    on Nov 18, 2026
  8. added
    owner/service
    and removed
    owner/service
    on Nov 19, 2026
  9. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

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

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  12. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    Triage under #6519 (owner instruction of 2026-11-30), before the hold #6521 closes. This item adds or extends a gate, refusal, screen, cap, limit, retry, result line, shell allowlist, tool catalog or plan-shape rule of the stage, implement or fix-checks job. #6519 found that 263 of about 900 issues in four weeks added such rules and none replaced the engine. Stage now runs on stock Coder (grade 60 on 30 graded attempts), where the agent reads the repository, runs the checks in its loop and has a real shell; implement follows (#6527). The code paths that this item names have also moved. If the failure class still shows in graded attempts, file a new item from that evidence. Closed as not planned; a person may reopen it.

  13. removed
    status/new
    on Nov 30, 2026
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/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions