Skip to content

[Bug]: Disconnected Claude Code integration leaves and regenerates ocx agents, forcing native subagents to Haiku #7968

Closed

Description

@comfuture

Client or integration

Claude Code

Area

CLI

Summary

OpenCodex leaves its generated global Claude Code subagent definitions under ~/.claude/agents/ocx-*.md after the Claude Code integration has been disconnected or disabled. In particular, ~/.claude/agents/ocx-claude-opus-5-5.md remains visible to native Claude Code sessions that do not use the OpenCodex proxy.

The generated agent description instructs the dispatcher to pass model: "haiku" as a placeholder, relying on the proxy's <!-- ocx-route: ... --> directive to select the real target. Without the proxy, that placeholder is not inert: Claude Code may actually select Haiku instead of the intended Opus model. This can silently degrade work performed by a native session.

Deleting the generated file manually is only a temporary workaround: running an OpenCodex update recreates the agent files even while the Claude Code integration remains disconnected. This makes it difficult to use OpenCodex and standalone Claude Code independently on the same machine.

Expected: Disconnecting or disabling Claude Code integration should remove OpenCodex-owned global agent definitions, or otherwise ensure that native Claude Code never loads proxy-dependent agent definitions. Updates and routine maintenance should honor the disabled state and not recreate them. User-authored agents must remain untouched.

Related: #6358 describes the unsafe model: "haiku" placeholder in non-proxied sessions, but does not cover the disconnect/update lifecycle; it was auto-closed for not following the issue template.

Reproduction

  1. Connect Claude Code through OpenCodex and configure a featured subagent targeting Claude Opus 5.5 so OpenCodex generates ~/.claude/agents/ocx-claude-opus-5-5.md.
  2. Disconnect or disable the Claude Code integration in OpenCodex.
  3. Observe that the generated ocx-*.md file remains under the global Claude Code agents directory.
  4. Launch native claude without the OpenCodex proxy. The generated agent is still discoverable; its description can lead Claude Code to pass model: "haiku", resulting in a real Haiku invocation instead of the intended model.
  5. Manually delete ~/.claude/agents/ocx-claude-opus-5-5.md.
  6. Update OpenCodex while leaving the integration disabled. Observe that the generated file is recreated.

Steps reflect the reported behavior; exact CLI commands for disconnect/update may vary with the installation.

Version

Not supplied (observed on an installed OpenCodex version; please confirm exact version).

Operating system

Not supplied (global Claude Code agent directory ~/.claude/agents/).

Provider and model

Native Anthropic Claude Code; generated ocx-claude-opus-5-5 agent; unexpected Haiku fallback.

Logs or error output

No explicit error: silent model misrouting. Inspect ~/.claude/agents/ocx-claude-opus-5-5.md before/after disabling the integration and after updating OpenCodex.

Screenshots and supporting files

Not available.

Redacted configuration

Claude Code integration was previously enabled and later disconnected/disabled. Specific configuration was not provided.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bugSomething isn't working
    cliCLI, config inject, packaging flags
    on Oct 29, 2026
  2. lidge-jun commented on Oct 30, 2026

    @lidge-jun
    Owner

    Fixed by #7993, merged into dev as a022a67fd8152045268405145d73ef696ff5afdd. Turning Claude Code off with the dashboard integration toggle now prunes the OpenCodex-generated ~/.claude/agents/ocx-*.md definitions right away, so native claude sessions stop seeing proxy-only agents and their haiku placeholder. Only regular files carrying generated-by: opencodex are removed; user-authored agents are never touched. Turning it off again also removes definitions an older version left behind.

    On the regeneration claim: no current startup, launch, system-env, roster or update path writes these files while claudeCode.enabled or injectAgents is false. Every one goes through injectClaudeAgentDefs, which prunes in that state. The leftover files came from the toggle never reconciling. If they reappear on a version that includes this fix while Claude Code is off, please reopen with the exact command that recreated them.

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 workingcliCLI, config inject, packaging flags

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions