Skip to content

feat(roadmap): the stage context names open plans that edit the same files #3252

Closed

Description

@dan-petty

Problem

A plan does not know about the open plans and pull requests that edit the same files. Evidence from 2026-11-02:

Proposed change

When the stage context is built, list the open plan pull requests and open pull requests whose changed files overlap the paths that the plan cites or creates: number, title, state and the shared paths. For a cited metric or instrument name, list the other files that send or read it (git grep at the staged commit). The prompt tells the planner to write each overlap into ## Dependencies, and the gate refuses a plan with overlaps and a Dependencies part of "None".

Acceptance criteria

  1. A test with a fake list of pull requests shows that an overlapping path appears in the context with the number.
  2. A test shows that a cited metric name lists its other senders.
  3. check_proposal refuses "Dependencies: None" when the context lists an overlap, and names it.
  4. The extra GitHub reads fit the request budget (ADR 0016), and the number of requests is stated.

Related: #3238, #3200, #3246.

Proposed design

Problem statement

The stage job builds a plan without knowledge of the open pull requests that change the same files. Two plans that edit INSTRUMENTS or docs/TELEMETRY.md can merge one after the other and force a regenerate. A plan can also put an alert on a counter that other code sends, and nothing checks the other senders. The change puts the overlaps and the other senders of a cited metric into the stage context. The gate then refuses a plan that says Dependencies: None when an overlap exists.

Acceptance criteria

Requirement: Stage context lists an overlapping pull request

The stage context builder SHALL list each open pull request that changes a path the plan names, with its number, title, state and shared path.

Scenario: A fake pull request changes a cited path

  • WHEN A test gives the builder a fake list with pull request 3173, which changes docs/TELEMETRY.md, and a plan that cites docs/TELEMETRY.md.
  • THEN The context holds one entry with number 3173, its title, its state and docs/TELEMETRY.md.

Requirement: A plan pull request carries a plan mark

The stage context builder SHALL mark an open pull request whose title has the type docs(openspec) as a plan pull request.

Scenario: A plan pull request overlaps a created path

  • WHEN A test gives the builder a fake pull request titled docs(openspec): 3252-stage-context that changes src/devops_cli/roadmap/stage.py, and a plan that creates that path.
  • THEN The context entry holds the number, the title, the state, the plan mark and src/devops_cli/roadmap/stage.py.

Requirement: A cited metric lists its other senders

For each cited metric name, the builder SHALL list the other files that hold the name, from git grep at the staged commit.

Scenario: A cited counter lists the files that hold its name

  • WHEN A test gives the builder a plan that cites devops_cli_github_requests_total and a staged commit that holds the name in two files.
  • THEN The context lists src/devops_cli/telemetry/instruments.py and docs/TELEMETRY.md under the cited name.

Requirement: The gate refuses an empty Dependencies part on an overlap

check_proposal SHALL refuse a plan with Dependencies: None when the context lists an overlap, and SHALL name the pull request and the path.

Scenario: An overlap with Dependencies: None

  • WHEN check_proposal gets a reply whose Dependencies part is None and a context that lists pull request 3173 on docs/TELEMETRY.md.
  • THEN The problems hold one sentence that names pull request 3173 and docs/TELEMETRY.md.

Requirement: The stage prompt states the Dependencies rule

The stage prompt SHALL tell the planner to write each overlap and each shared metric sender into ## Dependencies.

Scenario: The prompt holds the Dependencies rule

  • WHEN A test reads the stage prompt file.
  • THEN The prompt holds a rule that names ## Dependencies, None and the overlap list.

Requirement: The overlap read costs a stated number of GitHub requests

The builder SHALL read the open pull requests and their files in one GraphQL request for each 100 pull requests, and the design SHALL state that count.

Scenario: 150 open pull requests cost two requests

  • WHEN A test gives the builder a fake GitHub client and 150 open pull requests.
  • THEN The fake client records two GraphQL requests and no other request.

Existing Tool Considered

No alternatives check has run. The GitHub CLI (gh) is open and maintained, and the repository already uses it. It lists the open pull requests and their changed files with gh pr list --json number,title,state,files. git grep lists the files that hold a cited metric name at the staged commit. Neither tool compares two path sets, renders the context entry or refuses a plan whose Dependencies part is None. The change writes that glue: about 200 lines with tests, about 100k tokens to build, keep and fix, and about one day of elapsed time.

