Skip to content

test(server): isolate plugin reuse fixture from config dependency install - #264

Merged
agenteinstinct1-max merged 5 commits into
dev-vibecodedfrom
instinct/httpapi-plugin-test-hermetic
Oct 12, 2026
Merged

agenteinstinct1-max merged 5 commits into
dev-vibecodedfrom
instinct/httpapi-plugin-test-hermetic

Conversation

@agenteinstinct1-max

@agenteinstinct1-max agenteinstinct1-max commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

Closes #263. Manual Development link verified.

Type of change

  • Bug fix

What does this PR do?

Make the plugin reuse fixture independent of a real registry install. Adds OPENCODE_DISABLE_CONFIG_DEP_INSTALL, evaluated at access time. Production config installation is unchanged by default. The fixture sets the flag because its file plugin imports no dependencies, then restores it in finally. Assertions and timeout budgets are unchanged.

This isolates the fixture, not the separate SDK-to-REST diagnostic gap. Mock-registry dependency-install coverage remains follow-up work in #263. Windows filesystem/scanner overhead is a hypothesis, not a measured cause.

How did you verify your code works?

Independent review of exact tree c51232b79b0d776c3ade3d9e45e7ea3e5def6e0a on base 06b727. Focused test passed under the default 5-second budget. Patch and matched baseline full-file runs both had 10 passes and the same first HTTP/PTY 5-second timeout, with 35 assertions. Not an all-green local claim. Fresh CI and review are pending.

Screenshots / recordings

Not a UI change.

Checklist

  • Tested locally with the baseline caveat above
  • No unrelated changes

@github-actions

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.

@github-actions

Copy link
Copy Markdown

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@kilo-code-bot

kilo-code-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/core/src/plugin/skill/customize-opencode.md - previous suggestion resolved
  • packages/core/test/pty/pty-session.test.ts - no issues
Previous Review Summaries (2 snapshots, latest commit 1c4490e)

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

Previous review (commit 1c4490e)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/core/src/flag/flag.ts 57 New flag OPENCODE_DISABLE_CONFIG_DEP_INSTALL is undocumented. Add it to the "Escape hatches" list in packages/core/src/plugin/skill/customize-opencode.md and note it is for test/CI use only.
Files Reviewed (4 files)
  • packages/core/src/flag/flag.ts - 1 issue
  • packages/opencode/src/config/config.ts - no issues
  • packages/opencode/test/server/httpapi-listen.test.ts - no issues
  • packages/opencode/script/httpapi-exercise.ts - no issues

Fix these issues in Kilo Cloud

Previous review

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • packages/core/src/flag/flag.ts
  • packages/opencode/src/config/config.ts
  • packages/opencode/test/server/httpapi-listen.test.ts

Reviewed by free · Input: 146.1K · Output: 3.9K · Cached: 14.3K

@kilo-code-bot kilo-code-bot 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.

New flag OPENCODE_DISABLE_CONFIG_DEP_INSTALL is added here, but it is undocumented. The sibling escape hatches OPENCODE_DISABLE_PROJECT_CONFIG and OPENCODE_DISABLE_DEFAULT_PLUGINS are listed in packages/core/src/plugin/skill/customize-opencode.md under "Escape hatches", and the CLI/test helpers (packages/opencode/test/lib/cli-process.ts) enumerate the env vars they set. Without documentation, this flag is invisible to operators who want to reproduce the fixture behavior locally, and there is no single source of truth for what it does.

