Skip to content

fix(opencode): skip eager import for disabled local tools#22114

Open
Astro-Han wants to merge 1 commit intoanomalyco:devfrom
Astro-Han:fix/disabled-tool-import
Open

fix(opencode): skip eager import for disabled local tools#22114
Astro-Han wants to merge 1 commit intoanomalyco:devfrom
Astro-Han:fix/disabled-tool-import

Conversation

@Astro-Han
Copy link
Copy Markdown

Issue for this PR

Closes #22061

Type of change

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

What does this PR do?

Prevents eager import of disabled repo-local custom tools for the documented local tool shapes.

The change adds a cheap pre-scan in the custom tool registry so OpenCode can skip importing a local tool file when every documented tool ID from that file is already disabled by config. It covers the documented local patterns (export default, direct export const/function) and also respects top-level permission denies.

This keeps the fix narrow to #22061 and avoids changing unrelated dependency install behavior.

How did you verify your code works?

  • Ran cd packages/opencode && bun test test/tool/registry.test.ts
  • Ran cd packages/opencode && bun typecheck
  • Added regression coverage for:
    • disabled default-export local tools
    • disabled direct named-export local tools
    • top-level permission denies

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Astro-Han Astro-Han force-pushed the fix/disabled-tool-import branch from 9cb09ce to a24f997 Compare April 12, 2026 05:12
@Astro-Han
Copy link
Copy Markdown
Author

The failing e2e checks do not appear to be caused by this PR. I compared this run with recent dev runs and saw the same timeout pattern on both Linux and Windows there as well. In both cases, the job hangs in packages/apps test:e2e:local flow after the seed-e2e.ts phase, before the app server and Playwright start.

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.

Disabled project-local custom tools can crash startup when .opencode deps are missing

1 participant