Skip to content

fix(opencode): ignore node_modules during config and skill discovery - #30847

Closed
ulises-jeremias wants to merge 4 commits into
anomalyco:devfrom
ulises-jeremias:fix/opencode-ignore-node-modules-scan
Closed

ulises-jeremias wants to merge 4 commits into
anomalyco:devfrom
ulises-jeremias:fix/opencode-ignore-node-modules-scan

Conversation

@ulises-jeremias

@ulises-jeremias ulises-jeremias commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #30337

Type of change

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

What does this PR do?

Fixes startup slowdowns/hangs caused by recursively scanning .opencode/node_modules during config and skill discovery.

Root cause

Discovery paths under .opencode/ used recursive glob patterns and did not exclude node_modules. After dependency install creates .opencode/node_modules, startup discovery traversed large dependency trees.

Changes

  • packages/core/src/util/glob.ts
    • add ignore?: string | string[] support to Glob.Options
    • forward ignore patterns to underlying glob engine
  • Apply ignore: ["**/node_modules/**"] to discovery scans in:
    • packages/opencode/src/config/agent.ts
    • packages/opencode/src/config/command.ts
    • packages/opencode/src/config/plugin.ts
    • packages/opencode/src/skill/index.ts

Regression tests

  • packages/opencode/test/util/glob.test.ts
    • add supports ignore patterns
  • packages/opencode/test/config/config.test.ts
    • add ignores markdown files under .opencode/node_modules during config discovery
  • packages/opencode/test/skill/skill.test.ts
    • add ignores skills under .opencode/node_modules

How did you verify your code works?

  • bun i at repo root
  • bun test test/util/glob.test.ts (from packages/opencode) ✅
  • bun test test/config/config.test.ts (from packages/opencode) ✅
  • bun test test/config/config.test.ts -t "ignores markdown files under .opencode/node_modules during config discovery" ✅

Screenshots / recordings

Not included.

Checklist

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

@ulises-jeremias

Copy link
Copy Markdown
Contributor Author

Self-review summary:

Potential follow-up (optional):

  • Extend ignore support usage in other startup-sensitive recursive scans if similar patterns appear.

@ulises-jeremias

Copy link
Copy Markdown
Contributor Author

Quick validation update after collaborator feedback:

  • I ran bun i at repo root.
  • Re-ran test coverage for this PR branch:
    • bun test test/util/glob.test.ts (from packages/opencode) ✅ passing

Also found a separate issue in the added config test placement (it.instance(...) accidentally nested inside another test(...) block), which causes a bun runtime failure in test/config/config.test.ts. I’ll send a follow-up commit moving that test to top-level scope.

* upstream/dev: (662 commits)
  chore: update nix node_modules hashes
  feat(oauth): unify OAuth callback browser pages (anomalyco#34025)
  chore: generate
  refactor(app): replace tab drag handling with dndkit (anomalyco#33880)
  refactor(app): use dropdown for project selector (anomalyco#33984)
  chore: update nix node_modules hashes
  fix(app): bump ghostty-web to prevent terminal resize hangs (anomalyco#34020)
  chore: generate
  feat(sdk): expose active sessions (anomalyco#33991)
  fix(sdk): wake embedded session execution (anomalyco#33992)
  refactor(opencode): stop legacy v2 event emission (anomalyco#33993)
  fix(ui): normalize tooltip trigger layout (anomalyco#33979)
  fix(app): suspend hidden terminal renderer (anomalyco#33990)
  fix(app): enable auto-accept in session settings (anomalyco#33974)
  tweak: hide MCP access token prefix (anomalyco#33711)
  fix(core): refine small model defaults (anomalyco#33926)
  feat(core): split MCP timeout configuration (anomalyco#33977)
  fix(app): simplify question prompt (anomalyco#33968)
  feat(llm): pass strict through tool definitions for Codex parity (anomalyco#33392)
  chore: generate
  ...
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

.opencode/node_modules/ causes startup hang — scanner doesn't skip node_modules despite .gitignore

1 participant