Skip to content

fix(openspec): openspec check misses a long MODIFIED requirement #5378

Done

Description

@dan-petty

Problem Description

uv run devops openspec check passes a change whose spec delta holds a MODIFIED requirement text of more than 500 characters. uv run devops openspec archive <change> then merges the delta into the spec, and openspec validate --all --strict refuses the merged spec. The archive is then applied and the command exits 1, so the author must fix the merged spec and the archived delta by hand.

OpenSpec 1.14.3 checks the length of an ADDED requirement in a change, not of a MODIFIED one (#4524). The fix of #4524 (PR #4614) added the length rule to the stage gates and to plan-check only. The openspec row of devops ci and devops openspec check do not have it, so a change that an agent writes by hand reaches the archive with the long text.

Case: the change of #5247 (PR #5377). Its MODIFIED requirement of ci-job-time had 523 characters. uv run devops openspec check passed before the archive. The archive failed two times, once for the builder and once for the reviewer.

Reproduction Steps

  1. Write a change whose spec delta holds a MODIFIED requirement of more than 500 characters.
  2. Run uv run devops openspec check: it passes.
  3. Run uv run devops openspec archive <change>: the strict validation of the merged spec fails.

Expected vs Actual Behavior

Expected: devops openspec check (and so the openspec row of devops ci and its pre-commit hook) refuses an ADDED or MODIFIED requirement text of more than 500 characters in an active change, with the requirement name and its length. It uses the same rule as the stage gates (REQUIREMENT_MAX_CHARS, #4614), with no second copy.

Actual: the check passes, and the archive fails after it applied the change.

Environment Diagnostics

  • DevOps CLI Version: main at 4ef7c6f (0.127.0)
  • OpenSpec: 1.14.3, the version that the project pins
  • Execution Environment: devcontainer, uv run devops

Logs, Traces, or Terminal Output

✗ spec/ci-job-time
  ⚠ [WARNING] requirements[0]: Requirement text is very long (>500 characters). Move examples and edge cases into scenarios, or split it into separate requirements that each state one behavior.
✗ openspec validate --all --strict failed with exit code 1. The archive is applied. Fix the specs that the tool names above. Then run `uv run devops openspec check`. Do not run the archive again.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Alternatives check of 2026-11-22: in-use.
The repository already uses this tool.
Tool: Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec), MIT, last activity 2026-11-22, maintained.
Reason: Searches found no other maintained tool for requirement-length checks; the pinned OpenSpec already warns on a long change requirement and refuses the long merged spec, but only after archive and never for MODIFIED text.

Covers:

  • Warns on a change requirement over 500 characters
  • Strict validation refuses the long merged spec text
  • Exposes change deltas through openspec show --json --deltas-only

Lacks:

  • No length rule for a MODIFIED requirement in a change
  • Change check warns instead of refusing, and names requirements[N]
  • Refusal arrives only after the archive is applied
  • No shared limit with the project's stage gate

Proposed design

Problem statement

uv run devops openspec check passes a change whose MODIFIED requirement text is longer than 500 characters. uv run devops openspec archive <change> then applies the delta to the spec and runs the archive. The strict validation of the merged spec then fails, and the author must fix the spec and the archived delta by hand. The check must refuse a long ADDED or MODIFIED requirement before the archive, with the rule that the stage gates use.

Acceptance criteria

Requirement: Modified requirement length

devops openspec check SHALL refuse each MODIFIED requirement of an active change whose text is longer than REQUIREMENT_MAX_CHARS.

Scenario: Long modified requirement

  • WHEN the test scripts an active change with a MODIFIED requirement of 523 characters and runs uv run devops openspec check
  • THEN the command exits 1 and prints the requirement name, its length 523 and the limit 500

Requirement: Added requirement length

devops openspec check SHALL refuse each ADDED requirement of an active change whose text is longer than REQUIREMENT_MAX_CHARS.

Scenario: Long added requirement

  • WHEN the test scripts an active change with an ADDED requirement of 523 characters and runs uv run devops openspec check
  • THEN the command exits 1 and prints the requirement name, its length 523 and the limit 500

Requirement: One copy of the rule

The openspec check MUST use the REQUIREMENT_MAX_CHARS definition and the length check of src/devops_cli/roadmap/stage/stage_change.py, with no second copy.

Scenario: Shared definition

  • WHEN a test imports the limit and the length check from the openspec check module and from src/devops_cli/roadmap/stage/stage_change.py
  • THEN both names refer to the same objects and the openspec check module defines no limit of its own

Requirement: UTF-16 count

The check SHALL count a requirement text in UTF-16 code units, as OpenSpec does.

Scenario: Surrogate pair

  • WHEN a MODIFIED requirement holds 500 UTF-16 code units plus one astral character that UTF-16 encodes as a surrogate pair, and the test runs uv run devops openspec check
  • THEN the command refuses it and prints its UTF-16 length 502

Requirement: Openspec CI row

The openspec row of devops ci SHALL fail on a long ADDED or MODIFIED requirement.

Scenario: CI row on a long requirement

  • WHEN the test runs uv run devops ci --check --only openspec on a change with a MODIFIED requirement of 523 characters
  • THEN the row exits non-zero and its output names the requirement and its length 523

Requirement: Archived changes out of scope

The check SHALL inspect active changes only and MUST NOT fail on a requirement under openspec/changes/archive/.

Scenario: Archived long requirement

  • WHEN an archived change holds a MODIFIED requirement of 523 characters and no active change holds a long requirement, and the test runs uv run devops openspec check
  • THEN the command exits 0

Existing Tool Considered

OpenSpec (Fission-AI/OpenSpec), MIT and maintained, pinned at 2.1.0, is the existing tool; its alternatives check block of 2026-11-17 records what it covers and lacks. The change adds the project's shared REQUIREMENT_MAX_CHARS rule to devops openspec check, with no second copy. Cost to build and keep: one shared length helper, one gate finding and its tests, about 2k tokens and under 1 hour.

Key questions

  • Where does the check get the 500-character limit and the length rule, with no second copy?: Share the stage rule. Expose REQUIREMENT_MAX_CHARS and a public requirement-length helper in src/devops_cli/roadmap/stage/stage_change.py; the helper takes a requirement name and text, counts UTF-16 code units and formats the existing stage_problem_requirement_long message. The stage's _length_problems calls it, and the openspec gate imports it and feeds it the ADDED and MODIFIED texts from openspec show <change> --json --deltas-only. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:136, src/devops_cli/roadmap/stage/stage_change.py:923, src/devops_cli/roadmap/stage/stage_change.py:929, src/devops_cli/openspec/overlap.py:38, tests/fixtures/openspec_runs/recorded_runs.json:321, openspec/specs/roadmap-stage/spec-delta/spec.md:138]
    • Chosen: Share the stage helper. One helper gives one copy of the limit, the UTF-16 count and the message; the stage and the gate call it.
    • Rejected: Move the rule to a new shared module. It adds a module and changes the stage import for no change of behaviour.
    • Rejected: Copy the rule into the openspec check. The issue asks for no second copy, and two copies drift.
  • Which requirements does the check inspect, and which change folders?: Each ADDED and MODIFIED requirement of each active change under openspec/changes/<issue>-<slug>/. It skips the change folders under openspec/changes/archive/. (best practice) [sources: openspec/specs/roadmap-stage/spec-delta/spec.md:138, CONTEXT.md:16, src/devops_cli/openspec/tool.py:123]
    • Chosen: ADDED and MODIFIED of active changes. The shared stage rule covers both, so one call keeps the two paths equal.
    • Rejected: MODIFIED only. It leaves the ADDED case to a tool message that names no requirement and no length.
    • Rejected: All change folders, archive included. A long text in an archived delta is history, and no archive can change it.
  • How does the check count the characters of a requirement text?: In UTF-16 code units, with the same _js_length helper as the stage gates. [sources: openspec/specs/roadmap-stage/spec-delta/spec.md:138, src/devops_cli/roadmap/stage/stage_change.py:923, src/devops_cli/roadmap/stage/stage_change.py:938]
  • Where in devops openspec check does the rule run, and what does it report?: It runs on the active changes before the OpenSpec CLI validation, using the openspec show <change> --json --deltas-only output. On a long requirement it returns one GateFinding that names the requirement, its length and the limit, as the stage gate does, and the command exits 1. (best practice) [sources: src/devops_cli/openspec/gate.py:219, src/devops_cli/openspec/gate.py:233, src/devops_cli/roadmap/stage/stage_change.py:934, openspec/specs/roadmap-stage/spec-delta/spec.md:138]
    • Chosen: Before the CLI validation. The CLI warning names only requirements[N], and the strict validation fails only after the archive.
    • Rejected: After the CLI validation. A failing CLI call returns first, so the project message never shows.
    • Rejected: Only in the CI row. A hand run of devops openspec check and the pre-commit hook would still pass.
  • Does the fix add a second rule to the openspec row of devops ci?: No. The row runs uv run devops openspec check, so the rule reaches the row and the openspec-gate pre-commit hook with no second change. (best practice) [sources: src/devops_cli/commands/ci.py:1062, src/devops_cli/commands/ci.py:1064, .pre-commit-config.yaml:91]
    • Chosen: Reuse the check command. One implementation serves the hand run, the CI row and the hook.
    • Rejected: Add the rule to the row. It makes a second copy of the limit and the message.
  • Does the fix wait for an OpenSpec release that applies the rule to a MODIFIED requirement?: No. The project pins OpenSpec 2.1.0, and the project's own devops openspec check is the place for the shared rule; the stage rule's comment records that a change validation passes a long MODIFIED text and the strict spec validation refuses it after archive. Fix the check now. (best practice) [sources: src/devops_cli/tools_lock/tools.lock:600, src/devops_cli/roadmap/stage/stage_change.py:930, https://github.com/Fission-AI/OpenSpec]
    • Chosen: Fix the project check now. The archive fails today, and the fix is in the project's own gate with the shared rule.
    • Rejected: Wait for an upstream release. No release date is known, and the item would wait on an outside event; the project's check is the bug.
    • Rejected: Bump the pinned OpenSpec. The lock already pins 2.1.0, and a bump changes no project check.
  • Which tests already cover the stage rule that the fix reuses?: tests/roadmap/stage/test_roadmap_stage_requirement_length.py covers the stage length rule, and tests/roadmap/test_roadmap_plan_check.py covers its plan-check report. The openspec gate tests live in tests/openspec/test_openspec_gate.py, and the new cases go there. [sources: tests/roadmap/stage/test_roadmap_stage_requirement_length.py:7, tests/roadmap/test_roadmap_plan_check.py:22, tests/openspec/test_openspec_gate.py:17]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/openspec
    status/new
    value/medium
    effort/low
    on Nov 13, 2026
  2. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 13, 2026
  4. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    One more case on 2026-11-13, in the branch of #4851. A MODIFIED requirement of roadmap-stage/verification had 520 characters. uv run devops openspec check passed before the archive. Then uv run devops openspec archive 4851-extend-stage-gate-returns applied the archive and failed its validation:

    ✗ spec/roadmap-stage/verification
      ⚠ [WARNING] requirements[11]: Requirement text is very long (>500 characters). Move examples and edge cases into scenarios, or split it into separate requirements that each state one behavior.
    ✗ openspec validate --all --strict failed with exit code 1. The archive is applied.
    

    I made the text shorter in the merged spec and in the archived delta. The check before the archive did not find the problem.

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

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches surfaced no separate linter for OpenSpec change deltas; the only open, maintained tool in this space is OpenSpec itself, which the issue names and the project pins (ADR 0010 chose it as the spec and change-proposal layer). OpenSpec enforces the 500-character requirement-length rule for added requirements in a change and for merged specs, but in the pinned 1.14.3 it does not apply that rule to a MODIFIED requirement in an active change, which is exactly the gap the issue reports, so the project's own devops openspec check still needs the rule.

    The repository already uses this tool.

    Tool: Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec)

    • License: MIT
    • Last activity: 2026-11-17
    • Maintained: yes

    Covers:

    • Validates the length of requirement text in a change's spec delta for added requirements and in merged specs, warning on text over 500 characters
    • Is the spec and change-proposal layer the project pins and the tool behind devops openspec check and openspec archive

    Lacks:

    • Does not apply the 500-character length rule to a MODIFIED requirement in an active change (pinned 1.14.3), so the pre-archive check passes and the strict validation after archive fails
    • Does not give the project's devops openspec check/devops ci entry point the shared REQUIREMENT_MAX_CHARS rule

    Tools considered:

    Searches run:

    • openspec CLI archive strict validation requirement length check change delta, results: 5
    • OpenSpec validate requirement text too long 500 characters MODIFIED requirement, results: 5
    • "openspec" spec-driven development validate strict requirement characters GitHub, results: 5
    • OpenSpec Fission AI openspec CLI npm, results: 5
    • openspec, results: 5
    • openspec change proposal spec delta validation tool, results: 5
    • Fission-AI OpenSpec github repository, results: 5
    • "Requirement text is very long" openspec, results: 5
    • OpenSpec 2.0.0 release changelog requirement length validation, results: 5
    • openspec npm package spec validation CLI, results: 5

    Sources:

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

  6. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  7. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

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

  8. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor

    One more gap of the same kind, found by #4692 on 2026-11-21. Three archived proposals have no ## Why section. Their sections are ## Problem and ## Proposed Change or ## Solution:

    • openspec/changes/archive/2026-10-31-2159-pr-edit-fallback-update-all/proposal.md
    • openspec/changes/archive/2026-10-31-2165-hermetic-floor-host-independence/proposal.md
    • openspec/changes/archive/2026-11-18-4590-trace-gate-judges-reads-that-are-no-run-read/proposal.md

    openspec show <change> --json --deltas-only (OpenSpec 2.1.0) refuses the 4590 change with Change must have a Why section. So the project review cannot count the requirement deltas of that change, and lists it under the fact openspec.unread_changes. As with the long MODIFIED requirement of this issue, the gate let a change through that OpenSpec refuses later.

    A fix: rename the ## Problem section of the three proposals to ## Why, and make the gate check the proposal form of each change before the archive.

  9. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor

    Two more cases on 2026-11-21, both MODIFIED requirements:

    In both cases the agent made the text shorter by hand in the main spec and in the archived delta. The check before the archive must apply the same limit to a delta requirement.

  10. added
    owner/agent
    on Nov 25, 2026
  11. added
    status/in-review
    and removed
    status/ready
    on Nov 25, 2026
  12. removed
    status/in-review
    owner/agent
    on Nov 25, 2026
  13. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 17:24 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/openspecsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions