Fix OpenCode Bedrock provider regression#18
Open
the-data-sherpa wants to merge 1 commit into
Open
Conversation
In v0.0.7 the OpenCode config writer started emitting the selected Aperture provider ID for every backend. That changed Bedrock from the built-in OpenCode provider ID used in v0.0.6 (amazon-bedrock) to a generic custom provider entry. OpenCode wires its Bedrock-specific handling to the built-in amazon-bedrock provider ID. When aperture-cli stopped using that ID, Bedrock launches no longer followed the same path as v0.0.6 and requests could fail with invalid security token errors when using OpenCode through Aperture. Restore the built-in amazon-bedrock provider ID for Bedrock configs only, keep the model names aligned with that provider, and update the OpenCode config test coverage to assert the provider ID and model naming behavior explicitly. Verified with go test ./internal/clients/opencode.
Author
|
Reviewer note: local repro / validation steps used on our side.
Observed on unpatched
Observed with this patch:
Focused automated check run locally:
|
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
Restore OpenCode's built-in Bedrock provider path when aperture-cli generates an OpenCode config.
Problem
This regressed in
v0.0.7.Before the refactor,
v0.0.6wrote Bedrock configs for OpenCode under the built-in provider IDamazon-bedrock. OpenCode has Bedrock-specific handling wired to that provider ID.In
v0.0.7, the OpenCode config writer was generalized to emit the selected Aperture provider ID for every backend. That changed Bedrock from the built-in OpenCode provider path to a generic custom provider entry.For us, that meant Bedrock launches through Aperture + OpenCode no longer followed the same code path as
v0.0.6, and requests started failing with errors like:The security token included in the request is invalid.Root Cause
OpenCode keys its Bedrock-specific behavior off the built-in provider ID
amazon-bedrock.By switching the generated config to use the selected Aperture provider ID instead,
v0.0.7stopped using OpenCode's Bedrock-aware path and treated the config as a generic custom provider.Fix
For Bedrock only:
amazon-bedrockAll other backends continue to use the selected Aperture provider ID as before.
Why This Is Narrow
This change only affects providers that advertise Bedrock compatibility (
bedrock_model_invokeorbedrock_converse). The generated config for Anthropic, OpenAI-compatible, Vertex, Gemini, and other backends is unchanged.Validation
go test ./internal/clients/opencodev0.0.7failure path and confirming the Bedrock/OpenCode flow works again after this change