fix(extensions): align OpenCode local source ordering - #1866
Open
limityan wants to merge 1 commit into
Open
Conversation
limityan
marked this pull request as ready for review
July 29, 2026 17:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ConfigPaths.directoriesorder, physical-path alias handling, and creation-safe watch rootsOPENCODE_CONFIG_DIRis set, while keeping the explicit source workspace-localProblem
OpenCode loads project config files root-to-opened, but processes project
.opencodedirectories opened-to-root and keeps the first physical directory whenConfigPaths.directoriescontains aliases. The existing Command path encoded most of that behavior, while Subagent and MCP could select the opposite nested winner. MCP environment options also treatedOPENCODE_CONFIG_DIRas a replacement for the normal XDG/legacy roots.That mismatch could select a different Agent prompt or MCP endpoint from OpenCode in nested monorepos, and could leave inconsistent source labels and watch coverage across the three active providers.
Scope and boundaries
This PR keeps the existing provider and
ExternalSourceControlPlaneownership model. The new ordering types are crate-private. It does not add a public source graph, cache, coordinator, protocol, UI, remote/organization/MDM sources, package installation, Hook execution, Workspace Instructions, Skill sources, or Plugin Runtime behavior/dependencies.Compatibility is pinned to OpenCode v1.18.9, commit
4da7bb44c84e013fa53e9c5d02ac753d1435c81a.Validation
cargo check --workspacecargo test -p bitfun-opencode-adaptercargo test -p bitfun-core opencode_local_source_order_tests --libnode scripts/check-core-boundaries.mjspnpm run check:repo-hygienegit diff gcwing/main...HEAD --checkThe clean worktree check used the same empty
src/mobile-web/distdirectory prerequisite as the Rust CI job; no generated artifact is committed.Adversarial review
An isolated review found one P1 in the first implementation: post-expansion last-wins deduplication moved aliased explicit directories to the end, unlike OpenCode's first-wins
unique. A failing three-provider control-plane test reproduced it for both XDG-root and nested.opencodealiases. The private resolver was corrected to preserve the first physical position while applying explicit scope/loading semantics there. Focused tests and a second isolated review then passed with no remaining P0-P2 findings.Development note: AI-assisted; all validation listed above was run locally on the rebased commit.