fix(opencode): project .opencode/ config now overrides global ~/.opencode#25121
Open
bainos wants to merge 1 commit intoanomalyco:devfrom
Open
fix(opencode): project .opencode/ config now overrides global ~/.opencode#25121bainos wants to merge 1 commit intoanomalyco:devfrom
bainos wants to merge 1 commit intoanomalyco:devfrom
Conversation
Global ~/.opencode was processed after project-local .opencode directories in the unique() array, causing global agent/model config to always override project-level overrides. Swap order so ~/.opencode is deduplicated early and project dirs are last (and win). Fixes: anomalyco#19296 Fixes: anomalyco#21307
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found a potentially related PR that addresses similar configuration precedence concerns: Related PR:
The current PR (#25121) is the main result in most searches, indicating it's the primary fix for this issue. PR #21405 might be a previous attempt or related work on the same problem that could be worth reviewing to ensure there's no duplication of effort. |
e94abf0 to
e7cd72f
Compare
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.
Issue for this PR
Closes #19296
Closes #21307
Type of change
What does this PR do?
ConfigPaths.directories() appended ~/.opencode after the project walk results,
so the global config was always merged last and always won. Swapped the two
afs.up() spreads so ~/.opencode comes first. unique() then deduplicates it
from the walk, leaving the project dir last so it wins.
How did you verify your code works?
Set model X in ~/.opencode/agent/build.md and model Y in
project/.opencode/agent/build.md. Before: X was always used. After: Y is used.
Screenshots / recordings
N/A — no UI changes.
Checklist