Skip to content

refactor(roadmap): type the stage planner request #4046

Closed

Description

@dan-petty

Problem

The planner request is an untyped dict[str, Any] (_Planner._request, stage.py). The inputs that the gates need are not in it. They are instance fields of _Planner: _probe_lines, _overlaps, _metric_senders and the creators that _creators() reads with a live call.

So a gate cannot run again without the _Planner object and the open requests behind it. This blocks any later work that keeps a plan and judges it again, for example the issue #4064.

A dict also has no check of its keys. A typo in a key reaches the model silently.

Expected

Define one pydantic model StageRequest with extra="forbid", in a new module roadmap/stage/stage_request.py. It holds:

  • the fields the model reads today: number, title, body, context, capabilities, budget, rejected_plan, overlaps, metric_senders and probes;
  • the inputs of the gates: the probe lines, the overlaps, the senders and the creators.

_Planner._request returns a StageRequest. The JSON that the planner sends to the model is request.model_dump(exclude=<the gate-only fields>). The model sees the same keys and values as today.

Add one function gate_arguments(request, ...) that builds the arguments of check_proposal from a StageRequest and the tree. _settle calls it. A gate then reads only the request and the tree, not the planner.

This change stores nothing, adds no setting and changes no gate.

Acceptance criteria

  • uv run pytest tests/roadmap/stage/test_roadmap_stage_request.py -k model_json_unchanged - for a fixed item, the JSON sent to the model equals the golden dict of today. The gate-only fields are not in it.
  • uv run pytest tests/roadmap/stage/test_roadmap_stage_request.py -k gates_from_request - check_proposal gives the same problems when its arguments come from a StageRequest alone, with no _Planner object.
  • uv run pytest tests/roadmap/stage/test_roadmap_stage_request.py -k forbid_extra - an unknown key in StageRequest raises a validation error.
  • ! grep -n 'request: dict\[str, Any\]' src/devops_cli/roadmap/stage/stage.py - the untyped request is gone.

Every command above fails on the unchanged code. The pull request cites the fail-to-pass run (devops ci fail-to-pass --base <ref>).

Feasibility

I read stage.py at origin/main: _Planner._request, _read_overlaps, _dependency_of, _settle and _creators. I confirmed that the probe lines, overlaps, senders and creators are instance state today. I did not run the planner or the tests.

The JSON keys that the model reads come from _request. A test with a golden dict proves that they do not change. The change makes no GitHub request.

Existing tool considered

pydantic, which the project already uses for every model. No new library.

Cost

Build: about 40k tokens and 2 h (one model, one function, 4 tests). Keep: about 2k tokens per quarter. Fix: about 8k tokens and 0.5 h.

Related

Part of #3027. The issue #4064 uses this model. #3529. Order: after the issue #4040 (both change stage.py).

Activity

  1. added
    source/agent
    type/refactor
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 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/refactor. The refactor prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It blocks follow-up work such as keeping a plan as a file, but it changes no user-facing behaviour today.
    • Value: Medium. It enables re-judging plans and file-based plans, which are future user-visible features.
    • Effort: Medium. The body estimates one model, one function, and four tests at about two hours.
    • Related: fix(roadmap): a plan request leaves room for the planner tools #3477, which asks for a different change. Both items modify the stage planner request in stage.py, but #3477 fixes the request size to keep tool calls while this candidate types the request fields.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 8, 2026
  5. removed
    status/in-review
    owner/agent
    on Nov 8, 2026
  6. devops-cli-service commented on Nov 8, 2026

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

    @devops-cli-service
    Contributor

    Live since 2026-11-08 05:08 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/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions