Skip to content

fix(core): ignore unsupported agent colors - #57910

Merged
rekram1-node merged 1 commit into
devfrom
agent-color-names
Oct 22, 2026
Merged

rekram1-node merged 1 commit into
devfrom
agent-color-names

Conversation

@rekram1-node

Copy link
Copy Markdown
Contributor

Issue for this PR

Fixes #54057

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Problem. V1 accepted theme color names (primary, accent, warning, …) for an agent's color. 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 to agents.<name>.color in opencode.json, where it failed the config.

---
description: demo agent
mode: subagent
color: accent
---

Change. An invalid color is now ignored instead of rejecting the agent. The agent loads with its default color.

 Config.Agent
-  color: hex                     # invalid → whole agent rejected
+  color: hex, or ignored         # invalid → color omitted, agent kept

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:

bun test test/config     # 249 pass, 0 fail
bun typecheck

The new agent-file case fails without the change. The existing rejects named agent color tokens test now checks that a named color is dropped while the rest of the agent is kept. I also checked that packages/schema typechecks and its tests pass, that the generated config.json schema is byte-identical, and that bun run generate in packages/client produces no changes.

Screenshots / recordings

No UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Co-authored-by: 4sDriven <131897363+4sDriven@users.noreply.github.com>

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agents: V1 theme color names silently drop agent files in V2

1 participant