Skip to content

fix(core): break filesystem search import cycle - #49683

Open
joe-ieta wants to merge 1 commit into
anomalyco:devfrom
joe-ieta:filesystem-search-cycle
Open

joe-ieta wants to merge 1 commit into
anomalyco:devfrom
joe-ieta:filesystem-search-cycle

Conversation

@joe-ieta

@joe-ieta joe-ieta commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #49685

Type of change

  • Bug fix

What does this PR do?

packages/core/src/filesystem/search.ts imported the FileSystem self-namespace from ../filesystem to call Entry.make / Match.make, creating a runtime import cycle between filesystem.ts and filesystem/search.ts. In compiled builds that cycle can leave FileSystemSearch.node undefined while filesystem.ts builds its layer node, so booting a location crashes with TypeError: undefined is not an object (evaluating 'node.name') on the first prompt. Source mode happened to work because of ESM live bindings.

The fix imports Entry / Match directly from @opencode-ai/schema/filesystem and makes FileSystem a type-only import, removing the runtime cycle. Same values, no behavior change.

How did you verify your code works?

  • bun run --cwd packages/core typecheck
  • Compiled the server (bun run --cwd packages/opencode script/build.ts --single), ran serve, sent a prompt:
    • before: session.error with the node.name TypeError, assistant message never completes
    • after: assistant message completes with finish: "stop" and streams normally
  • Re-ran the full flow against a real OpenAI-compatible provider

Screenshots / recordings

Not a UI change.

Checklist

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

@github-actions

Copy link
Copy Markdown
Contributor

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 github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

This branch has not been deployed

No deployments
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.

Compiled builds crash on first prompt: undefined layer node from filesystem search import cycle

1 participant