Repository navigation
fix(core): keep commands whose model is not provider/model - #52195
simonether wants to merge 1 commit into
Conversation
A command file with a model like `opus` failed to decode and was dropped without a log. Now the invalid model is ignored with a warning, so the command loads and uses the default model.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #52065
Type of change
What does this PR do?
A command
.mdfile with a model that isn'tprovider/modelin its frontmatter (for examplemodel: opus) was dropped without any log.decode()inconfig/plugin/command.tsvalidated all of the frontmatter with one schema, so a badmodelmade the whole decode fail and the command never showed up.Now the loader checks
modelon its own first. If it isn't a validprovider/modelreference, it logs a warning with the file path and the value, drops the field, and loads the command without a model override, so it runs on the session's model (or the command agent's, if it sets one), as the issue suggests. Invalid values in other fields behave as before.How did you verify your code works?
Added a test to
packages/core/test/config/command.test.tsthat loads a realcommands/hello.mdwithmodel: opus. It checks that the command is listed, runs without switching the model, and logs one warning naming the file andopus. Without the fix it fails because the command list is empty.In
packages/core,bun run test test/config/passes (209 tests), and typecheck, prettier and oxlint are clean. I ran this on Linux arm64 and didn't try it in the TUI.Screenshots / recordings
Not a UI change.
Checklist