Repository navigation
Description
Problem Description
Depends on #5355.
After #5355, devops install-tools judges openspec by the version that the command on PATH prints. _off_pin (src/devops_cli/commands/install_tools.py:372-380) adds openspec to the install list when that version is not the lock's version. It does this also when the link in the target directory is already at the pin (_at_pin, lines 364-369).
When PATH finds another openspec file before the target directory, a new install changes nothing that PATH finds. Thus:
- Each
install-tools --only-missingrun doesnpm ciagain and changes nothing. install-tools --checkexits 1 with the hintuv run devops install-tools --tool openspec(check_version_differs,src/devops_cli/lang/en/messages.py:418-421). That command also changes nothing.devops openspec checkgives the hintuv run devops install-tools --tool openspec --only-missing(version_differsatsrc/devops_cli/lang/en/messages.py:517-519, withmissing_hintat lines 480-483).
So the advice loops: each hint names a command that does not fix the problem. The cause is the PATH order, not the install.
The merged spec scenario "An older command is replaced" (openspec/specs/tools-lock-install/spec.md:30-32) asks for this reinstall. The test test_only_missing_installs_openspec_when_the_binary_on_path_prints_another_version (tests/commands/test_install_tools.py:757-770) asserts it. Thus the defect is in the plan of #5107, not in the code of #5355.
Scope: the default devcontainer PATH (~/.local/bin first), the runner image and the Service image (the image tool directory first) do not show the problem. The #5107 case (no link in the target directory) is fixed. The loop occurs on a host where a directory with an older openspec, for example /usr/local/bin, comes before the target directory on PATH.
Related: #4363 plans to remove devops install-tools and tools.lock. If #4363 merges first, close this item as superseded.
Reproduction Steps
- Install the locked
openspecinto the target directory:uv run devops install-tools --tool openspec. - Put a directory with an older
openspec(for example 1.14.3) before the target directory on PATH. - Run
uv run devops install-tools --tool openspec --only-missing. It runsnpm ciagain. - Run
uv run devops install-tools --check --tool openspec. It exits 1 with the hintuv run devops install-tools --tool openspec. - Run the hint, then run step 4 again. The result does not change.
Expected vs Actual Behavior
Expected: when the link in the target directory is at the pin but PATH finds another file first, --only-missing does not install again. --check and the gate report the PATH order: the path that PATH finds, its version, and the target directory whose link is at the pin. The hint tells the user to put the target directory first on PATH or to remove the other binary.
Actual: each --only-missing run installs again. Each hint names an install that does not change the result.
Proposed Fix
- In
_off_pin, do not add a tool whose link in the target directory is at the pin. A version problem with a link at the pin is a PATH order problem. - Add a message for this case to
install-tools --checkand to the gate. The message names the path that PATH finds, its version, the target directory and the fix (the target directory first on PATH, or remove the other binary). - Change the merged scenario "An older command is replaced" through an OpenSpec delta in the same change. Change its test at
tests/commands/test_install_tools.py:757in the same change. - Keep the fix(tools): install-tools --check passes an older openspec binary #5107 case: when the target directory has no link at the pin,
--only-missinginstalls, as now.
Existing tool: shutil.which already gives the path that PATH finds. No new tool is necessary.
Environment Diagnostics
- DevOps CLI Version: head of fix: install-tools --check passes an older openspec binary #5355 (
59486f86b), on 0.126.x - Python Version: 3.14.10
- OS & Architecture: Linux x86_64
- Execution Environment: DevContainer, or a native workstation with an older
openspecfirst on PATH
Logs, Traces, or Terminal Output
# From the vetting verdict of #5355 (C1 + deploy-1):
# _off_pin adds openspec when PATH resolves a binary with another version, even when the link
# in the target directory is already at the pin. Each --only-missing run does npm ci again and
# changes nothing. --check then fails with the hint `install-tools --tool openspec`.Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal keys are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #5355
Alternatives check of 2026-11-22: in-use.
The item already names this tool.
Tool: python/cpython (https://github.com/python/cpython), NOASSERTION, last activity 2026-11-22, maintained.
Reason: Searches found only the Python standard library: shutil.which already resolves which openspec PATH picks, the fact the new PATH-order message needs, but it compares no versions and changes no install plan or message.
Covers:
- Resolves the command that PATH finds
- Returns the full path of the matched file
- Available in the stdlib with no new dependency
Lacks:
- Version comparison against the lock pin
- PATH-order message naming path, version and fix
- Install plan that skips a target link already at the pin
Proposed design
Problem statement
After #5355, install-tools judges openspec by the version that the command on PATH prints. When PATH finds another openspec before the target directory, a new install changes nothing that PATH finds. The target link is at the pin, but _off_pin still adds openspec, so --only-missing repeats npm ci. --check and the gate print an install hint that does not fix the PATH order. The fix makes the install plan depend on the target link and reports the PATH order with the resolved path, version, target directory and fix.
Acceptance criteria
Requirement: No reinstall for a target link at the pin
devops install-tools --only-missing SHALL not install a tool when the link in the target directory is at the locked version and the command on PATH prints another version.
Scenario: A shadowed link at the pin does not install
- WHEN the test puts an
openspeclink at the pin in the target directory, makes PATH resolve anotheropenspecthat prints1.14.3, and runsdevops install-tools --tool openspec --only-missing - THEN the command exits 0 and records no
npm cirun.
Requirement: Check reports the PATH order
devops install-tools --check SHALL report a PATH-order problem when the target link is at the pin and the command on PATH prints another version.
Scenario: Check names the shadowing path
- WHEN the test sets the target link at the pin, makes PATH resolve
/usr/local/bin/openspecwith version1.14.3, and runsdevops install-tools --check --tool openspec - THEN the command exits 1 and its message names
/usr/local/bin/openspec,1.14.3, the target directory, and the fix to put the target directory first on PATH or remove the other binary.
Requirement: Gate reports the PATH order
The OpenSpec gate SHALL report a PATH-order problem when the target link is at the pin and PATH finds another openspec.
Scenario: Gate names the shadowing path
- WHEN the test sets the target link at the pin, makes PATH resolve another
openspecthat prints1.14.3, and runsdevops openspec check - THEN the command exits 1 and its message names the resolved path, its version, the target directory, and the fix, and it does not name an install command.
Requirement: Missing target link still installs
devops install-tools --only-missing SHALL install a tool when the target directory has no link at the locked version.
Scenario: A missing link still installs
- WHEN the test removes the target link and runs
devops install-tools --tool openspec --only-missing - THEN the command exits 0 and records one
npm cirun.
Requirement: Spec delta replaces the reinstall scenario
The tools-lock-install spec SHALL replace the 'An older command is replaced' scenario with a PATH-order scenario that does not reinstall a link at the pin.
Scenario: OpenSpec validates the changed scenario
- WHEN the change updates the spec delta and runs
uv run openspec validate --strict - THEN the command exits 0.
Existing Tool Considered
The alternatives check records in-use for python/cpython (shutil.which). See the Alternatives check block in the issue body for what the tool covers and lacks. The proposal adds no new tool: it changes _off_pin, adds PATH-order messages, and updates the spec and test.
Key questions
- Should
_off_pinskip a tool when its target link is at the pin and PATH resolves another version?: Yes._off_pinSHALL select only tools whose link in the target directory is not at the pin. A version mismatch with a link at the pin is a PATH-order problem and SHALL NOT cause an install. (best practice) [sources: src/devops_cli/commands/install_tools.py:372, src/devops_cli/commands/install_tools.py:364, openspec/specs/tools-lock-install/spec.md:30]- Chosen: Skip install when the target link is at the pin. The target directory already holds the locked link, so an install changes nothing that PATH finds.
- Rejected: Keep the version mismatch in
_off_pin. It repeatsnpm cion each--only-missingrun and does not change the PATH result. - Rejected: Remove the version check from
--check.--checkmust still report the PATH-order problem and its fix.
- Where should the
install-tools --checkPATH-order message live?: Addcheck_shadowed_at_pintoInstallMessagesnearcheck_version_differs.install_tools.pySHALL use it when_at_pinis true and the version problem comes from PATH. (best practice) [sources: src/devops_cli/lang/en/messages.py:431, src/devops_cli/commands/install_tools.py:413]- Chosen: New
check_shadowed_at_pinmessage. It names the PATH order and the fix instead of an install that changes nothing. - Rejected: Reuse
check_version_differs. Its hint names an install command that does not fix the shadowed PATH. - Rejected: Reuse
missing_hint. The target link is present, so the missing hint is false.
- Chosen: New
- Where should the gate PATH-order message live?: Add
version_shadowedtoOpenspecMessagesnearmissing_hint.gate.pySHALL use it when the target link is at the pin and PATH finds anotheropenspec. (best practice) [sources: src/devops_cli/lang/en/messages.py:493, src/devops_cli/openspec/gate.py:121, src/devops_cli/openspec/tool.py:136]- Chosen: New
version_shadowedmessage. The gate needs a PATH-order hint and must not tell the user to install again. - Rejected: Reuse
missing_hint. The target link is at the pin, so the binary is not missing. - Rejected: Reuse the install message in the gate. It couples the openspec gate to the install command module and its layering.
- Chosen: New
- How should the check and the gate share the PATH-order facts?: Add a small helper in
src/devops_cli/openspec/tool.pythat returns the resolved path, printed version, target directory and locked version when the target link is at the pin.install_tools.pyandgate.pySHALL both use it. (best practice) [sources: src/devops_cli/openspec/tool.py:136, src/devops_cli/openspec/gate.py:121, src/devops_cli/commands/install_tools.py:364]- Chosen: Shared helper in
openspec/tool.py. Both callers need the same facts, and the openspec module is the lower layer. - Rejected: Duplicate the check in both modules. Two copies can drift and report different facts.
- Rejected: Import
install_toolsfrom the gate. The gate would depend on a command module and can create an import cycle.
- Chosen: Shared helper in
- Does the fix(tools): install-tools --check passes an older openspec binary #5107 missing-link install remain?: Yes. When the target directory has no link at the pin,
_at_pinis false,_off_pinkeeps the tool, and--only-missinginstalls it as before. [sources: src/devops_cli/commands/install_tools.py:372, src/devops_cli/commands/install_tools.py:542, tests/commands/test_install_tools.py:757] - Should the merged scenario change through an OpenSpec delta?: Yes. The change SHALL replace the 'An older command is replaced' scenario with a PATH-order scenario and update its test. (best practice) [sources: openspec/specs/tools-lock-install/spec.md:30, tests/commands/test_install_tools.py:757]
- Chosen: Replace the old scenario through a delta. The old scenario asks for the reinstall that causes the loop, so it must not stay in force.
- Rejected: Add a new scenario and keep the old one. The two scenarios would contradict each other.
- Rejected: Change the test only. The merged spec would still require the reinstall.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 13, 2026
Both fix install-tools openspec version checking in the same file, but #5107 covers the case where no link exists at the pin while this candidate covers the case where the link is at the pin but PATH finds another binary first.devops-cli-service commentedon Nov 17, 2026
Alternatives check: in-use
Reason: The need splits into finding which executable PATH actually resolves and changing the install plan and messages.
shutil.which, which the issue names as the existing tool, already covers the lookup and exposes the shadowing path, but it does not change_off_pinor emit the check/gate hint. Searches found no maintained external library beyond an oldwhichcraftshim of the same standard-library function, so no new tool is warranted.The item already names this tool.
Tool: python/cpython (https://github.com/python/cpython)
Covers:
Lacks:
_off_pinto skip installing a tool whose link in the target directory is already at the pininstall-tools --checkor gate message naming the PATH-resolved path, its version, the target directory and the fixTools considered:
Searches run:
Sources:
Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Status set to Ready at 2620fae (see proposed design in issue body).
dan-petty commentedon Nov 26, 2026
Closed:
devops install-toolsno longer exists.#6555 deleted the command and
tools.lock. The devtools image gives the tools. The item itself says to close it when the command goes.