Skip to content

test: the suite does not start real @opencode-ai/plugin installs - #1872

Merged
RaghwendraSingh merged 5 commits into
mainfrom
fix/tests-no-plugin-install
Dec 1, 2026
Merged

RaghwendraSingh merged 5 commits into
mainfrom
fix/tests-no-plugin-install

Conversation

@RaghwendraSingh

@RaghwendraSingh RaghwendraSingh commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

No issue is filed yet. This fixes the CI failure that has affected main and every PR since 2026-12-01. The evidence is in draft PR #1871.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The problem. Some tests create a project that contains a custom tool file. When the app sees such a file, it starts an npm install of the plugin package into that project, because a custom tool may import it. The install is real: it downloads about 80 packages from the npm registry. It runs inside the test process, and the app does not wait for it.

So the install is still running when the test ends. The next test starts another one. With eight running at once, the test process stops making progress. Whichever tests run next then time out after minutes, or the job runs out of memory and is killed. Which tests fail changes from run to run, because they are only the ones that happen to come next.

The fix.

  • The app skips this background install when ALTIMATE_DISABLE_DEPENDENCY_INSTALL is set. When it is not set, the app behaves exactly as before.
  • The test setup file sets the variable, so no test starts a real install.
  • 17 existing tests check that the app asks for an install in the right cases. They clear the variable for themselves. They use a fake installer that only records the request, so they do not reach the network either.
  • One new test covers the variable, and it is added to the environment variable table in the CLI docs.

What this does not change. Users still get the background install, and it can still slow the app while it runs. That is a product change for a separate PR.

What is not known. Why this started failing on 2026-12-01. The same tests have always started these installs, and the packages installed have not changed since 2026-11-17. The likely explanation is that the installs became slow enough to overlap, but that is not confirmed.

How did you verify your code works?

Draft PR #1871 runs the test shards on CI with a script that reports every stall and every request to the npm registry.

Run Result
Shard 3, unchanged Stalls. 8 installs running, 82 packages downloaded
Shard 3 without the one test file that creates custom tools Passes. No stall, nothing downloaded
All four shards with this fix All pass. No stalls, nothing downloaded

This PR's own CI passes, including the four test shards that were failing. With the variable set and no other change, exactly the 17 install-request tests failed and no others, so no test depended on the real install.

Cost side effects

None.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added the ALTIMATE_DISABLE_DEPENDENCY_INSTALL environment setting. When enabled, automatic installation of plugin dependencies in configuration directories containing custom tools or plugins is skipped.
  • Documentation
    • Documented the setting’s accepted values and clarified that custom tools or plugins importing the package must obtain it another way when installation is disabled.

A test that writes a tool or plugin file into a config dir makes the app start
an `npm install` of `@opencode-ai/plugin` there. The install runs inside the
test process and is not awaited, so it outlives the test. Several pile up,
starve the event loop, and the tests that run next time out or the job is
killed. This made the `TypeScript` shards fail on `main` and every PR from
2026-12-01.

- `ConfigPlugin.shouldInstallDependencies` returns false when
  `ALTIMATE_DISABLE_DEPENDENCY_INSTALL=1`. Without the variable nothing changes.
- `test/preload.ts` sets it for the suite.
- The config and TUI tests that check when an install is requested clear it.
  They use a recording installer and never reach the network.
- One new test covers the switch.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Dependency installation can now be disabled with ALTIMATE_DISABLE_DEPENDENCY_INSTALL. Tests cover the setting’s values and its effect on installation checks. The CLI reference documents the setting.

Changes: Dependency Installation Gate

Layer / File(s) Summary
Environment-variable installation gate
packages/core/src/flag/flag.ts, packages/opencode/src/config/plugin.ts
Flag.ALTIMATE_DISABLE_DEPENDENCY_INSTALL parses the environment value. shouldInstallDependencies returns false when this flag or OPENCODE_PURE is enabled. Otherwise, it uses the existing needsDependencies check.
Test setup and gate assertions
packages/opencode/test/preload.ts, packages/opencode/test/config/config.test.ts, packages/opencode/test/config/tui.test.ts, packages/opencode/test/skill/release-v0.11.1-adversarial.test.ts, packages/opencode/test/cli/serve/fresh-start.test.ts, docs/docs/usage/cli.md
Test preload disables installation by default. Tests override or clear the variable to verify the gate, its accepted values, and behavior in the fresh-start test. The CLI documentation describes the setting and its value interpretation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: hkaltai, sahrizvi