get OPENCODE_DISABLE_PROJECT_CONFIG() {
return truthy("OPENCODE_DISABLE_PROJECT_CONFIG")
},
get OPENCODE_DISABLE_CONFIG_DEP_INSTALL() {

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: New flag OPENCODE_DISABLE_CONFIG_DEP_INSTALL is undocumented. Add it to the "Escape hatches" list in packages/core/src/plugin/skill/customize-opencode.md (next to OPENCODE_DISABLE_DEFAULT_PLUGINS) and note it is for test/CI use only, since production config dependency installs are unchanged by default.

@agenteinstinct1-max
agenteinstinct1-max merged commit 7a03d78 into dev-vibecoded Oct 12, 2026
9 checks passed
agenteinstinct1-max added a commit that referenced this pull request Oct 13, 2026
…meout

Config initialization forks an @opencode-ai/plugin registry install per
config directory, and plugin loading joins those fibers. A stalled
registry could keep waitForDependencies - and instance disposal behind
it - waiting indefinitely (20-minute HttpApi action timeouts near
worktree creation in PRs #264/#265).

- Npm.reify threads an AbortSignal through Arborist -> pacote ->
  npm-registry-fetch -> make-fetch-happen and aborts it when the fiber
  is interrupted, so cancellation reaches in-flight registry work
  instead of orphaning it. The scoped install flock is released while
  unwinding. ignoreScripts stays set, so no child processes are spawned
  that could outlive cancellation.
- config.ts and tui.ts bound the forked installs with Effect.timeout
  (design proposal: 60s, override via
  OPENCODE_CONFIG_DEP_INSTALL_TIMEOUT_MS). On expiry the install fiber
  is interrupted and a warning is logged; failed installs keep the
  existing warning. Warn-and-continue is safe here because plugin
  resolution still installs and reports per-plugin requirements
  (PluginLoader) when plugins actually load.
- Tests: deterministic stalled-registry regressions at both layers
  (core npm-interrupt.test.ts, opencode dep-install.test.ts) covering
  bounded waits, actual fiber/signal cancellation, prompt disposal,
  self-terminating detached fibers, normal successful installs, and
  failed/incomplete install reporting.

Refs #271

Co-authored-by: arena-agent <[email protected]>
agenteinstinct1-max added a commit that referenced this pull request Oct 13, 2026
…meout

Config initialization forks an @opencode-ai/plugin registry install per
config directory, and plugin loading joins those fibers. A stalled
registry could keep waitForDependencies - and instance disposal behind
it - waiting indefinitely (20-minute HttpApi action timeouts near
worktree creation in PRs #264/#265).

- Npm.reify threads an AbortSignal through Arborist -> pacote ->
  npm-registry-fetch -> make-fetch-happen and aborts it when the fiber
  is interrupted, so cancellation reaches in-flight registry work
  instead of orphaning it. The scoped install flock is released while
  unwinding. ignoreScripts stays set, so no child processes are spawned
  that could outlive cancellation.
- config.ts and tui.ts bound the forked installs with Effect.timeout
  (design proposal: 60s, override via
  OPENCODE_CONFIG_DEP_INSTALL_TIMEOUT_MS). On expiry the install fiber
  is interrupted and a warning is logged; failed installs keep the
  existing warning. Warn-and-continue is safe here because plugin
  resolution still installs and reports per-plugin requirements
  (PluginLoader) when plugins actually load.
- Tests: deterministic stalled-registry regressions at both layers
  (core npm-interrupt.test.ts, opencode dep-install.test.ts) covering
  bounded waits, actual fiber/signal cancellation, prompt disposal,
  self-terminating detached fibers, normal successful installs, and
  failed/incomplete install reporting.

Refs #271

Co-authored-by: arena-agent <[email protected]>
agenteinstinct1-max added a commit that referenced this pull request Oct 13, 2026
…meout

Config initialization forks an @opencode-ai/plugin registry install per
config directory, and plugin loading joins those fibers. A stalled
registry could keep waitForDependencies - and instance disposal behind
it - waiting indefinitely (20-minute HttpApi action timeouts near
worktree creation in PRs #264/#265).

- Npm.reify threads an AbortSignal through Arborist -> pacote ->
  npm-registry-fetch -> make-fetch-happen and aborts it when the fiber
  is interrupted, so cancellation reaches in-flight registry work
  instead of orphaning it. The scoped install flock is released while
  unwinding. ignoreScripts stays set, so no child processes are spawned
  that could outlive cancellation.
- config.ts and tui.ts bound the forked installs with Effect.timeout
  (design proposal: 60s, override via
  OPENCODE_CONFIG_DEP_INSTALL_TIMEOUT_MS). On expiry the install fiber
  is interrupted and a warning is logged; failed installs keep the
  existing warning. Warn-and-continue is safe here because plugin
  resolution still installs and reports per-plugin requirements
  (PluginLoader) when plugins actually load.
- Tests: deterministic stalled-registry regressions at both layers
  (core npm-interrupt.test.ts, opencode dep-install.test.ts) covering
  bounded waits, actual fiber/signal cancellation, prompt disposal,
  self-terminating detached fibers, normal successful installs, and
  failed/incomplete install reporting.

Refs #271

Co-authored-by: arena-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HttpApi plugin reuse test depends on a real registry install

1 participant