fix(session): prevent silent failure when small_model is invalid#14854
Closed
zerone0x wants to merge 1 commit intoanomalyco:devfrom
Closed
fix(session): prevent silent failure when small_model is invalid#14854zerone0x wants to merge 1 commit intoanomalyco:devfrom
zerone0x wants to merge 1 commit intoanomalyco:devfrom
Conversation
When small_model is configured to an invalid model ID, ensureTitle() throws ProviderModelNotFoundError. This was an unhandled rejection because the call site didn't await or catch errors. Two changes: 1. Wrap ensureTitle() call with void + .catch() so errors are logged instead of becoming unhandled rejections. 2. In getSmallModel(), catch ModelNotFoundError when small_model config is invalid, log a warning, and fall back to heuristic model selection rather than throwing. Fixes anomalyco#14807 Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
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 #14807
Type of change
What does this PR do?
When
small_modelis set to an invalid model ID in config, session auto-title generation fails silently: the session keeps its default timestamp name and only an unhandled rejection appears in logs.Root causes:
ensureTitle()at the call site was not awaited and had no.catch()— any throw became an unhandled rejection.getSmallModel()forwardedModelNotFoundErrordirectly when the configuredsmall_modelwas invalid, with no fallback.Changes:
ensureTitle()call withvoid+.catch()so errors are logged rather than silently lost.getSmallModel(), catchModelNotFoundErrorwhensmall_modelis misconfigured, log a warning, then fall back to heuristic model selection (same logic as whensmall_modelis not set).How did you verify your code works?
Traced the call path in
packages/opencode/src/session/prompt.tsandpackages/opencode/src/provider/provider.ts. The existinggetModel()function already usesModelNotFoundErrorbefore it's declared in the same namespace, so the same pattern applies here.Screenshots / recordings
N/A — no UI change.
Checklist