Repository navigation
fix(core): respect OPENCODE_CONFIG and OPENCODE_CONFIG_CONTENT in serve/web - #23318
Closed
brian-dlee wants to merge 2 commits into
Closed
brian-dlee wants to merge 2 commits into
brian-dlee wants to merge 2 commits into
Conversation
brian-dlee
force-pushed
the
fix/serve-respects-opencode-config
branch
from
April 18, 2026 16:43
7520e61 to
3219607
Compare
brian-dlee
marked this pull request as ready for review
April 18, 2026 16:52
brian-dlee
force-pushed
the
fix/serve-respects-opencode-config
branch
3 times, most recently
from
April 22, 2026 14:45
eef8d5e to
5f13ece
Compare
brian-dlee
force-pushed
the
fix/serve-respects-opencode-config
branch
2 times, most recently
from
April 29, 2026 15:42
28e1c7b to
1347535
Compare
brian-dlee
force-pushed
the
fix/serve-respects-opencode-config
branch
from
May 11, 2026 19:53
1347535 to
f0f6242
Compare
brian-dlee
force-pushed
the
fix/serve-respects-opencode-config
branch
3 times, most recently
from
May 26, 2026 21:17
d4590b2 to
060dbc0
Compare
This was referenced Jun 30, 2026
brian-dlee
force-pushed
the
fix/serve-respects-opencode-config
branch
from
July 21, 2026 03:40
060dbc0 to
621d70c
Compare
brian-dlee
force-pushed
the
fix/serve-respects-opencode-config
branch
from
August 9, 2026 07:11
621d70c to
740642a
Compare
…ve/web commands opencode serve and opencode web only loaded the global config, completely ignoring the OPENCODE_CONFIG and OPENCODE_CONFIG_CONTENT environment variables. This adds getGlobalWithOverrides() to the Config service which merges the global config with those two env-var sources (in the same order as the full instance config chain), and uses it in resolveNetworkOptions() so that serve and web honor user-level config overrides. Closes anomalyco#19078
brian-dlee
force-pushed
the
fix/serve-respects-opencode-config
branch
from
August 22, 2026 18:33
740642a to
4cd6c9c
Compare
3 of 6 tasks
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
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 #19078
Type of change
What does this PR do?
opencode serveandopencode webcallresolveNetworkOptions(), which only loaded the global config viacfg.getGlobal(). This completely ignored theOPENCODE_CONFIGandOPENCODE_CONFIG_CONTENTenvironment variables, despite those being explicitly designed as global-scope config augmentation mechanisms.The fix adds a new
getGlobalWithOverrides()method to theConfigservice that:getGlobal())OPENCODE_CONFIGfile on top if setOPENCODE_CONFIG_CONTENTinline JSON on top if setThe merge order matches the existing order in
loadInstanceState. BothFlag.OPENCODE_CONFIGandOPENCODE_CONFIG_CONTENTare read at effect-execution time (not module load) so the cache invalidates correctly. The cache is invalidated viainvalidateGlobalWithOverridesinside the existinginvalidate()method, matching the same lifecycle ascachedGlobal.resolveNetworkOptions()is updated to callgetGlobalWithOverrides()instead ofgetGlobal(). Since bothserveandwebgo through this function, both are fixed.How did you verify your code works?
Added 3 new tests in
test/config/config.test.tsunder agetGlobalWithOverridesdescribe block:OPENCODE_CONFIGmerges on top of global (additive — fields not in the override are preserved from global)OPENCODE_CONFIG_CONTENTmerges on top of both global andOPENCODE_CONFIGAll 3 pass. The one pre-existing failure (
permission config preserves key order) is unrelated and present ondev.Checklist
Note: This is my first contribution to this project and I did use AI to help me investigate the issue, the code structure in this area and craft the fix. I spent time manually reviewing the code and the proposed solution before submitting.