Skip to content

feat(roadmap): Refuse a plan that reads an absent model field #3344

Closed

Description

@dan-petty

Problem

When staging a plan that reads an entity from an external client, the planner sometimes assumes fields already exist on the client's return model.

In #3264 / PR #3305, the plan specified that stage_ready reads labels on a pull request using client.get_pull_status(). However, PullStatus in src/devops_cli/github/client.py only defined state, draft, merged, and head_sha, omitting labels. The plan omitted src/devops_cli/github/client.py from its tasks and impact list.

The stage check does not inspect whether attributes a plan accesses on API models actually exist on those models.

Proposed change

  1. In the stage probe or gate check, when a plan tasks or design specify reading a new attribute from a model (such as PullStatus.labels), verify whether the model definition contains that attribute.
  2. If the attribute is missing, ensure the plan lists the model module in its changes and tasks.
  3. Add a test in tests/roadmap/test_roadmap_stage_plan.py verifying that missing model attributes are identified during plan staging.

Acceptance criteria

  1. A test asserts that when a plan relies on reading a new field from a client model, the plan includes updating that model in its task groups.
  2. Plans with complete model updates pass validation.

Source: #3305

Proposed design

Problem statement

The stage planner can plan a read of a client model attribute that the model does not define. In #3264 / PR #3305 the plan read PullStatus.labels, but PullStatus in src/devops_cli/github/client.py lacked labels, and the plan did not list that module. The stage check must find this gap and require the model module in the plan.

Acceptance criteria

Requirement: Missing model attribute is refused

The stage proposal check SHALL refuse a plan that reads a model attribute absent from the model at the staged commit.

Scenario: PullStatus lacks labels

  • WHEN A plan reads PullStatus.labels and PullStatus in src/devops_cli/github/client.py has no labels field at the staged commit.
  • THEN check_proposal returns a problem that names PullStatus.labels and src/devops_cli/github/client.py.

Requirement: Model module must be in changes

The stage proposal check SHALL require the model module in a group's changes when a plan reads an attribute that the model lacks.

Scenario: Plan omits client.py

  • WHEN A plan reads PullStatus.labels and no group lists src/devops_cli/github/client.py in changes.
  • THEN check_proposal returns a problem that tells the model to add src/devops_cli/github/client.py to a group's changes.

Requirement: Complete model update passes

The stage proposal check SHALL accept a plan that reads a new model attribute when a group lists the model module in changes.

Scenario: Plan includes client.py

  • WHEN A plan reads PullStatus.labels and a group lists src/devops_cli/github/client.py in changes.
  • THEN check_proposal returns no problem for the model attribute.

Requirement: Missing attribute gets one correction

The stage job SHALL return a missing model attribute problem to the model once and SHALL stop the item on a second reply with the same gap.

Scenario: Two replies omit the model module

  • WHEN The first and second replies both read PullStatus.labels and omit src/devops_cli/github/client.py from changes.
  • THEN The item fails with RoadmapStageError, and the plan holds no ready change.

Requirement: Regression test covers model attributes

The test suite SHALL include an offline test in tests/roadmap/test_roadmap_stage_plan.py for a plan that reads a missing model attribute.

Scenario: Regression test runs

  • WHEN The test file tests/roadmap/test_roadmap_stage_plan.py runs.
  • THEN It checks both the refused plan and the accepted plan with the model module in changes.

Existing Tool Considered

No alternatives check has run. No open, maintained tool or library covers this repository-specific stage-plan check. Build it in devops-cli: about 15,000 output tokens to write and test the first version, about 2,000 tokens for each later fix, and about 3 hours elapsed.

