Skip to content

fix(openspec): archive reports success and moves nothing #4270

Closed

Description

@dan-petty

Problem

uv run devops openspec archive <change> can print Archived <change>. Every spec and change validates. and move nothing. An agent reported this on 2026-11-09 in the worktree of #4257. The command worked in two other worktrees. The agent then ran openspec archive <change> --yes by hand and filed no issue.

The wrapper decides success from exit codes only. archive_change in src/devops_cli/openspec/archive.py runs openspec archive <change> --yes, then openspec validate --all --strict. It raises only when returncode != 0. It never checks that the change folder is gone or that openspec/changes/archive/<date>-<change>/ exists. So any run where openspec exits 0 and moves nothing gives a false Archived.

Evidence (command output, 2026-11-09, checkout of main):

  • uv run devops openspec archive no-such-change-zz exits 1 and says the change is not found. This is correct.
  • uv run devops --dry-run openspec archive no-such-change-zz exits 0 and prints Archived no-such-change-zz. Every spec and change validates. The change does not exist.
  • DEVOPS_CLI_DRY_RUN=1 uv run devops openspec archive no-such-change-zz prints the same.

Cause found: in dry-run mode, run_subprocess does not start the process. It returns a PlannedProcessResult with returncode=0 (src/devops_cli/core/process.py). OpenSpecTool.run passes quiet=True, so the planned command is not printed either. Both calls "pass", and the command prints Archived. A shell that has DEVOPS_CLI_DRY_RUN set, or an agent that passes --dry-run, hits this. I could not read the environment of the worktree of #4257, so this is the only path I found that matches the report; it is not proven to be that run.

I also read core/archive.js of the pinned OpenSpec 1.14.3. Its abort paths (validation failed, rebuilt spec invalid) set process.exitCode = 1, so they do not give exit 0. The no-move case is therefore not an OpenSpec defect in this version. I reproduced a normal archive in a throwaway worktree of the commit before 04839499: the wrapper moved the folder and updated the spec. So the wrapper is correct only when the process really runs.

Expected

After the archive command exits 0, the wrapper checks the result on disk before it prints Archived:

  • the source folder openspec/changes/<change>/ does not exist, and
  • one folder openspec/changes/archive/*-<change> exists.

If a check fails, the wrapper prints the reason, exits non-zero, and does not print Archived.

In dry-run mode the wrapper starts no process and does not print Archived. It prints the commands it would run and says Would archive <change>.

Acceptance criteria

Each command FAILS today and passes after the fix.

  • uv run devops ci test tests/openspec/test_openspec_archive.py::test_archive_fails_when_the_tool_exits_zero_and_moves_nothing - a fake openspec that exits 0 and moves nothing makes archive_change raise ToolExecutionError that names the change and the folder that is still there. Today it returns without an error.
  • uv run devops ci test tests/openspec/test_openspec_archive.py::test_archive_fails_when_no_archive_folder_exists - a fake openspec that removes the source and creates no archive folder makes archive_change raise.
  • uv run devops ci test tests/openspec/test_openspec_archive.py::test_archive_succeeds_when_the_folder_moved - a fake openspec that moves the folder makes archive_change return. This test passes today and must keep passing.
  • uv run devops ci test tests/openspec/test_openspec_archive.py::test_archive_in_dry_run_does_not_report_archived - with DEVOPS_CLI_DRY_RUN=1, the archive command prints Would archive and does not print Archived. Today it prints Archived.

Existing tool considered

openspec archive --json (pinned 1.14.3) returns the archive result as JSON, with the archive path. The wrapper can read the path from it instead of the text output. Even so, a check of the destination on disk is needed, because the failure is that the process did not run. No other open tool covers this. The fix is a small check in archive_change.

Cost

About 20 lines of code and 4 tests. Build: about 15k tokens, 30 minutes. Keep: low; no new dependency. Fix: low. No cost to skip the check is acceptable: a false Archived sends a pull request on without its archive commit, and devops openspec check may then fail late in CI.

Related

Activity

  1. added
    source/agent
    type/bug
    scope/openspec
    status/new
    value/medium
    effort/medium
    on Nov 9, 2026
  2. dan-petty commented on Nov 9, 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/openspec. The (openspec) scope of the title gives the scope.
    • Priority: P2-Medium. A command reports success while doing nothing, which misleads agents, but it is an edge case in dry-run or a specific environment.
    • Value: Medium. Agents and users trust the archive output; a false success breaks downstream workflows.
    • Effort: Medium. The fix needs disk checks after execution, a dry-run branch, and four new tests, all in one module.
    • Related: feat(openspec): scaffold the change folder of an issue to project form #3203, which asks for a different change. Both items manage openspec change folders, but #3203 scaffolds a new folder while the candidate verifies the archive move.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 9, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 9, 2026
  5. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-09 21:51 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/openspecsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions