Skip to content

fix(roadmap): plan gates miss a spec requirement over 500 chars #4524

Closed

Description

@dan-petty

Problem Description

A stage plan can carry a spec delta whose requirement text is longer than 500 characters. Every plan gate accepts it, and uv run devops openspec check passes, because the length warning of OpenSpec applies only to a spec, not to a change. The implement job then fails at the end of its run: uv run devops openspec archive <change> merges the delta into the spec, and openspec validate --all --strict refuses the merged spec with "Requirement text is very long (>500 characters)". The run did all its work and stops at the last step.

Case: item #3462. Its plan (PR #4435) held a MODIFIED requirement of roadmap-stage with 543 characters. The implement run (PR #4465, runner Job of 2026-11-11 02:25) finished both tasks in 55 minutes and stopped at archive with "Totals: 258 passed, 1 failed", "✗ spec/roadmap-stage", "Requirement text is very long (>500 characters)". A person shortened the text to 451 characters, and the archive then passed.

Reproduction Steps

  1. Write a change whose spec delta holds a requirement of more than 500 characters.
  2. Run uv run devops openspec check and uv run devops roadmap plan-check <pr>: both pass.
  3. Run uv run devops openspec archive <change>: the strict validation of the merged spec fails.

Expected vs Actual Behavior

Expected: the stage gates (check_proposal) refuse a requirement text of more than 500 characters, with a message that names the requirement and its length, so the planner shortens it before the plan is staged. The limit comes from OpenSpec, so the check reads it from one constant with a comment that names the OpenSpec rule.

Actual: no gate sees the length. The implement run fails at its last step and spends its tokens for nothing.

Proposed fix

Add the length rule to the stage gates for each ADDED and MODIFIED requirement of a spec delta, and to plan-check. Prefer running the OpenSpec validation of the merged spec in the gate if OpenSpec offers it for a change (see #3429), so the gate follows OpenSpec and adds no copy of its rules; if it does not, check the length in the gate with the constant. Add the #3462 delta as a golden case.

Environment Diagnostics

Related: #3429 (the implement plan gate runs the OpenSpec validation), #4503 (a failed archive validation stops with the class test), #4487 (the stop path after a failed archive).

Proposed design

Problem statement

A plan can hold a spec delta requirement longer than 500 characters. Every stage gate accepts it, and the OpenSpec check of the change passes. The implement job then fails at archive, because openspec validate --all --strict refuses the merged spec. The stage gates and plan-check must refuse the long requirement before a person stages the plan.

Acceptance criteria

Requirement: Long ADDED requirement is refused

check_proposal SHALL refuse a spec delta whose ADDED requirement text is longer than 500 characters.

Scenario: ADDED requirement of 543 characters

  • WHEN A stage reply holds a spec delta with an ADDED requirement of 543 characters.
  • THEN check_proposal returns a problem that names the requirement and its length of 543 characters.

Requirement: Long MODIFIED requirement is refused

check_proposal SHALL refuse a spec delta whose MODIFIED requirement text is longer than 500 characters.

Scenario: MODIFIED requirement of 543 characters

Requirement: Requirement at the limit passes

The gate SHALL accept a requirement text of exactly 500 characters.

Scenario: Requirement of 500 characters

  • WHEN A spec delta holds a requirement text of exactly 500 characters.
  • THEN check_proposal returns no length problem for that requirement.

Requirement: One constant holds the limit

The 500-character limit MUST come from one module constant whose comment names the OpenSpec rule.

Scenario: Single constant

  • WHEN A test searches the gate modules for the value 500.
  • THEN Only the constant definition holds that value, and plan_check imports the constant.

Requirement: plan-check reports the same problem

uv run devops roadmap plan-check SHALL report the length problem for a change with a long requirement.

Scenario: plan-check on a long requirement

  • WHEN A change folder holds a spec delta requirement of 543 characters, and the command runs on it.
  • THEN The command exits non-zero and prints the requirement name and the length of 543 characters.

Requirement: #3462 is a golden case

The stage eval replay MUST hold the #3462 delta as a case that check_proposal refuses.

Scenario: Replay of the #3462 case

  • WHEN uv run devops roadmap eval stage --replay runs on the case set.
  • THEN The case with the 543-character requirement is listed as caught by check_proposal.

Requirement: Replay keeps its result

uv run devops roadmap eval stage --replay MUST still exit 0 after the gate change.

Scenario: Replay regression

  • WHEN The replay runs on the whole case set after the change.
  • THEN The command exits 0 and refuses no good plan.

Existing Tool Considered

No alternatives check has run. OpenSpec is the open, maintained tool that owns the rule: its strict validation refuses a requirement text longer than 500 characters. OpenSpec applies that rule to a spec only. The validation of a change passes, so the gate must carry the rule. The change adds one constant and one length comparison to the spec-delta gate. It does not copy the validator. The written cost is about 2,000 tokens to build the check and its tests. It is about 500 tokens a month to keep and fix, and two hours of elapsed time.

Key questions

  • Where does the length rule live so that check_proposal and plan-check both apply it?: In the spec-delta gate that check_proposal calls, src/devops_cli/roadmap/stage/stage_specs.py. plan-check runs the gates of check_proposal, so it gets the rule with no second copy. (best practice) [sources: docs/roadmap/plan-recheck.md:15, docs/roadmap/plan-check.md:26, src/devops_cli/roadmap/stage/stage_specs.py]
    • Chosen: Spec-delta gate module. check_proposal calls it, and plan-check runs the same gates, so one rule serves both paths.
    • Rejected: plan_check.py. It is a second copy. The stage gate would accept the plan, and the defect would reach the implement job.
    • Rejected: The implement gate. It refuses the plan after the run spends its tokens. The issue asks for the refusal at staging.
  • Should the gate run the OpenSpec validation of the merged spec, or check the length with one constant?: Check the length with one constant. OpenSpec applies its 500-character rule to a spec, not to a change, so the validation of a change passes. The validation of the merged spec belongs to fix(roadmap): the implement plan gate runs the OpenSpec validation too #3429. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:327, docs/roadmap/plan-check.md:26, src/devops_cli/roadmap/stage/stage_specs.py]
  • Which sections of a spec delta does the check read?: Every ADDED and MODIFIED requirement. The REMOVED and RENAMED sections hold no requirement text to measure. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:327, src/devops_cli/roadmap/stage/stage_specs.py]
    • Chosen: ADDED and MODIFIED. OpenSpec measures the requirement text, and only these sections carry it.
    • Rejected: All sections. The REMOVED and RENAMED sections hold no requirement text, so the check has nothing to measure.
    • Rejected: ADDED only. The fix(roadmap): accept a test-only group that changes a test helper #3462 case is a MODIFIED requirement, so the defect would pass.
  • Where does the 500-character limit live?: One module constant in the spec-delta gate module, MAX_REQUIREMENT_CHARS = 500, with a comment that names the OpenSpec rule. plan_check imports that constant. (best practice) [sources: src/devops_cli/roadmap/stage/stage_specs.py, src/devops_cli/roadmap/plan_check.py]
    • Chosen: One constant in the gate module. Both paths read one value, and the comment names the OpenSpec rule that sets it.
    • Rejected: A literal at each site. Two copies drift, and a change of the OpenSpec rule needs two edits.
    • Rejected: Read the limit from OpenSpec at runtime. The gate calls no OpenSpec command today, and a call on each reply adds a dependency and time to every stage run.
  • What does the problem message state?: The name of the requirement, its character count, and the limit of 500. The planner then shortens the text before the plan is staged. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:327, src/devops_cli/roadmap/stage/stage_specs.py]
    • Chosen: Name and length. The planner sees which requirement to shorten and by how much.
    • Rejected: The length only. A delta can hold several requirements, so the planner cannot tell which one to shorten.
  • How is the fix(roadmap): accept a test-only group that changes a test helper #3462 delta added as a golden case?: Add a case to the stage eval set with the MODIFIED requirement of roadmap-stage at 543 characters. Mark it as caught by check_proposal in the spec_delta_wrong type. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:327, tests/roadmap/stage/test_roadmap_stage_gates.py]
    • Chosen: A case in the stage eval set. The replay then reports the defect as caught, and the counts show the gain.
    • Rejected: A unit test only. The replay counts the known defects that a gate catches, and a unit test does not change those counts.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 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/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. A real defect wastes 55 minutes of compute per occurrence but a person can shorten the text as a workaround.
    • Value: Medium. Prevents wasted implement runs, but the manual fix exists and the failure is visible at the end.
    • Effort: Low. Adding a length check to existing gate functions is a small, localized code change.
    • Related: fix(roadmap): the implement plan gate runs the OpenSpec validation too #3429, which asks for a different change. Both catch OpenSpec validation issues before the implement run, but #3429 adds OpenSpec validation to the implement plan gate while this adds a length rule to the stage gates.
  3. added
    priority/p2-medium
    on Nov 11, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

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

  6. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 11, 2026
  7. removed
    status/in-progress
    owner/agent
    on Nov 11, 2026
  8. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 14:13 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