Key questions

  • Can the planner already read open pull requests and search open items?: The planner's toolbox holds read-only tools. With the toolset extended, it also holds a read of an issue or a pull request and a search of open items on GitHub. [sources: CONTEXT.md]
  • Should the stage context carry the overlap list, or should the planner find it with its own tools?: The stage context carries the list. The gate must refuse a plan that ignores an overlap, and the gate sees only the context and the reply. The planner's tool budget is small. (best practice) [sources: CONTEXT.md, docs/ROADMAP_WORKFLOW.md:232]
    • Chosen: Build the overlap list into the stage context. The gate can then check the reply against the list, and the planner spends no tool call on the search.
    • Rejected: Let the planner search with its extended tools. The gate cannot check a search that the planner did not run, and the tool budget is small.
  • Which GitHub read supplies the open pull requests and their changed files?: One GraphQL query for each 100 open pull requests. The query returns the number, title, state and changed files of each pull request. (best practice) [sources: docs/TELEMETRY.md, CONTEXT.md]
    • Chosen: One GraphQL query for each 100 open pull requests, with the files connection. One request returns every field that the context needs, and the rate limiter counts it once.
    • Rejected: One gh pr view --json files for each open pull request. The reads grow with the number of open pull requests, and each read costs a separate request.
    • Rejected: Reuse the open pull requests from the poll. The poll holds no changed files.
  • Which document holds the request budget that the issue cites as ADR 0016?: ADR 0016 is 0016-labels-hold-the-roadmap-items-fields.md. It holds the item fields, not a request budget. The GitHub rate limiter is the request budget: devops_cli_github_requests_total counts each paced request by resource. [sources: docs/adr/0001-github-is-the-roadmap-source.md, docs/TELEMETRY.md]
  • Where does the plan write the overlaps, and what does the gate read?: The stage reply gets a dependencies field. The change proposal renders it as the ## Dependencies section. check_proposal reads the field and compares it with the overlap list. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:232, src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_eval_gates.py]
    • Chosen: A dependencies field of the stage reply. The gate reads a field, not prose, and the prompt gives the planner one place for each overlap.
    • Rejected: The ## Dependencies section of the proposal text. The gate would parse prose, and a different wording would hide the overlap.
    • Rejected: A pydantic constraint on the reply schema. The schema cannot see the overlap list.
  • Which paths does the overlap check compare?: The check compares every path that the reply names: the changes paths, the paths in the verify commands and the new test files. It reuses the path extraction of path_problems. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:232, openspec/changes/archive/2026-11-01-3010-stage-refuses-missing-paths/design.md]
    • Chosen: Every path that the reply names. A plan that only reads a shared file can still conflict with a plan that edits it, and the path rule already extracts these paths.
    • Rejected: Only the changes paths. It misses a plan that reads or verifies a shared path.
  • How does the context list the other senders of a cited metric name?: The builder takes each name in the reply that INSTRUMENTS holds as a cited metric. It runs git grep -w at the staged commit and lists each file with a hit. It marks the files that the plan changes. (best practice) [sources: docs/TELEMETRY.md, src/devops_cli/telemetry/instruments.py]
    • Chosen: A name that INSTRUMENTS holds. The map is the single list of instruments, and the telemetry test already ties every metric to it.
    • Rejected: A devops_cli_ token in the reply. A token can name a dashboard file or a span, not a metric.
    • Rejected: A name that the planner marks. The planner can forget the mark, and the gate would miss the senders.
  • What must the pull request state when it changes the stage prompt or check_proposal?: It must state the replay score of the same model before and after the change. It must name the model. [sources: docs/ROADMAP_WORKFLOW.md:233]
  • Which modules and tests does the change touch?: The callers of check_proposal are stage.py, stage_change.py, stage_eval_gates.py, stage_eval_run.py, stage_specs.py and stage_verify.py under src/devops_cli/roadmap/. The prompt is roadmap_stage_change.md. The tests are tests/roadmap/test_roadmap_stage_form.py, test_roadmap_stage_plan.py and test_roadmap_stage_prompt_rules.py. [sources: src/devops_cli/roadmap/stage.py, src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_eval_gates.py, src/devops_cli/roadmap/stage_eval_run.py, src/devops_cli/roadmap/stage_specs.py, src/devops_cli/roadmap/stage_verify.py, tests/roadmap/test_roadmap_stage_form.py, tests/roadmap/test_roadmap_stage_plan.py, tests/roadmap/test_roadmap_stage_prompt_rules.py, docs/ROADMAP_WORKFLOW.md:233]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 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.

    • 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. Prevents merge conflicts and missed dependencies but does not block the pipeline; no security or data-loss risk.
    • Value: Medium. Reduces rework from overlapping plans and missed metric senders, but the system functions without it.
    • Effort: Medium. Requires GitHub API calls for open PRs, file-overlap logic, git grep for metric senders, prompt edits, and a new gate rule.
    • Related: feat(roadmap): record and check plan dependencies #3224, which asks for a different change. Both items work on the ## Dependencies section, but #3224 adds the field and rendering while the candidate populates it with open-PR file overlaps and adds a gate check.
  3. added
    priority/p2-medium
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  4. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

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

  5. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Staged: branch feat/3252-the-stage-context-names-open-plans, draft pull request #3298. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. List the other files that hold a cited metric name: 19449 tokens
    2. List the open pull requests that overlap the paths of a reply: 22120 tokens
    3. Put the overlaps and the senders into the stage context: 20395 tokens
    4. Refuse an empty Dependencies field on an overlap: 30581 tokens
    5. State the Dependencies rule in the stage prompt: 22475 tokens
    6. Report the request count of the overlap read in the workflow page: 17271 tokens

    The plan run made 3 model request(s), and used 230472 input tokens and 15839 output tokens. The model made no tool call.

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • task_order at group 3: Group 3 passes the overlap list to check_proposal through _settle. The overlaps argument of check_proposal only comes in group 4, a later group. Evidence: "Pass the overlap list to _settle so that check_proposal sees it"
    • other at group 5: The plan adds a dependencies field to StageProposal but adds only a rule to the prompt. The existing prompt test needs a reply-key bullet for each model field, so it fails. Evidence: "assert sorted(bullets) == sorted(StageProposal.model_fields)"
    • spec_delta_wrong at specs, requirement "The overlap read costs a stated number of GitHub requests": The requirement says the builder states the request count in the comment of the staged item. No group writes that code or tests it. Group 6 only edits a document. Evidence: "SHALL state that count in the comment of the staged item"
  6. added 2 commits that reference this issue on Nov 3, 2026
  7. added
    status/planned
    and removed
    status/ready
    on Nov 3, 2026
  8. added
    status/in-review
    and removed
    status/planned
    on Nov 4, 2026
  9. removed
    status/in-review
    on Nov 4, 2026
  10. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-04 04:48 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/p2-mediumscope/roadmaptype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions