-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Description
Description
The test tool.registry > loads tools with external dependencies without crashing introduced in #12227 (556adad67) fails deterministically on CI:
error: Cannot find package 'cowsay' from '/tmp/opencode-test-xxx/.opencode/tools/cowsay.ts'
(fail) tool.registry > loads tools with external dependencies without crashing [269.71ms]
This blocks all PRs targeting dev — the test (linux) check fails with 881 pass / 1 fail.
Root cause
Two issues:
-
No error handling in
ToolRegistry.state()—await import(match)on line 44 ofregistry.tsthrows when a custom tool has unresolvable dependencies, crashing the entire registry initialization instead of gracefully skipping the broken tool. -
Test expects successful load without installing deps — the test creates a
package.jsonwithcowsaydependency but the dependency is never installed in the temp directory.Config.waitForDependencies()doesn't trigger the install in the test context. The test then assertsexpect(ids).toContain("cowsay")which fails because the import throws.
Impact
Every PR targeting dev fails the test (linux) CI check. This started after #12227 was merged.
Suggested fix
- Wrap the
import(match)inregistry.tswith try/catch — log a warning and skip tools that fail to import - Update the test expectation to
not.toContain("cowsay")since the test name says "without crashing" (testing resilience, not successful loading)
PR with fix: incoming