Repository navigation
fix(core): ignore unsupported agent colors - #57910
Conversation
Co-authored-by: 4sDriven <131897363+4sDriven@users.noreply.github.com>
There was a problem hiding this comment.
Looks good. I ran the #54057 reproduction from source on both checkouts. On the base, agents with color: accent / warning / success, and the one with color: warning plus a v2 permissions array, were silently missing from debug agents. With this PR, all of them load with the default color. Hex-color and legacy-path agents behave the same as before. The legacy path still maps theme names to #aaaaaa, which #54257 addresses. bun test test/config (249 pass) and the typechecks in packages/core and packages/schema pass.
Public API: unchanged. The published config schema still requires a six-digit hex color; only decoding is more lenient.
One trade-off to be aware of, not blocking: an invalid agents.<name>.color in opencode.json used to produce a config diagnostic, and it is now dropped silently. A typo such as #fff now gives no feedback outside editor JSON-schema validation.
Issue for this PR
Fixes #54057
Type of change
What does this PR do?
Problem. V1 accepted theme color names (
primary,accent,warning, …) for an agent'scolor. V2 only accepts six-digit hex. An agent file like this one has only keys V2 knows, so it is read as V2, the color fails validation, and the whole agent is silently dropped. In one report this removed 8 of 9 custom agents. The same applies toagents.<name>.colorinopencode.json, where it failed the config.Change. An invalid
coloris now ignored instead of rejecting the agent. The agent loads with its default color.Builds on #54257 by @4sDriven, which maps the theme names to hex. This keeps the change to the schema field only. Valid hex colors are unchanged, and the published config JSON schema and generated client are unchanged.
How did you verify your code works?
From
packages/core:The new agent-file case fails without the change. The existing
rejects named agent color tokenstest now checks that a named color is dropped while the rest of the agent is kept. I also checked thatpackages/schematypechecks and its tests pass, that the generatedconfig.jsonschema is byte-identical, and thatbun run generateinpackages/clientproduces no changes.Screenshots / recordings
No UI changes.
Checklist