Repository navigation
fix(ai): resolve opencodeModel "inherit" in profile cleanup - #508
Merged
Merged
Conversation
ptitan
force-pushed
the
fix/ai-cleanup-inherit
branch
from
November 17, 2026 15:12
3e730b1 to
41f03d9
Compare
Profile cleanup passed the configured model verbatim to session.prompt, so `opencodeModel: "inherit"` reached OpenCode as a literal model id and failed with `Generate.ModelNotFoundError: Model not found: <provider>/inherit`. Auto-capture is unaffected because it resolves "inherit" from the prompt record; cleanup has no prompt of its own. Resolve the model with resolveOpencodeModelRef before creating the transient session, so an unresolvable "inherit" fails with an explicit message and no session is created. Drop the unreachable hardcoded fallbacks (bs-aigw / deepseek-v4-flash): callAICleanup only takes this path when both settings are configured.
ptitan
force-pushed
the
fix/ai-cleanup-inherit
branch
from
November 17, 2026 15:23
41f03d9 to
06d73ce
Compare
Use the existing loader instead of a direct dynamic import, and extend the cleanup test mock so resolveOpencodeModelRef still comes from the real opencode-provider module.
3 tasks done
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
With
opencodeModel: "inherit", the AI profile cleanup fails every time:callViaOpencodeWithClientpassedCONFIG.opencodeModelverbatim tosession.prompt. Auto-capture is unaffected because it resolves"inherit"from the model recorded on the prompt; cleanup runs outside any prompt.Changes in
src/services/user-profile/ai-cleanup.ts:resolveOpencodeModelRef(session model reported bychat.params, then OpenCode's recent model list) beforesession.create, so an unresolvable"inherit"fails with the helper's explicit error and no transient session is created.bs-aigw/deepseek-v4-flash:callAICleanuponly takes this path when bothopencodeProviderandopencodeModelare set.Configurations with an explicit model behave exactly as before.
Test plan
tests/ai-cleanup.test.ts, both failing onmainand passing with this change"inherit"is resolved from the recent model list and that model is sent tosession.prompt"inherit"with nothing to resolve returns the explicit error and never promptsmodel.jsonon v1 hosts); on a fresh host with no chat yet, cleanup now fails with an explicit message rather than a provider errorChecklist
main(do not open PRs from commits already onmain)bun testpasses (or N/A) — one unrelated failure,config > CONFIG defaults > should keep the local embedding model loaded by default, which reads the local user config and fails identically onmainbun run typecheckpasses (or N/A)bun run checkpasses (format + lint + typecheck; or N/A)