Repository navigation
feat(sdk): add ConfigProvider seam to embedded OpenCode hosts - #34920
Closed
kitlangton wants to merge 2 commits into
Closed
kitlangton wants to merge 2 commits into
kitlangton wants to merge 2 commits into
Conversation
kitlangton
force-pushed
the
embedded-config-seam
branch
from
July 2, 2026 13:21
30abf2d to
74fea69
Compare
kitlangton
force-pushed
the
embedded-config-seam
branch
from
July 2, 2026 13:37
74fea69 to
dd80b72
Compare
Contributor
Author
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.
Stacked on #34846. Follow-up to the sharp edge noted there: the default
ConfigProvider.fromEnv()snapshots the process environment on first use, so runtime env mutation cannot steer later layer builds — and embeddedOpenCode.create()had no way to inject a provider.What changed
packages/sdk-next/src/opencode.tsOpenCode.create(options?)accepts an optionalconfigProvider. When present, it is built once into aConfigProvider.layerand provided to both the application-node build and the embedded routes layer, so config reads during that host's layer builds — for exampleOPENCODE_DBdatabase placement — resolve against it.LocationServiceMapif a real need appears.ConfigProvider.orElse(ConfigProvider.fromEnv()).OpenCode.layerWith(options)mirrorscreate(options)for the layer form (naming follows core'sGlobal.layerWith);layeris nowlayerWith({}).packages/sdk-next/test/embedded.test.tsprocess.env.OPENCODE_DBworkaround from refactor(core): resolve database and websearch config through Effect Config #34846. Each embedded host now gets its own database through the seam:OpenCode.create({ configProvider: ConfigProvider.fromUnknown({ OPENCODE_DB: ... }) }).Review notes
Layer.providewraps without rewriting inner layer identities, and both builds inside onecreate()share one memoMap and one provider, so memoized leaves stay consistent.packages/server/src/routes.tswebHandler()builds a fresh memoMap — and therefore a fresh database — per call. It has no production consumers today; worth deleting or memoizing separately.Verification
bun typecheckinpackages/sdk-nextpackages/sdk-nextsuite: 5 pass / 0 fail