Skip to content

feat(install-tools): install OpenSpec from a pinned npm lockfile with telemetry off #1842

Closed

Description

@dan-petty

Friction

Issue #1753 and docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md adopt OpenSpec 1.14.3 as the planning layer for every agent. This is step 1 of 8: the tool has to be installable, reproducible and silent before anything else in the adoption can use it. Four gaps stand in the way today.

  • tools.lock has binary and Python kinds only, and the repository has no package.json, no lockfile and no npm step. OpenSpec is a Node tool.
  • The tool's own integrity data is too loose to pin on. The root tarball's sha512 covers 1 of the 57 installed packages, 11 of the 12 direct dependencies are caret ranges, and the same pin resolved on 2026-10-17 differs in 12 @inquirer/* packages from its resolution on 2026-10-22.
  • Telemetry is on by default. In text mode, openspec validate, list, update and version --check each tried to POST to the PostHog proxy at edge.openspec.dev on every run, and update and version --check also asked registry.npmjs.org (observed in an empty network namespace). DO_NOT_TRACK=1, OPENSPEC_TELEMETRY=0 or a truthy CI stops both requests, OPENSPEC_NO_UPDATE_CHECK=1 alone stops only the update check, and openspec config set telemetry.enabled false sends one event unless one of those is set first. AGENTS.md requires every third-party telemetry channel to be off.
  • devops builds a sanitized child environment: with DO_NOT_TRACK and the OPENSPEC_* variables set in the parent, the child saw none of them. The devcontainer's node feature also floats to the current LTS (24.22 at the time of the ADR), while the tool needs Node 20.19 or later.

Evidence

  • Trial of 2026-10-22 against OpenSpec 1.14.3 in scratch directories, recorded in the ADR's Evaluation and Trial sections. npm install --ignore-scripts of the pin added 57 packages in 2 s and the package declares no install scripts. npm ci checks the sha512 of every package: one flipped integrity character failed with EINTEGRITY (and left a partial node_modules when the package was the first or the last in the lock, which is why the installer stages the install and renames it only on success), and two clean installs gave the same tree hash. npm audit signatures verified all 57 packages and npm audit found nothing. npm audit --package-lock-only --prefix <dir of the pin> needs no install.
  • The repository's own installer already stages installs and renames them into place: _staged and _link_commands in src/devops_cli/commands/install_tools.py, and PythonTool in src/devops_cli/tools_lock/__init__.py is the precedent for a kind whose integrity data lives in a file beside tools.lock.

Feasibility to confirm in the change's proposal: that npm audit --package-lock-only runs in the static job of .github/workflows/ci.yml before the scaffold item adds actions/setup-node (hosted runner images ship Node and npm; confirm on the runner image in use), and if it does not, that this item adds the Node step itself.

Existing tool considered

The open tools are npm itself (npm ci from a committed package-lock.json is the standard reproducible install) and the installer the repository already has. The alternatives were rejected in the ADR's Considered Options: a root package.json is a second install path outside tools.lock with a 2,094-file node_modules at the root, and a global install or npx float. Nothing is built that npm already does; the new installer branch only stages, runs npm ci and links.

The change

  • src/devops_cli/tools_lock/tools.lock: a [npm.openspec] table with version = "1.14.3", description, source, and bin = "openspec". The header comment gains the bump runbook for an npm tool: set the version in tools.lock and in package.json, run npm install --package-lock-only --ignore-scripts, run npm audit signatures and osv-scanner scan source --lockfile package-lock.json, run the lock and installer tests, and run devops install-tools --check. The runbook steps that regenerate the skills and run the gate are added by the scaffold item, because those commands do not exist until it lands.
  • src/devops_cli/tools_lock/openspec/package.json (the exact version as the one dependency) and package-lock.json (lockfileVersion 3, 57 packages, every entry sha512 and on registry.npmjs.org, none with an install script).
  • src/devops_cli/tools_lock/__init__.py: an NpmTool model beside BinaryTool and PythonTool (extra="forbid", frozen), ToolsLock.npm, ToolsLock.tools() including it, installed_commands resolving node_modules/.bin/<bin>, and tools_lock_digest() covering each npm tool's package.json and package-lock.json so a change to either changes the digest.
  • src/devops_cli/commands/install_tools.py: install_npm_tool(name, entry, target_dir) beside install_python_tool. It fails early with require_binary("npm", ...) (the installer provisions no runtime, Python's included), stages beside the version directory, copies the two files and two empty npmrc files, runs npm ci --ignore-scripts --no-audit --no-fund --engine-strict --replace-registry-host=never through run_subprocess with an explicit npm_config_cache, npm_config_userconfig and npm_config_globalconfig (npm refuses a user and a global config that are one file, and a configured registry would otherwise rewrite the lock's URLs), renames the stage into <user_data_root>/tools/openspec/1.14.3 and links node_modules/.bin/openspec into the target directory (~/.local/bin). install_tool and _at_pin dispatch the third kind by a table keyed on the model type rather than a longer isinstance chain.
  • devops devcontainer post-create already installs every lock tool (install_managed_tools(only_missing=True)). It must report a missing npm or a failed npm ci as a warning, so the hard failure is devops install-tools and, from the scaffold item, the gate row.
  • .node-version holds 24. The devcontainer's node feature in .devcontainer/devcontainer.json and in src/devops_cli/templates/devcontainer.json.j2 is pinned to 24, with .devcontainer/devcontainer-lock.json kept consistent, and a contract test keeps the two equal.
  • The opt-out environment. The devcontainer (.devcontainer/devcontainer.json, the template and tests/test_third_party_telemetry.py) sets OPENSPEC_TELEMETRY=0 and OPENSPEC_NO_UPDATE_CHECK=1 beside its DO_NOT_TRACK=1. .github/workflows/ci.yml sets DO_NOT_TRACK: "1" at the top of the workflow (the runner's CI=true already suffices; this makes it explicit). The committed .claude/settings.json gains an env block with DO_NOT_TRACK, OPENSPEC_TELEMETRY and OPENSPEC_NO_UPDATE_CHECK. The variables the gate module passes through extra_allowed_env (OPEN_SPEC_INTERACTIVE, XDG_CONFIG_HOME) belong to the scaffold item.
  • The audit check in src/devops_cli/commands/ci.py runs npm audit --package-lock-only --prefix src/devops_cli/tools_lock/openspec beside uv audit, so a vulnerable pin fails the gate. The check's spec carries one cmd today and devops ci audit and the _returncode(get_check_spec("audit").cmd) call in the same module read it, so the spec has to carry both commands without a shell.
  • .github/renovate.json: a packageRules entry {"matchManagers": ["npm"], "enabled": false}. Renovate can edit neither tools.lock nor the generated files, and no pull request by Renovate was found. A bump is one deliberate pull request with the runbook.
  • AGENTS.md: the telemetry opt-out list gains OPENSPEC_TELEMETRY=0. The file ends this step at 39,943 of its 40,000 characters (tests/test_agents_md_claims.py enforces the cap).
  • devops docs generate --sync-readme for any generated reference the change touches.

What it deletes

Nothing is removed in this step. It replaces the floating node feature version with a pin, and it adds no second install path: the Python and binary kinds stay as they are.

Tests

The test floor refuses every program but git, bwrap and a few kubectl forms, so no test starts npm or openspec.

  • Lock tests read the JSON: the exact version in package.json equals tools.lock, lockfileVersion is 3, every entry has a sha512 and an https registry URL, and none has an install script.
  • tests/test_tools_lock.py: the model rejects an unknown key, and tools_lock_digest() changes when either lock file changes.
  • tests/test_install_tools.py: the installer fakes install_tools.run_subprocess as the Python-tool tests do, and asserts the argv, the explicit npm_config_* environment, the staged rename, the link, that a failed npm ci leaves an earlier install untouched, and that a missing npm raises through require_binary.
  • A contract test that .node-version equals the devcontainer feature option.
  • tests/test_third_party_telemetry.py gains the two variables for the devcontainer, its template and the committed .claude/settings.json.
  • A test of the audit check's commands, and of the Renovate setting.

Dependencies

None. This is the first step. Every later step depends on it.

Planning record: this item is planned under the current rules (a task file), since AGENTS.md names task files until the switch item merges.

Acceptance criteria

  • uv run devops install-tools --tool openspec installs 1.14.3 from the committed lockfile with npm ci, links openspec onto the PATH, and devops install-tools --check reports it at the pin.
  • A flipped integrity character in package-lock.json makes the install fail and leaves no partial install of the version.
  • Without npm, devops install-tools fails early naming npm, and devops devcontainer post-create warns instead of failing.
  • The audit check fails on a vulnerable pin and runs in devops ci.
  • The devcontainer, CI and .claude/settings.json set the three opt-outs, and .node-version and the devcontainer's Node pin are equal.
  • devops ci passes, with AGENTS.md within its 40,000-character cap (39,943 with the wording the ADR gives).

Activity

  1. added
    source/agent
    type/feature
    on Oct 22, 2026
  2. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Type: type/feature. The candidate proposes a new feature to install OpenSpec from a pinned npm lockfile with telemetry off.
    • Priority: P1-High. This is a prerequisite for adopting OpenSpec 1.14.3 as the planning layer for every agent, which is part of a larger plan.
    • Value: High. The change enables reproducible and silent installation of OpenSpec, which is critical for adoption by all agents.
    • Effort: Medium. It requires modifying the tools.lock file, adding npm-related tooling, and ensuring telemetry is disabled.
  3. added this to the v0.2.39 milestone on Oct 22, 2026
  4. added
    status/in-progress
    on Oct 22, 2026
  5. added a commit that references this issue on Oct 22, 2026
    ae8c2d9
  6. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1857, merged into release/v0.2.39 as ae8c2d9.

    Cause: OpenSpec is a Node tool (ADR 0010, step 1 of 8), and tools.lock had binary and Python kinds only. The repository had no package.json, no lockfile and no npm step. The tool's own integrity data is too loose to pin on (the root tarball's sha512 covers 1 of 57 installed packages and 11 of 12 direct dependencies are caret ranges), it sends telemetry and asks the npm registry for updates unless told not to, devops drops DO_NOT_TRACK and the OPENSPEC_* variables from the child environment it builds, and the devcontainer's node feature floated to whatever LTS was current while the tool needs Node 20.19 or later.

    Change: tools.lock gains a third kind, [npm.openspec] at 1.14.3, with NpmTool (frozen, extra="forbid") beside BinaryTool and PythonTool. Its integrity data is src/devops_cli/tools_lock/openspec/package.json (the exact version as the one dependency) and package-lock.json (lockfileVersion 3, 57 packages, every one sha512 on registry.npmjs.org, none with an install script), and tools_lock_digest() covers both files. installed_commands finds a command through a command_dir each kind declares instead of an isinstance test, and the header of tools.lock carries the bump runbook for a Node tool. install_npm_tool fails first, naming npm, when it is not on PATH (require_binary), then stages beside the version directory with only the two locked files, runs `npm ci --ignore-scripts --no-audit --no-fund --engine-strict --replace-registr…

    44 file(s) changed.

    How it was verified

    Check runs at 04a9930:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • zizmor: pass
    • devops-cli: pass
    • bandit: pass
    • CodeQL: pass
    • Static Analysis: pass
    • Fail-to-Pass Check: pass
    • Rule Pack Tests: pass
    • Changed-Test Independence: pass
    • Fail-to-Pass Self-Check: pass
    • Tests & Coverage: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • Service Image: skipping
    • Dependency Freshness: skipping
    • DevContainer Image: skipping

    Acceptance Criteria of docs/agent/tasks/task-1842-openspec-pinned-npm-install.md:

    • uv run devops install-tools --tool openspec installs 1.14.3 from the committed lockfile with npm ci, links openspec onto the PATH, and devops install-tools --check reports it at the pin. Red first: the lock had no Node kind. Now tests/test_install_tools.py installs it through a double of npm at subprocess.run and shutil.which and asserts the whole argument list, the environment npm gets (the five npm_config_ settings and none of the caller's), the files in the stage, the two locked files in the version directory, the link and --check. The installer also ran against the real npm into a scratch data root, as the Feasibility field records.
    • A flipped integrity character in package-lock.json makes the install fail and leaves no partial install of the version. The double answers with the integrity failure of the real npm 11.19.1, recorded on 2026-10-22, after writing a partial node_modules; the tests check the error text, no stage, no link and no version directory, and that an earlier install of the same version keeps its files and its link. The real npm failed the same way on the committed lockfile with a flipped character.
    • Without npm, devops install-tools fails first naming npm, and devops devcontainer post-create warns instead of failing. tests/test_install_tools.py checks the dependency error (exit code 1, DEPENDENCY_MISSING, no stage, no process started) and the exit code of the command, and tests/test_devcontainer.py runs post-create with no npm and finds exit 0 and the warning.
    • The lock tests read the JSON: package.json names one dependency at the exact version of tools.lock and the lockfile resolved it to the same version, lockfileVersion is 3, every package has a sha512 and an https URL on registry.npmjs.org, none has an install script, NpmTool rejects an unknown key, and the digest changes with either file.
    • The audit check fails on a vulnerable pin and runs in devops ci. tests/test_ci.py and tests/test_ci_maintain.py check the argument lists of both commands, that devops ci audit fails when either fails and still runs the other, the one-plan dry run, that the gate's check merges the output of both and fails when either fails, and that maintain and the gate's row name npm. A lockfile with a vulnerable package made npm audit --package-lock-only exit 1.
    • An audit that could not run is not reported as a finding. Red first: maintain took npm's exit 1 for vulnerabilities. Now tests/test_dependency_audit.py reads the four npm reports recorded in tests/fixtures/npm_audit/ (clean, vulnerable, registry unreachable, advisories endpoint missing) and uv's statuses, and tests/test_ci_maintain.py and tests/test_ci.py check that devops ci maintain, devops ci audit and the gate's row say "found vulnerabilities" for the vulnerable report and "could not run" for the two failures, with the report shown above.
    • The devcontainer, the template, ci.yml and .claude/settings.json set the opt-outs, and .node-version and the devcontainer's Node pin are equal: tests/test_third_party_telemetry.py, tests/test_devcontainer.py, and a Renovate test in tests/test_tools_lock.py.
    • AGENTS.md is within its 40,000-character cap (39,943).
    • uv run devops docs check finds the generated documents current.
    • Pending a person: rebuild the devcontainer, then run node --version (expect v24.x), env | grep -E 'OPENSPEC|DO_NOT_TRACK' (expect DO_NOT_TRACK=1, OPENSPEC_TELEMETRY=0 and OPENSPEC_NO_UPDATE_CHECK=1) and devops devcontainer post-create, which installs openspec into ~/.local/bin.
  7. added a commit that references this issue on Oct 23, 2026
    f209f6c
  8. removed
    status/in-progress
    on Oct 30, 2026
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

    source/agenttype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions