Repository navigation
Description
Summary
A Markdown agent file that still carries V1-only frontmatter (emoji, vibe) is parsed as V1, where the deprecated name: field becomes the agent ID. If name: differs from the file stem, the file and its agents.<stem> entry in opencode.json register as two separate agents instead of merging — with no warning. Delegating to the config key then fails with Agent <stem> cannot run as a subagent, while the permissions from the config entry sit on a twin that has no system prompt.
Environment
- opencode version: 2.4.3
- Client: TUI
- Model and provider: opencode-go/deepseek-v4.1-flash; not relevant to the bug
- OS: Linux 6.18.56-125.164.amzn2023.aarch64 (linux arm64)
- Terminal: TERM_PROGRAM=Orca, TERM=xterm-256color, COLORTERM=truecolor
- Shell: /bin/bash
- Install/channel: latest
- Active plugins: local TUI plugins
orca-opencode-status,orca-opencode2-status(not config-registered); none relevant
Reproduction
mkdir -p .opencode/agents
cat > .opencode/agents/widget.md <<'EOF'
---
name: Widget
description: probe seat
emoji: 🧪
mode: subagent
steps: 20
---
# Body
EOF
cat > opencode.json <<'EOF'
{
"$schema": "https://opencode.ai/config.json",
"agents": {
"widget": { "permissions": [{ "action": "read", "resource": "*", "effect": "allow" }] }
}
}
EOF
opencode debug agentsThen ask a primary agent to delegate to widget.
Expected Behavior
Per the docs (/agents#locations), the agent ID is path-derived: .opencode/agents/widget.md → widget. The opencode.json entry should merge into that definition. name: is listed under "Accepted but unsupported fields" and should either be ignored for the ID or warn at load.
Actual Behavior
opencode debug agents lists two agents:
{"id": "widget", "mode": "primary", "system": null, "description": null,
"permissions": [ ...the opencode.json rules... ]}
{"id": "Widget", "mode": "subagent", "system": "# Body", "description": "probe seat",
"permissions": [ ...global rules only... ]}- Delegating to
widgetfails:Agent widget cannot run as a subagent.widgetis primary because a config-only entry defaults toprimary. - The prompt-bearing
Widgetis a separate agent nothing in the config refers to. default_agent: "widget"silently selects the prompt-less twin.- No warning is emitted at load; the log has no frontmatter/agent lines at all.
- If the
widgetentry instead sets"mode": "subagent", delegation succeeds — into an agent with nosystemprompt and nomodel, inheriting the parent's. That is a silent-wrong-answer failure mode, not a fix.
Removing the name: line merges everything into one widget with prompt + model + config permissions (verified in an isolated config root).
Additional Context
Hit on a 22-agent kit: every seat had a display name: (Architect) alongside a hyphenated config key (architect), so 22 of 22 seats were duplicated. The bundle's loader:
let c = typeof s.data.name === "string" ? s.data.name
: relative(filepath).replace(/\.md$/, "")combined with the "one file is read as one format" rule (a file using only V1 fields is read as V1) is what makes name win.
Note the docs' unsupported-fields list scopes this to "Agent name inside V1 JSON configuration", which reads as if files are unaffected. If V1 file parsing staying active is intended, a load-time warning when a file-derived ID and a config key diverge would make this discoverable; today debug agents is the only way to see it.
Reproducible consistently. Workaround: drop name: from agent frontmatter (or make it exactly equal to the file stem, at the cost of keeping the file on the V1 parser).
Activity
opencodejr commentedon Nov 30, 2026
Thanks for the detailed report. I reproduced this on the unmodified 2.4.3 release with your exact files, and it still happens on the latest
dev(259e7cb). No model is needed to see it.opencode debug agentslists two agents:widget:mode: primary,system: null, with thereadrule fromopencode.json.Widget:mode: subagent, with# Bodyas its system prompt and the description, and only the global rules.With the same files, 2.4.2 gives a single merged
widgetsubagent, so this is a regression. It looks like it comes from #67051, which made a stringname:in agent frontmatter override the ID taken from the file path. TheAgent widget cannot run as a subagenterror follows from that: subagent delegation refuses agents whose mode isprimary, and the config-onlywidgetgetsprimary.The script below reproduces it with
opencode debug agentsin an isolated config root. Until this is resolved, your workaround of removingname:from the frontmatter avoids it.Reproduction script (repro.sh)
Run it:
sh repro.sharchit15singh commentedon Nov 30, 2026
I checked the published 2.4.2 and 2.4.3 macOS binaries with
debug agentsusing only descriptions and prompts. On 2.4.3 thenameoverride also applies to native-v2 Markdown and nested files. Switching the JSON key to the declared name joins the definitions on 2.4.3 but splits them on 2.4.2. Omittingnamekept the relative-path ID and one merged definition on both versions.Could I take a docs-only follow-up for
/agentsand the v1 migration guide to explain the precedence and the cross-version migration path?four1er commentedon Nov 30, 2026
I'm picking this up — reproducing the issue now and will open a PR with a fix.
rekram1-node commentedon Dec 1, 2026
name:in agent Markdown frontmatter overriding the path-derived ID is intentional (added in #67051). To merge withopencode.json, either omitname:to keep the file-path ID or match theagents.<id>key toname:.Opened #67431 to document this on the Agents page.