Key questions

  • Where must the stage job enforce a model attribute that a plan reads?: In check_proposal. A probe fact alone does not refuse a plan that keeps the missing attribute. (best practice) [sources: tests/roadmap/test_roadmap_stage_plan.py, src/devops_cli/roadmap/stage_change.py]
    • Chosen: check_proposal gate. The stage tests show that check_proposal returns a problem and the planner sends it back to the model once.
    • Rejected: Stage probe only. A probe informs the model but does not refuse a plan that keeps the missing attribute.
    • Rejected: OpenSpec validation. OpenSpec validates spec deltas and cannot read Python model fields.
  • How does the check know the fields of a model at the staged commit?: It parses each Python file under src/devops_cli with ast. It records classes that subclass pydantic.BaseModel and their annotated field names. (best practice) [sources: src/devops_cli/github/client.py, tests/roadmap/test_roadmap_stage_plan.py]
    • Chosen: AST parse. The staged tree gives source text, and ast reads fields without import side effects.
    • Rejected: Import the module. A staged file may not import, or may fail to import, and the check needs static facts.
    • Rejected: Regular expression. A regex misses inheritance and annotations and gives false matches.
  • Which model references does the check inspect?: It inspects backticked dotted references in group task text and spec text, such as PullStatus.labels, when the class is a Pydantic model in the staged tree. (best practice) [sources: tests/roadmap/test_roadmap_stage_plan.py, src/devops_cli/github/client.py]
  • What must the plan contain when the model lacks the attribute?: A group changes list that includes the module of the model, such as src/devops_cli/github/client.py. (best practice) [sources: tests/roadmap/test_roadmap_stage_plan.py, src/devops_cli/github/client.py]
    • Chosen: Module in changes. A changed path renders into the tasks and the impact of the change.
    • Rejected: Attribute name in task text only. A task text does not change a file, so the model stays incomplete.
    • Rejected: Module in reads only. A read does not change the model definition.
  • How many correction turns does a missing model attribute get?: One. The first reply gets the problem. A second reply with the same gap stops the item. (best practice) [sources: tests/roadmap/test_roadmap_stage_plan.py]
    • Chosen: One retry. The model needs the problem text to correct the plan, and one retry matches the missing-path rule.
    • Rejected: No retry. The model cannot correct a gap that it does not see.
    • Rejected: Unlimited retries. Unlimited turns hide a model that cannot plan the change.
  • Which test file holds the regression test?: tests/roadmap/test_roadmap_stage_plan.py. [sources: tests/roadmap/test_roadmap_stage_plan.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 3, 2026
  2. dan-petty commented on Nov 3, 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. Prevents a recurring class of plan defects but does not block a critical path.
    • Value: Medium. Reduces incorrect plans that reference attributes not present on client models.
    • Effort: Medium. Requires a new check in the stage probe, a validation rule, and a test.
    • Related: feat(roadmap): gate a plan that adds a StageProposal field #3328, which asks for a different change. Both add a stage probe that verifies a plan's field references match a model definition, but #3328 checks StageProposal fields against prompt reply keys while the candidate checks client model attributes like PullStatus.labels.
  3. added
    priority/p2-medium
    on Nov 3, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 3, 2026
  5. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    Staged: branch feat/3344-the-stage-probe-checks-client-model, draft pull request #3350. 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. Read the models of the staged tree: 16942 tokens
    2. Refuse a missing model attribute: 24389 tokens
    3. Add the spec delta of the attribute check: 6729 tokens

    The plan run made 2 model request(s), and used 153476 input tokens and 8942 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:

    • other at group 2, implementation: The implementation returns a problem and also adds the module to a group's changes. This contradicts the spec scenarios: the check must tell the model to add the module, and a second reply with the gap stops the item. The check would also mutate the plan it checks. Evidence: "Return a problem that names the reference and the module when the field is missing, and add the module to a group's changes when no group lists it."
    • other at group 3: The group creates the spec delta and tasks.md by hand. The stage job already renders these files from the reply with render_change, so the group duplicates that work and will conflict with the rendered files. Evidence: ""openspec/changes/3344-stage-model-attribute-check/tasks.md""
    • other at what_changes / specs: The check scans every dotted reference in the spec, group and design text, and it cannot tell a mention from a read. This plan names PullStatus.labels in its own spec scenarios and lists no group that changes client.py. The new rule would refuse the plan that adds it. Evidence: "check_proposal collects the dotted references in the text of the groups, the spec deltas and the design, such as PullStatus.labels."
  7. added 2 commits that reference this issue on Nov 4, 2026
  8. added
    status/planned
    and removed
    status/ready
    on Nov 4, 2026
  9. changed the title [-]feat(roadmap): the stage probe checks client model attributes when a plan reads new fields[/-] [+]feat(roadmap): Refuse a plan that reads an absent model field[/+] on Nov 6, 2026
  10. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

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

  11. added
    status/in-progress
    and removed
    status/planned
    on Nov 8, 2026
  12. added 2 commits that reference this issue on Nov 8, 2026
    5cfbac8
    1160e87
  13. added
    status/in-review
    and removed
    status/in-progress
    on Nov 8, 2026
  14. removed
    status/in-review
    on Nov 8, 2026
  15. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor
  16. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 17:21 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/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions