restrict amazon-bedrock provider to curated model allowlist#15
Open
lgarceau768 wants to merge 3 commits intoflexfrom
Open
restrict amazon-bedrock provider to curated model allowlist#15lgarceau768 wants to merge 3 commits intoflexfrom
lgarceau768 wants to merge 3 commits intoflexfrom
Conversation
Adds a hardcoded BEDROCK_ALLOWED_MODELS Set in the provider initialization loop that filters the amazon-bedrock provider down to 30 approved models across Claude, Gemma, GPT Safeguard, Nova 2 Lite, Qwen, Nemotron, Mistral, DeepSeek, Minimax, Kimi, GLM, Palmyra, and Llama families. The allowlist runs before the existing config blacklist/whitelist check, so users can still override via config (e.g. to add a custom Bedrock fine-tune).
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
The allowlist check was incorrectly deleting models that users explicitly added via config (provider["amazon-bedrock"].models). Add a guard so the filter only applies to snapshot-sourced models, not ones the user has explicitly defined in their opencode.json.
Fast-exiting commands (e.g. echo test) could produce (no output) because Effect.forkScoped interrupted the stream consumer fiber before it had a chance to process chunks buffered in the Node.js readable pipe. Fix by joining the fiber after the exit/abort/timeout race so all buffered stdout/stderr is flushed into the accumulator list before Effect.scoped disposes the scope.
Collaborator
Author
|
Rebuilt, tested locally and confirmed only the models within the model document - also FlexChat - are shown here. |
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 #
Type of change
What does this PR do?
Adds a hardcoded
BEDROCK_ALLOWED_MODELSset inpackages/opencode/src/provider/provider.tsthat restricts theamazon-bedrockprovider to a curated list of 30 approved models. The filter runs inside the existing provider initialization loop, immediately after thedeprecatedstatus check and before the configblacklist/whitelistcheck.Approved models by family:
Because the built-in allowlist runs before the config-level
whitelist/blacklist, users can still add custom models (e.g. a Bedrock fine-tune) via their opencode config without being blocked.How did you verify your code works?
bun typecheckinpackages/opencode— passes clean.models-snapshot.jsto confirm each entry exists and maps to the expected model.Screenshots / recordings
N/A — no UI change.
Checklist