Skip to content

fix: avoid unnecessary project plugin dependencies - #13300

Merged
johnnyeric merged 3 commits into
Kilo-Org:mainfrom
mvanhorn:fix/12778-avoid-project-plugin-dependencies
Aug 24, 2026
Merged

fix: avoid unnecessary project plugin dependencies#13300
johnnyeric merged 3 commits into
Kilo-Org:mainfrom
mvanhorn:fix/12778-avoid-project-plugin-dependencies

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Context

Adjust the config-directory loading loop in packages/opencode/src/config/config.ts so dependency installation is scheduled only after the directory's config files and auto-discovered plugins have been inspected, and only when that directory contributes a file-based plugin that needs the local @kilocode/plugin runtime/types. Preserve the existing detached install fiber, warning behavior, and waitForDependencies wiring for directories that do require the dependency; npm package plugins continue to resolve through the shared package cache, while built-in plugins must not trigger a project-local install. Add focused Kilo regression coverage in packages/opencode/test/kilocode/config/config.test.ts that observes the real config-loading decision for plugin-free and plugin-bearing directories without introducing a production helper used only by tests.

Fixes #12778

Implementation

Not applicable to this change.

Screenshots

before after

How to Test

Not applicable to this change.

Get in Touch

Not applicable to this change.

AI was used for assistance.

@kilo-code-bot

kilo-code-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/opencode/src/config/config.ts 794 Global config file plugins are not inspected before skipping install
Files Reviewed (3 files)
  • packages/opencode/src/config/config.ts - 1 issue
  • packages/opencode/src/kilocode/config/plugin-deps.ts - 0 issues
  • packages/opencode/test/kilocode/config/config.test.ts - 0 issues

Fix these issues in Kilo Cloud

Previous Review Summary (commit 4ff1cbb)

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

Previous review (commit 4ff1cbb)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/opencode/src/config/config.ts 793 Global config file plugins are not inspected before skipping install
Files Reviewed (3 files)
  • .changeset/quiet-project-plugin-dependencies.md - 0 issues
  • packages/opencode/src/config/config.ts - 1 issue
  • packages/opencode/test/kilocode/config/config.test.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 116.3K · Output: 19.1K · Cached: 948.9K

Review guidance: REVIEW.md from base branch main

// kilocode_change - Auto-discovered plugins under config directories are already local files, so ConfigPlugin.load
// returns normalized Specs and we only need to attach origin metadata here.
const list = yield* Effect.promise(() => ConfigPlugin.load(dir))
plugins.push(...list) // kilocode_change

@johnnyeric johnnyeric Aug 21, 2026

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.

The comment is not necessarily to the line i commented but more towards the entire file.

Would be great if we can extract parts of this code in upstream path into a kilo owned path (to minimize upstream conflicts on merge). Could you check if this can be ported into a helper at packages/opencode/src/kilocode/config/plugin-deps.ts for example, then changes in this file reduce and you can have a minimal call to the helper. It's good that tests are already in kilo path. Can you address that?

Comment thread packages/opencode/test/kilocode/config/config.test.ts Outdated
zipRight, Effect.fork and Fiber.poll are gone in effect 4.0.0-beta.83, so
typecheck failed on this file. Uses andThen, forkChild and a bounded join.
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Pushed 10ad635 to fix typecheck.

config.test.ts was still on the Effect 3 API. Under effect@4.0.0-beta.83 the compiler reported Property 'zipRight' does not exist, Property 'fork' does not exist, and Fiber.poll is gone as well, which also produced the Effect<..., unknown> vs Effect<..., never> mismatches on the surrounding lines.

Moved to the v4 equivalents: Effect.andThen in place of Effect.zipRight, Effect.forkChild in place of Effect.fork, and a bounded Fiber.join(...).pipe(Effect.timeoutOption("10 millis")) in place of Effect.yieldNow + Fiber.poll. The assertion is unchanged, since the install gate keeps the fiber pending until gate.resolve(), so the timeout still observes a None.

bun run typecheck goes from exit 2 to exit 0, and the five "project plugin dependencies" tests are green.

@johnnyeric

Copy link
Copy Markdown
Contributor

thanks for addressing the comment @mvanhorn. Can you take a look at the other comment I posted too?

Per review, extract the local plugin dependency install out of the upstream
config.ts and into packages/opencode/src/kilocode/config/plugin-deps.ts so the
upstream file keeps a minimal call and future merges have less to conflict on.

needsLocalPluginDependency owns the file:// specifier test and
installLocalPluginDependency owns the npm install effect, taking the npm
service, dir, version and local flag as parameters. Behavior is unchanged: the
plugins accumulator still collects both the file-loaded specs and the
ConfigPlugin.load results before the check, and the resulting fiber is still
pushed onto deps.
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Done in 738577d.

Added packages/opencode/src/kilocode/config/plugin-deps.ts with two exports: needsLocalPluginDependency(plugins) owns the file:// specifier test, and installLocalPluginDependency(npm, dir, version, local) owns the npm install effect, taking the service, dir, version and local flag as parameters so it carries no globals.

The upstream file drops from 23 lines to 5:

// kilocode_change start
if (needsLocalPluginDependency(plugins)) {
  deps.push(yield* installLocalPluginDependency(npmSvc, dir, InstallationVersion, InstallationLocal))
}
// kilocode_change end

That also let the Exit import go from config.ts, since the only use moved with it.

Behaviour is unchanged: the plugins accumulator still collects the file-loaded specs and the ConfigPlugin.load(dir) results before the check runs, and the fiber still lands on deps.

tsgo --noEmit is clean and the 50 tests in test/kilocode/config/config.test.ts pass, so they did not need touching.

The zipRight point was already handled on the previous head, so this push is just the extraction.

@johnnyeric
johnnyeric merged commit c0cc714 into Kilo-Org:main Aug 24, 2026
32 checks passed
@johnnyeric

Copy link
Copy Markdown
Contributor

Thanks for addressing the comments! merged.

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.

50 MB+ .kilo/node_modules directory created in each project

2 participants