Merge Risk: Minimal · up to e1ea0

This adds an opt-out switch for the background dependency install and uses it to stop test runs from starting real installs. Default user behavior is unchanged, and no merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the test suite no longer starts real @opencode-ai/plugin installs. The changeset adds ALTIMATE_DISABLE_DEPENDENCY_INSTALL, sets it in test preload, and updates the tes…
Description check Passed The description follows the template. It has the issue section (no issue filed, with a reference to draft PR #1871), the Bug fix type checked, a detailed 'What does this PR do?' section explaining the…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the test suite no longer starts real @opencode-ai/plugin installs. The changeset adds ALTIMATE_DISABLE_DEPENDENCY_INSTALL, sets it in test preload, and updates the tests that check install requests. The title is specific and matches the primary intent. The objectives reference PR #1872 with the same title wording, which is consistent with the changes.

Full details: Description check

Explanation

The description follows the template. It has the issue section (no issue filed, with a reference to draft PR #1871), the Bug fix type checked, a detailed 'What does this PR do?' section explaining the problem, fix, scope, and unknowns, a verification section with results, a Cost side effects section stating 'None', a Screenshots section noting it is not a UI change, and a completed checklist. The 'Closes #' line is replaced by a statement that no issue exists, which is acceptable. The description is mostly complete and specific.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the setting with care,
No install starts when it says “beware.”
Tests try each value, then restore,
The CLI notes what the switch is for.
I twitch my nose and hop away,
With tidy gates to greet the day.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eeb0bd4b-afae-4410-b5e9-0cc306928351
Commits

Reviewing files that changed from the base of the PR and between 33cb412 and e1ea0f6.

Files selected for processing: 1

  • packages/opencode/test/config/config.test.ts
Files skipped from review as they are similar to previous changes: 1

  • packages/opencode/test/config/config.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

👋 This PR was automatically closed by our quality checks.

Common reasons:

  • New GitHub account with limited contribution history
  • PR description doesn't meet our guidelines
  • Contribution appears to be AI-generated without meaningful review

If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/opencode/src/config/plugin.ts Outdated
/** `ALTIMATE_DISABLE_DEPENDENCY_INSTALL=1` skips the install. The test suite sets it: an install
* started by one test is not awaited, outlives the test, and runs inside the test process. */
function installDisabled(): boolean {
const v = process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"]?.toLowerCase()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SUGGESTION]: Reuse the shared env-flag parsers

installDisabled() is a copy of truthy() in packages/core/src/flag/flag.ts:23 (case-insensitive true/1), and this file already imports from that module, which also exports env() and killSwitchSet().

It also picks the opposite rule from the other ALTIMATE_DISABLE_* switches: ALTIMATE_DISABLE_WORKSPACE and ALTIMATE_DISABLE_SCHEMA_VALUES fail closed (killSwitchSet: trimmed, and anything except 0/false/empty counts as set). So ALTIMATE_DISABLE_DEPENDENCY_INSTALL=yes silently does nothing while ALTIMATE_DISABLE_WORKSPACE=yes works. The shared parser keeps every test as written (1/0 parse identically) and removes the local helper:

function installDisabled(): boolean {
  return killSwitchSet(env('ALTIMATE_DISABLE_DEPENDENCY_INSTALL'))
}

Since this is read on the shipped path, it also belongs next to those two rows in the env table in docs/docs/usage/cli.md.

fs.mkdirSync(path.join(dir, "node_modules"))
saved = process.env[ENV_KEY]
delete process.env[ENV_KEY]
expect(process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"]).toBe("1")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SUGGESTION]: Assert the flag, not the preload's value

The case is named ALTIMATE_DISABLE_DEPENDENCY_INSTALL=1 suppresses installation, but nothing here sets the variable: this line asserts whatever test/preload.ts happened to leave. That couples the case to a harness detail (it fails for the wrong reason if the preload value changes or a new suite-level hook clears it) and leaves the documented true spelling untested. Set and restore the value inside the test so it proves the gate itself:

const off = process.env.ALTIMATE_DISABLE_DEPENDENCY_INSTALL
process.env.ALTIMATE_DISABLE_DEPENDENCY_INSTALL = '1'
try {
  expect(ConfigPlugin.needsDependencies(dir, undefined)).toBe(true)
  expect(ConfigPlugin.shouldInstallDependencies(dir, undefined)).toBe(false)
} finally {
  if (off === undefined) delete process.env.ALTIMATE_DISABLE_DEPENDENCY_INSTALL
  else process.env.ALTIMATE_DISABLE_DEPENDENCY_INSTALL = off
}

@kilo-code-bot

kilo-code-bot Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental pass over 33cb4129..e1ea0f61. The single commit (test: drop two unrelated formatting changes from config.test.ts) only touches packages/opencode/test/config/config.test.ts: it re-indents the // altimate_change end marker back to column 0 and re-joins the writeConfigEffect(...) call in the learn keys set above project files describe.

Verified:

  • Both reverted lines are byte-identical to base 5e742c27, so config.test.ts is additive-only against the base (24 additions, 0 deletions) and the PR no longer carries unrelated formatting noise.
  • The revert is cosmetic only: the marker pair still wraps a contiguous block, and the re-joined call is the same writeConfigEffect invocation with the same arguments.
  • The layer-level coverage added earlier (describe-level beforeEach/afterEach clearing the switch, plus the tools/hello.ts case asserting npm.dirs is empty) is untouched by this commit and still present at lines 1063-1110.
Files Reviewed (1 file)
  • packages/opencode/test/config/config.test.ts
Previous Review Summaries (4 snapshots, latest commit 33cb412)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 33cb412)

Status: No Issues Found | Recommendation: Merge

Incremental pass over 2229e0e..33cb4129. The commit moves the switch onto a Flag getter in packages/core/src/flag/flag.ts (access-time read, shared killSwitchSet parse), drops the local installDisabled() helper and its imports, opts the cold-start subprocess test back into a real install decision, and adds the layer-level coverage that was missing (Config describe case with a tools/ source, one TUI matrix case for tool + the switch set, and a beforeEach that clears both switches for the PURE cases).

Verified:

  • withEnv(name, undefined, ...) deletes the variable rather than writing "undefined", so the unset cases are genuine.
  • Child processes inherit the runner environment (extendEnv: true in spawn, { ...process.env, ...env, ...opts.env } in serve), so ALTIMATE_DISABLE_DEPENDENCY_INSTALL: "0" in fresh-start.test.ts is what restores that test's real cold-start decision; "0" parses as unset via killSwitchSet.
  • Both install call sites (config.ts, tui.ts) still route through ConfigPlugin.shouldInstallDependencies, so the single switch covers them; no other install path bypasses the gate.
  • No nested altimate_change markers were introduced, and no eager spread of core Flag would freeze the getter.
Files Reviewed (6 files)
  • packages/core/src/flag/flag.ts
  • packages/opencode/src/config/plugin.ts
  • packages/opencode/test/cli/serve/fresh-start.test.ts
  • packages/opencode/test/config/config.test.ts
  • packages/opencode/test/config/tui.test.ts
  • packages/opencode/test/skill/release-v0.11.1-adversarial.test.ts

Previous review (commit 2229e0e)

Status: No Issues Found | Recommendation: Merge

This incremental pass covers 65ccba1d..2229e0e only, a one-line doc change. Both findings from the previous review remain fixed at this HEAD: installDisabled() delegates to killSwitchSet(env("ALTIMATE_DISABLE_DEPENDENCY_INSTALL")), and the adversarial case sets and restores the variable and asserts both sides of the gate.

Verified in current HEAD:

  • The doc edit is accurate: SOURCE_GLOB in packages/opencode/src/config/plugin.ts:53 is {tool,tools,plugin,plugins}/*.{js,ts}, so needsDependencies does consider local plugin files as well as custom tools. "custom tools or plugins that import the package" is now the correct wording and matches cubic's P2 note on the older line.
  • The switch, test/preload.ts, and the install-decision tests are unchanged since the last pass, so no re-verification gaps were introduced.
  • No redundant or simplifiable code was added; the table row keeps the same structure and fail-closed wording as the two adjacent ALTIMATE_DISABLE_* rows.
Files Reviewed (1 file)
  • docs/docs/usage/cli.md

Previous review (commit 65ccba1)

Status: No Issues Found | Recommendation: Merge

This incremental pass covers 0e8e8627..65ccba1d only. Both findings from the previous review were fixed in this commit: installDisabled() now delegates to the shared killSwitchSet(env(...)) parser (matching the other ALTIMATE_DISABLE_* switches and removing the local copy), and the adversarial case now sets the variable itself and asserts both sides of the switch while restoring it.

Verified in current HEAD:

  • killSwitchSet / env are exported by packages/core/src/flag/flag.ts and produce the documented fail-closed rule (0, false, empty → install on; anything else → off), so the new doc row matches behavior.
  • env() resolves through documentedAlias only for OPENCODE_ keys, so this plain ALTIMATE_ read at call time is equivalent to the adjacent ALTIMATE_DISABLE_WORKSPACE precedent.
  • ConfigPlugin reads the core Flag.OPENCODE_PURE getter, which resolves process.env per call, so the tests' delete/restore of OPENCODE_PURE remains effective.
  • No other test or product site sets the new variable to a value whose meaning changed under the fail-closed parse (test/preload.ts sets 1; config.test.ts/enable-by-default cases delete it or set 0).
Files Reviewed (3 files)
  • docs/docs/usage/cli.md
  • packages/opencode/src/config/plugin.ts
  • packages/opencode/test/skill/release-v0.11.1-adversarial.test.ts

Previous review (commit 0e8e862)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2

Both findings are non-blocking. The switch covers the shipped in-process install paths: src/config/config.ts:780 and src/config/tui.ts:278 are the only two Npm.install call sites for the config-dir package and both go through ConfigPlugin.shouldInstallDependencies. Subprocess suites are unaffected (they spawn with OPENCODE_PURE=1 via test/lib/cli-process.ts), and the two suites that assert the install decision (test/config/config.test.ts, test/config/tui.test.ts) clear the variable, so no install-decision coverage is lost.

Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/config/plugin.ts 87 Local parser duplicates truthy()/killSwitchSet() and uses the opposite (non fail-closed) rule from the other ALTIMATE_DISABLE_* switches; the var is also missing from the documented env table
packages/opencode/test/skill/release-v0.11.1-adversarial.test.ts 267 New case asserts the preload's ambient value instead of setting the variable, so it tests the harness rather than the gate
Files Reviewed (5 files)
  • packages/opencode/src/config/plugin.ts - 1 issue
  • packages/opencode/test/config/config.test.ts - 0 issues
  • packages/opencode/test/config/tui.test.ts - 0 issues
  • packages/opencode/test/preload.ts - 0 issues
  • packages/opencode/test/skill/release-v0.11.1-adversarial.test.ts - 1 issue

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash-1017 · Input: 52.5K · Output: 8.7K · Cached: 1M

Review guidance: REVIEW.md from base branch main

… document it

- `ALTIMATE_DISABLE_DEPENDENCY_INSTALL` is read with `killSwitchSet`, as the
  other `ALTIMATE_DISABLE_*` switches are: any value but empty, `0` or `false`
  turns the install off.
- Its test sets and restores the variable itself, and covers both sides.
- The variable has a row in the CLI environment table.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

👋 This PR was automatically closed by our quality checks.

Common reasons:

  • New GitHub account with limited contribution history
  • PR description doesn't meet our guidelines
  • Contribution appears to be AI-generated without meaningful review

If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you.

2 similar comments
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

👋 This PR was automatically closed by our quality checks.

Common reasons:

  • New GitHub account with limited contribution history
  • PR description doesn't meet our guidelines
  • Contribution appears to be AI-generated without meaningful review

If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

👋 This PR was automatically closed by our quality checks.

Common reasons:

  • New GitHub account with limited contribution history
  • PR description doesn't meet our guidelines
  • Contribution appears to be AI-generated without meaningful review

If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docs/docs/usage/cli.md Resolved
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

👋 This PR was automatically closed by our quality checks.

Common reasons:

  • New GitHub account with limited contribution history
  • PR description doesn't meet our guidelines
  • Contribution appears to be AI-generated without meaningful review

If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you.

2 similar comments
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

👋 This PR was automatically closed by our quality checks.

Common reasons:

  • New GitHub account with limited contribution history
  • PR description doesn't meet our guidelines
  • Contribution appears to be AI-generated without meaningful review

If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

👋 This PR was automatically closed by our quality checks.

Common reasons:

  • New GitHub account with limited contribution history
  • PR description doesn't meet our guidelines
  • Contribution appears to be AI-generated without meaningful review

If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you.

@hkaltai hkaltai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for one coverage regression. The production gate is small and correct: it reads the variable when called, through killSwitchSet, and both Config and TuiConfig go through shouldInstallDependencies.

MAJOR: the preload switch is inherited by CLI subprocesses, so it hides the cold-start regression test (see the inline comment on test/preload.ts).

MINOR: inline comments on the masked OPENCODE_PURE=1 case and on the missing layer-level suppression test.

Nits (consolidated):

  • src/config/plugin.ts:81-89: the existing "PURE mode skips dependency installs… Fold that check in here…" comment now sits above installDisabled() rather than shouldInstallDependencies. Move installDisabled() and its JSDoc above that comment.
  • src/config/plugin.ts:86-88: the sibling kill switches (ALTIMATE_DISABLE_WORKSPACE, ALTIMATE_DISABLE_SCHEMA_VALUES) are getters on Flag that read at call time. Consider adding Flag.ALTIMATE_DISABLE_DEPENDENCY_INSTALL for consistency.
  • test/config/tui.test.ts:98: the matrix sets the switch to "0". withEnv("ALTIMATE_DISABLE_DEPENDENCY_INSTALL", undefined, …) would exercise the unset default that users actually run with.
  • test/config/tui.test.ts:98,134: withEnv("…", "0", withEnv( / )), is not formatter-shaped. Run prettier on the file.
  • test/skill/release-v0.11.1-adversarial.test.ts:252-281: the save/delete/restore logic is written out by hand twice. A describe-level beforeEach/afterEach, as in config.test.ts, would be simpler.

Scope: no linked issue, but all six files match the stated intent. No unrelated files.

Reviewed by independent Claude and Codex (Sol 6.1) reviewers, plus a lead pass, with one convergence round.

// app start a real `npm install` of `@opencode-ai/plugin` there, in this process and not awaited.
// It outlives the test: several pile up, starve the event loop, and the tests that run next time
// out. Tests that check the install itself clear this and inject an installer.
process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"] = "1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR — this hides the cold-start subprocess regression test.

process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"] = "1"

The CLI test helpers pass the runner's environment to every child: test/lib/cli-process.ts:240 uses extendEnv: true, and lines 365 and 459 use env: { ...process.env, ...env, ...opts?.env }. As a result, test/cli/serve/fresh-start.test.ts (the only subprocess test that sets OPENCODE_PURE: "0" to run a real cold start) also gets ALTIMATE_DISABLE_DEPENDENCY_INSTALL=1. Its checks (expect(requests).toEqual([]), no background dependency install failed in stderr, no node_modules/package.json in the config dirs) now pass whether or not needsDependencies decides correctly. If it ever regressed to installing into every config dir, this test would stay green.

Fix: opt that test back in, the same way it already does for PURE:

env: {
  OPENCODE_PURE: "0",
  ALTIMATE_DISABLE_DEPENDENCY_INSTALL: "0",
  ...

Its fake registry returns 503, and npm_config_fetch_retries is 0, so this cannot reintroduce the hang.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 33cb412. fresh-start.test.ts now sets ALTIMATE_DISABLE_DEPENDENCY_INSTALL: "0" for its child, next to OPENCODE_PURE: "0". Checked by breaking the code: with needsDependencies forced to return true the test fails, and without the new line it passes, which is the gap you described.

saved = process.env[ENV_KEY]
delete process.env[ENV_KEY]
expect(ConfigPlugin.shouldInstallDependencies(dir, undefined)).toBe(true)
// The suite's preload switches the install off; this case is about the product default.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR: the OPENCODE_PURE=1 case in this describe no longer tests PURE.

// The suite's preload switches the install off; this case is about the product default.

This case clears the switch, but the case just above it (OPENCODE_PURE=1 suppresses installation even when needsDependencies would be true, lines 238-244) does not. With the switch still set by preload, shouldInstallDependencies returns false whether or not PURE is respected, so that case no longer shows that PURE suppresses the install. Clear the switch there too, or better, do it once in the describe's beforeEach/afterEach so every case in this block runs with the switch unset.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 33cb412. The describe now clears both OPENCODE_PURE and the install switch in beforeEach and restores them in afterEach, so every case starts with both unset. Checked by removing the PURE check from shouldInstallDependencies: the PURE case fails.

describe("config dir plugin dependency install", () => {
const npmIt = testEffect(Layer.mergeAll(infra, FSUtil.defaultLayer))

// The suite's preload switches the background install off. These cases check when the app

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR: no layer-level test shows that the switch actually stops the install.

// The suite's preload switches the background install off. These cases check when the app
// asks for one, through a recording installer that never reaches the network.

The new test calls ConfigPlugin.shouldInstallDependencies directly. No case goes through the Config (or TuiConfig) layer with the switch set to 1 and a tool/ file present and checks that the recording installer receives nothing (npm.dirs / installs is []). Both call sites use the shared gate today, so this is about guarding that wiring rather than a current bug. A single case here and one in the TUI matrix would cover it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 33cb412. One Config case sets the switch to 1 with a tools/ file present and expects the recording installer to receive nothing, and the TUI matrix has the same case. Checked by making the code ignore the switch: both fail, along with the switch's own test.

RaghwendraSingh and others added 2 commits December 1, 2026 18:57
… switch is covered at both call sites

- `fresh-start.test.ts` sets `ALTIMATE_DISABLE_DEPENDENCY_INSTALL=0` for its
  child process. The child inherited the suite's switch, so the test passed
  whether or not the install decision was right.
- The `OPENCODE_PURE` cases clear the switch in `beforeEach`, so the PURE case
  tests PURE again.
- One Config case and one TUI case check that with the switch set and a tool
  file present the recording installer receives nothing. The TUI matrix runs
  with the switch unset, as users do.
- The switch is a getter on `Flag`, like the other `ALTIMATE_DISABLE_*`
  switches.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@RaghwendraSingh

Copy link
Copy Markdown
Contributor Author

Thanks for the review. All points are addressed in 33cb412 and e1ea0f6; the three inline threads have replies.

Nits

  • Comment placement in plugin.ts: the local helper is gone, so the PURE comment sits above shouldInstallDependencies again, with one line added for the new switch.
  • Flag getter: added as Flag.ALTIMATE_DISABLE_DEPENDENCY_INSTALL, read at call time with killSwitchSet, like ALTIMATE_DISABLE_WORKSPACE.
  • TUI matrix: it runs with the switch unset (undefined), except the one case that sets it to 1.
  • Formatting: tui.test.ts is formatted with prettier. Its diff looks large because the body is one level deeper; the logic change is three lines.
  • Save and restore in the release test: one beforeEach/afterEach pair for the describe.

One thing I corrected after your review: prettier had also reformatted two unrelated places in config.test.ts. e1ea0f6 reverts them.

Linked issue: none is filed yet; the needs:issue label is still on the PR.

CI is green on e1ea0f6 (21 checks).

@dev-punia-altimate

Copy link
Copy Markdown
Contributor

🤖 Code Review — OpenCodeReview (Gemini) — No Issues Found

No comments generated. Looks good to me.

@hkaltai hkaltai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peer review: APPROVE

Reviewers: Claude (lead), Claude (independent claude -p), Codex gpt-6.1-sol. All three approve; one convergence round, no disagreement.

The fix is small and in the right place:

  • The flag is read at call time with the shared killSwitchSet parsing, which matches the docs.
  • It sits in shouldInstallDependencies, the single gate for both Config and TuiConfig, so waitForDependencies just joins an empty list, as it already does under OPENCODE_PURE.
  • The env var is restored correctly everywhere. The fresh-start child opts back in with 0, the recording installers never reach the network, and no assertions were weakened.
  • Unset behavior is unchanged.

One minor docs point is inline.

Nits:

  • packages/core/src/flag/flag.ts:153-158: the JSDoc explains the flag by why the test suite sets it. Describe what it does for users; the test reasoning is already in test/preload.ts.
  • packages/opencode/test/skill/release-v0.11.1-adversarial.test.ts:230: the describe("shouldInstallDependencies — Flag.OPENCODE_PURE fold") title now also covers the new flag. Something like "— kill-switch folds" would fit.
  • No committed cases for surrounding whitespace or mixed-case values (" 1 ", "FALSE"), even though the docs promise trimming and case-insensitive parsing.

Scope: no ticket filed, so this can't be checked against one; the diff matches the PR's stated scope. Unrelated files: none.

Comment thread docs/docs/usage/cli.md
| `ALTIMATE_CLI_DISABLE_MODELS_FETCH` | Don't fetch models from models.dev |
| `ALTIMATE_DISABLE_WORKSPACE` | Set to `1` to turn off every workspace feature (linking, skill and memory sync, the workspace engine, and the project lookup each session makes). The value is trimmed and read without regard to case; anything other than `0`, `false` or an empty value counts as set. Workspaces are on by default |
| `ALTIMATE_DISABLE_SCHEMA_VALUES` | Set to `1` to turn off `schema_inspect`'s column value profiles for every call, whatever the model passes as `values`, so no cell values are sampled or sent to the model provider. The value is trimmed and read without regard to case; anything other than `0`, `false` or an empty value counts as set |
| `ALTIMATE_DISABLE_DEPENDENCY_INSTALL` | Set to `1` to skip the background install of `@opencode-ai/plugin` into config directories that hold custom tools or plugins. Use it where that package is already provided or the npm registry is not reachable; custom tools or plugins that import the package then need it installed some other way. The value is trimmed and read without regard to case; anything other than `0`, `false` or an empty value counts as set |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR · documentation — the flag covers less than this row suggests

| ALTIMATE_DISABLE_DEPENDENCY_INSTALL | Set to 1 to skip the background install of @opencode-ai/plugin into config directories ... Use it where that package is already provided or the npm registry is not reachable; ...

The flag only gates the config-dir @opencode-ai/plugin install (ConfigPlugin.shouldInstallDependencies). Other installs still run with it set:

  • npm plugin specs: BunProc.install in src/plugin/index.ts:141 and Npm.add in src/plugin/shared.ts:213
  • provider SDKs: BunProc.install in src/provider/provider.ts:2272

So an operator who sets it because the registry is unreachable, with "plugin": ["some-plugin@1.0.0"] in their config, still gets a registry install attempt at startup.

Suggested: state in this row that npm plugin and provider SDK installs are not affected. Or rename the flag to match its scope, e.g. ALTIMATE_DISABLE_PLUGIN_SDK_INSTALL.

@RaghwendraSingh
RaghwendraSingh merged commit 65e4ebf into main Dec 1, 2026
50 of 51 checks passed
@altimate-harness-bot

Copy link
Copy Markdown
Contributor

🔁 @RaghwendraSingh — this change was promoted to the help-docs hub: https://github.com/AltimateAI/help-docs/pull/197 — please review/merge to keep the docs in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants