Skip to content

plugins: config-defined agents are missing during agent transforms #51598

Closed as not planned

Description

@khakisketch

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_PROGRAM and COLORTERM unavailable)
  • Shell: /bin/bash
  • Install/channel: latest
  • Active plugins: local KSI harness (failed during agent.transform), Superpowers, @prevalentware/[email protected], OpenChamber agent tool

Reproduction

  1. Configure a custom agent, for example developer, under agents with mode: "subagent".
  2. Load a plugin whose setup(ctx) logs await ctx.agent.list() and registers ctx.agent.transform. In the callback, log editor.list() and editor.get("developer").
  3. After setup, query GET /api/agent for 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

  1. github-actions commented on Sep 27, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • This reads as a bug report, but it does not include the required Description field from the Bug Report template (it currently has a Summary section instead). Please use the issue template and include its Description field.

    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:

    • #51282: agent.list can expose only built-in agents until plugin activation finishes.

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Sep 27, 2026

    @github-actions
    Contributor

    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.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions