Repository navigation
Description
Problem
devops openspec new and devops openspec archive work on the devops-cli checkout when the working directory is a checkout of another repository below the workspace. The agent rules of a repository made from the template (rule 1 of its AGENTS.md) tell an agent to archive its change with devops openspec archive <change>, so the agent cannot follow the rule from the standard worktree folder.
Evidence
On 2026-11-26, from a linked worktree of dan-petty/homelab at .data/agent/worktrees/h-284:
devops openspec new 284 --repo dan-petty/homelab --paths ...printedCreated openspec/changes/284-fit-the-ollama-16gib-tier-to on branch mainand made the folder in the devops-cli checkout, on itsmainbranch. The worktree of the other repository got no file.devops openspec archive 284-fit-the-ollama-16gib-tier-tofailed withChange '284-fit-the-ollama-16gib-tier-to' not found. Available changes:and the list of the changes of devops-cli.
Both commands take their root from find_worktree_root() (src/devops_cli/commands/openspec.py). Its docstring says that a repository cloned below repos/ and the worktrees of such a repository resolve to the workspace (src/devops_cli/core/repo.py). That is correct for a verifying command of devops-cli and wrong for a command that writes the change of another repository.
A call of scaffold_change(root, ...) and of archive_change(tool, root, ...) with the worktree of the other repository as root worked: the two functions are correct, only the root is wrong.
Acceptance criteria
- From a checkout or a linked worktree of another repository below the workspace,
devops openspec new <issue>makes the change folder in that checkout, anddevops openspec archive <change>archives the change of that checkout. devops openspec new --repo <other>never writes into a checkout whose origin is not<other>: it stops with a message that names the two repositories.- A test runs both commands in a temporary repository below a temporary workspace and reads where the folder is.
devops openspec checkgets the same root rule, or the issue records why it does not.
Alternatives check of 2026-11-26: in-use.
The repository already uses this tool.
Tool: Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec), MIT, last activity 2026-11-25, maintained.
Reason: Web searches returned nothing relevant; the OpenSpec CLI, read through its repository, already creates and archives a change in the checkout where it runs, so it covers part. The wrapper's root resolution, --repo origin guard and check root rule stay open.
Covers:
- Creates and archives changes in the checkout where it runs
- Validates changes with --strict in that checkout
- Runs from a linked worktree with no workspace root
Lacks:
- No --repo check against the origin of the checkout
- No issue-number scaffold with title and paths
- Agent rules call devops openspec archive, not the CLI
Proposed design
Problem statement
devops openspec new and devops openspec archive resolve the workspace root. From a linked worktree of another repository, they write and read the devops-cli checkout. An agent cannot follow rule 1 of its repository AGENTS.md. The change makes new, archive and check use the checkout of the working directory. It also stops new --repo when the checkout origin is another repository.
Acceptance criteria
Requirement: New writes the working checkout
The new command SHALL create the change folder in the checkout that holds the current working directory, including a linked worktree.
Scenario: Linked worktree of another repository
- WHEN A test runs devops openspec new 284 --repo dan-petty/homelab from a linked worktree of a temporary clone below a temporary workspace.
- THEN The test finds openspec/changes/284-* in that worktree and no new folder in the devops-cli checkout.
Requirement: Archive reads the working checkout
The archive command SHALL archive the change of the checkout that holds the current working directory, including a linked worktree.
Scenario: Archive from a linked worktree
- WHEN A test creates a change in a linked worktree of a temporary clone and runs devops openspec archive 284-test there.
- THEN The test finds the change under openspec/changes/archive in that worktree and no archived copy in the devops-cli checkout.
Requirement: Repo mismatch stops before a write
The new command with --repo MUST stop before it writes when the origin of the working checkout is not the named repository.
Scenario: Requested repository differs from origin
- WHEN A test runs devops openspec new 284 --repo dan-petty/other from a temporary checkout whose origin is dan-petty/homelab.
- THEN The command exits 1, writes no change folder, and its message names dan-petty/other and dan-petty/homelab.
Requirement: Check reads the working checkout
The check command SHALL validate the checkout that holds the current working directory, including a linked worktree.
Scenario: Check from a linked worktree
- WHEN A test runs devops openspec check from a linked worktree of a temporary clone, and that worktree holds an invalid change.
- THEN The command reports the finding with a path under that worktree and no finding from the devops-cli checkout.
Requirement: Repo guard stops a checkout with no origin
The new command with --repo MUST stop before it writes when the working checkout has no origin remote.
Scenario: Requested repository with no origin
- WHEN A test runs devops openspec new 284 --repo dan-petty/homelab from a temporary checkout with no origin remote.
- THEN The command exits 1, writes no change folder, and its message names dan-petty/homelab and says the checkout has no origin.
Existing Tool Considered
Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec), MIT, maintained: the alternatives check in the issue body gives verdict in-use. The block in the issue body lists what the CLI covers and lacks. This change keeps the wrapper. The wrapper passes the checkout root to scaffold_change and archive_change, and it stops a --repo mismatch before a write. No new tool is built.
Key questions
- Which root do openspec new, archive and check use?: They use find_gate_root(), the nearest checkout that holds the working directory. It returns a linked worktree itself and raises outside a git work tree. (best practice) [sources: src/devops_cli/core/repo.py, src/devops_cli/commands/openspec.py]
- Chosen: find_gate_root(). It already resolves the nearest .git checkout, so a linked worktree of another repository resolves to that worktree.
- Rejected: find_worktree_root(). It resolves a worktree of a repository under the workspace to the workspace, which is the defect.
- Rejected: New find_checkout_root() helper. It repeats find_gate_root() behavior; reuse the existing resolver and update its docstring.
- Where does the --repo origin guard run?: The new command reads the origin of the checkout root and compares it with --repo. On a mismatch or no origin, it stops before scaffold_change() with a message that names both. (best practice) [sources: src/devops_cli/commands/openspec.py, src/devops_cli/openspec/scaffold.py]
- Chosen: Guard in new_cmd before scaffold_change(). The command owns the --repo option, and the guard runs before any file is written.
- Rejected: Guard inside scaffold_change(). It also guards direct callers, but it puts command option policy in the scaffold function.
- Rejected: No guard. It lets --repo write into a checkout of another repository, which the issue forbids.
- Should openspec check use the same root rule?: Yes. check validates the nearest checkout, so a linked worktree checks its own changes and not the devops-cli checkout. (best practice) [sources: src/devops_cli/commands/openspec.py, src/devops_cli/core/repo.py]
- Chosen: Use find_gate_root() in check. It gives check the same checkout rule as new and archive.
- Rejected: Keep find_worktree_root() in check. It keeps the workspace root rule that the issue reports as wrong for a worktree of another repository.
- Does openspec regenerate change in this issue?: No. The issue names new, archive and check. Leave regenerate unchanged so the fix stays in one scope. (best practice) [sources: src/devops_cli/commands/openspec.py]
- Chosen: Leave regenerate unchanged. The issue and its acceptance criteria do not name regenerate.
- Rejected: Change regenerate too. It widens the fix beyond the reported commands and their tests.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 26, 2026
openspec, and .github/labels.yml declares no scope/openspec label. Add the label to the file to give the scope to this item.Both address worktree resolution below another repository, but 617 fixes the general resolution rule while the candidate fixes the openspec commands to write into the correct checkout.dan-petty commentedon Nov 26, 2026
A second case of the same defect, 2026-11-26, devops-cli 0.222.0, from a linked worktree of dan-petty/danielpetty.com at
.data/agent/worktrees/dp-93:devops openspec new 93 --repo dan-petty/danielpetty.com --title "..."madeopenspec/changes/93-give-the-rule-of-a-userin the devops-cli checkout.devops openspec archive 93-give-the-rule-of-a-userstopped withChange ... not foundand listed the changes of devops-cli.Workaround used: move the scaffold folder into the other checkout, then run
openspec archive <change> --yesandopenspec validate --all --strictthere with the opt-out environment ofdevops_cli.openspec.tool. #7312 held this report and is closed as a duplicate.devops-cli-service commentedon Nov 26, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (8)
Tools considered:
Searches run:
Sources:
dan-petty commentedon Nov 27, 2026
Second report, 2026-11-27: the builder of dan-petty/github-workflows#3 ran
devops openspec archive <change>from a worktree of dan-petty/github-workflows, and it failed with "Change not found". The cause is the same root rule offind_worktree_root(). #7483 filed the same problem and closes as a duplicate of this issue.devops-cli-service commentedon Nov 28, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 29, 2026
Released in v0.243.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.243.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 03:13 UTC