Skip to content

[Bug] OMO agents disappear from selector after /connect command in OpenCode 1.15.x #4130

Closed

Description

@jayedisonGit

Prerequisites

  • I will write this issue in English (see our Language Policy)
  • I have searched existing issues to avoid duplicates
  • I am using the latest version of oh-my-openagent
  • I have read the documentation or asked an AI coding agent with this project's GitHub URL loaded and couldn't find the answer

Bug Description

After upgrading to OpenCode 1.15.4, using the /connect command to switch models causes all oh-my-openagent (OMO) custom agents (Sisyphus, Oracle, etc.) to disappear from the agent selector in the TUI. Only the default build/plan agents remain visible.\n\nThe agents work correctly on startup, but any model switch via /connect breaks the plugin's agent registration. Restarting opencode restores the agents until /connect is used again.

Steps to Reproduce

  1. Install oh-my-openagent v4.1.2 with OpenCode v1.15.4 on Windows\n2. Configure OMO agents via oh-my-openagent.json (loaded via OPENCODE_PLUGINS env var)\n3. Start opencode - agents appear correctly in the selector\n4. Use /connect command to switch to a different model\n5. Observe agent selector - OMO agents (Sisyphus, Oracle, etc.) are gone, only build/plan remain

Expected Behavior

OMO agents should remain registered and visible in the agent selector after switching models via /connect. The plugin config hook should be re-applied when the provider/model configuration changes.

Actual Behavior

All OMO custom agents disappear from the TUI agent selector. Only the default build/plan agents remain. The agents do not return until opencode is fully restarted.\n\nRoot cause analysis suggests that OpenCode 1.15.x changed the connect/provider system:\n- May 10: Provider plugins can no longer mutate shared provider model state\n- May 13: v2 model and provider listing API\n- May 16: Fixed async commands losing active instance context\n\nThe /connect command appears to reinitialize the agent registry but does not re-invoke plugin config hooks, or invokes them when the provider state has already been reset.

Doctor Output

Note: bunx oh-my-openagent doctor reports not registered, but OMO is loaded via OPENCODE_PLUGINS=oh-my-openagent env var and works on startup.\n\nEnvironment:\n- OpenCode: v1.15.4\n- oh-my-openagent: v4.1.2\n- @opencode-ai/plugin: v1.15.4\n- OS: Windows Server 2022 (x64)\n- Node.js: v24.14.1\n- Plugin loading: OPENCODE_PLUGINS=oh-my-openagent (env var)

Error Logs

Configuration

// opencode.json: loaded via OPENCODE_PLUGINS=oh-my-openagent env var (not in plugins array). oh-my-openagent.json configures 11 agents, all using zhipuai-coding-plan model.

Additional Context

Related: #4086 (OpenCode 1.15.2 + OMO 4.1.2 Windows hang, fixed via #4094). That issue was about hanging; this one is about agent registration being lost after /connect.\n\nWorkaround: Restart opencode after using /connect to switch models.\n\nThis is likely a lifecycle compatibility issue between OpenCode 1.15.x provider changes and OMO's createConfigHandler applyAgentConfig registration chain.

Operating System

Windows

OpenCode Version

1.15.4

Activity

  1. jayedisonGit commented on Jun 5, 2026

    @jayedisonGit
    Author

    Fix from PR #4294 does not resolve the issue

    I'm on oh-my-openagent v4.7.5 (which includes PR #4294) + OpenCode v1.16.0 (also tested on 1.15.13), and the problem persists — all OMO agents still disappear from the selector after /connect.

    Root Cause Analysis

    PR #4294 added clearRegisteredAgentNames() before re-registration inside applyAgentConfig(). This is correct if the config hook is called. However, my investigation of the bundled code shows:

    1. Plugin registration: OMO registers its config handler via config: managers.configHandler (line 143263 in the bundle)
    2. Config handler → applyAgentConfig → clearRegisteredAgentNames → registerAgentName: The fix is present in the code
    3. The problem: /connect is handled entirely by OpenCode's Go runtime (opencode.exe). After switching models, OpenCode does not re-invoke the plugin config hook. Without that call, applyAgentConfig never runs, so the clearing/re-registration code is dead code in this scenario.

    Evidence

    • Verified clearRegisteredAgentNames exists in the v4.7.5 bundle (line 68765, called at line 137479)
    • Verified the config handler registration chain is intact
    • Tested on OpenCode 1.15.13 and 1.16.0 — agents disappear after /connect on both

    Conclusion

    This is an OpenCode upstream issue — the /connect command does not re-trigger plugin config hooks after model/provider switch. The fix needs to come from OpenCode's side (or OMO needs to find an alternative hook/event to respond to model switches).

    I've filed a corresponding issue at opencode-ai/opencode for the upstream fix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions