fix(opencode): skip invalid agent config files instead of crashing startup#31992
Open
NumerousJLs wants to merge 1 commit into
Open
fix(opencode): skip invalid agent config files instead of crashing startup#31992NumerousJLs wants to merge 1 commit into
NumerousJLs wants to merge 1 commit into
Conversation
…artup load() validated each agent file with ConfigParse.schema(), which throws on a schema mismatch. A single invalid file (e.g. a Cursor-format agent with a YAML-array tools field) aborted the whole loop, so no agents loaded and startup failed with "4 of 5 requests failed". loadMode() already skipped invalid files via Exit.isSuccess, but silently (anomalyco#27133). Both functions now skip an invalid file with a warning naming it, so one bad file no longer takes down the rest and the user can see why a file was dropped. Closes anomalyco#31481 Closes anomalyco#27133
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found two related PRs that address similar issues: Related PRs:
These PRs appear to be attempting to solve the same problem that PR #31992 addresses. You should verify whether these earlier PRs were merged, closed, or abandoned, and confirm that #31992 is not a duplicate effort of #29784 in particular, which has an almost identical title and purpose. |
NumerousJLs
added a commit
to NumerousJLs/su26-ai301-contribution
that referenced
this pull request
Jun 12, 2026
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 #31481
Closes #27133
Type of change
What does this PR do?
Skips an invalid agent or mode config file instead of crashing startup or dropping it without an explanation.
Before this change,
load()validated each agent file withConfigParse.schema(), which throws whenever a file does not match the schema. A single malformed file, such as a Cursor-format agent wheretoolsis a YAML array instead of an object, would throw partway through the loop, so none of the agents loaded and startup failed with "4 of 5 requests failed". TheloadMode()function right next to it already skipped invalid files, but it did so silently, so a broken mode would just disappear with no explanation (#27133).This switches both functions to decode with
Schema.decodeUnknownExitand skip an invalid file with a warning that names it, instead of throwing or dropping it silently. Valid agents and modes still load normally. I leftConfigParse.schema()itself unchanged, since throwing is the right behavior for a single config file likeopencode.json.How did you verify your code works?
bun typecheck(clean)oxlint(0 warnings, 0 errors)git diff --check(clean)bun test test/config test/agent(233 pass, 3 skip, 0 fail)test/config/agent.test.tswith a valid + invalid file; it throws on the current code and passes after the fixScreenshots / recordings
N/A
Checklist