Repository navigation
Description
Summary
On OpenCode 2.0.18, agents declared in configuration are absent from both ctx.agent.list() and the AgentEditor during plugin setup transforms, but appear in /api/agent after setup. This prevents plugins from safely validating or applying policy to configured custom agents. Please clarify whether this lifecycle is intentional and, if so, provide a supported post-configuration transformation or validation path.
Environment
- opencode version: 2.0.18
- OS: Linux 6.17.0-1021-nvidia, aarch64
- Terminal:
xterm-256color(TERM_PROGRAMandCOLORTERMunavailable) - Shell:
/bin/bash - Install/channel: latest
- Active plugins: local KSI harness (failed during
agent.transform), Superpowers,@prevalentware/[email protected], OpenChamber agent tool
Reproduction
- Configure a custom agent, for example
developer, underagentswithmode: "subagent". - Load a plugin whose
setup(ctx)logsawait ctx.agent.list()and registersctx.agent.transform. In the callback, logeditor.list()andeditor.get("developer"). - After setup, query
GET /api/agentfor the same location.
Expected Behavior
Configuration-defined agents should be available while plugin agent transforms run. If transforms intentionally run before configured agents are materialized, the plugin API should document a supported later phase or another reliable way to validate and update configured agents without implicitly creating undeclared IDs.
Actual Behavior
During plugin setup, both ctx.agent.list() and editor.list() expose built-in agents only, and editor.get("developer") is undefined. In the isolated reproduction, the editor listed build, compaction, explore, general, plan, summary, and title. After setup, /api/agent includes the configured developer agent.
A policy plugin that fails closed when a required configured agent ID is unavailable is disabled. The observed KSI error was:
KSI V2: define these agent IDs in OpenCode's agents config before loading the plugin: design, developer, test-runner, reviewer, research, design-critic
Additional Context
Reproduced consistently on OpenCode 2.0.18 using a loopback server with separate temporary HOME/XDG configuration and data directories and a minimal agent/plugin configuration. No provider/auth configuration was present and no provider calls were made. The same failure remained after a shared-service restart and a location reload. The custom IDs were present in the configuration and appeared in the later API catalog.
Activity
github-actions commentedon Sep 27, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of an existing issue. Please check:
agent.listcan expose only built-in agents until plugin activation finishes.If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Sep 27, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.