Skip to content

Cockpit: OpenCode apply_patch tool renders as generic other card, missing edit alias in agent profile #1903

Closed

Description

@Seluj78

Note: Claude handled the investigation and prose via back-and-forth. Idea, decisions, and everything else are mine. — @Seluj78

Problem

When running an OpenCode agent in cockpit mode, the apply_patch tool (OpenCode's implementation of PatchText) renders as a generic "other" tool card instead of the dedicated edit card (pencil icon, file path, old/new diff). This makes patch operations visually indistinguishable from unknown or fallback tools.

Session 8bde1fec44f6438c seq 1243 shows the wire event:

{"ToolCallStarted":{"tool_call":{"id":"call_VY9erZKUWdIlbVTPSHXSMbBj","name":"apply_patch","kind":"other",...}}}

What's there today

The ACP schema's ToolKind enum (agent-client-protocol-schema 0.12.0, tool_call.rs:393-417) has no patch variant:

pub enum ToolKind {
    Read, Edit, Delete, Move, Search, Execute, Think, Fetch, SwitchMode,
    #[default]
    #[serde(other)]
    Other,
}

The claude-agent-acp adapter receives OpenCode's apply_patch tool, can't classify it as a standard ACP ToolKind, and serializes it as ToolKind::Other. AoE's tool_kind_str() at src/cockpit/acp_client.rs:3189-3202 maps Other (and any unknown future variant) to "other".

The frontend profile for OpenCode at web/src/lib/agentProfiles.ts:129-136 only knows these tool-to-card aliases:

aliases: {
    execute: ["bash"],
    read: ["read"],
    edit: ["edit", "write"],
    search: ["grep", "glob"],
    fetch: ["webfetch"],
    think: ["task"],
},

"apply_patch" is absent from the edit alias list, so resolveEffectiveKind() at web/src/components/cockpit/ToolCards.tsx:182-215 cannot route it to the EditToolCard. The tool falls through to GenericToolCard (the default arm at line 179).

Note that the CODEX profile already has the correct alias at line 113:

edit: ["apply_patch"],

The OpenCode profile simply lacks the same entry.

Root cause

Missing alias: "apply_patch" is not listed in the OpenCode profile's edit aliases in web/src/lib/agentProfiles.ts:132.

Fix

A one-line addition at web/src/lib/agentProfiles.ts:132:

edit: ["edit", "write", "apply_patch"],

No Rust-side changes needed. The ACP ToolKind schema is already correct (apply_patch genuinely isn't a standard ACP tool kind), and tool_kind_str correctly emits "other" -- the frontend alias layer is the right place to bridge this gap, as it already does for CODEX.

Why now

  • Every edit operation from an OpenCode cockpit session renders as a generic card, making the cockpit feel unpolished for OpenCode users.
  • The fix is a one-line addition already proven in the CODEX profile.
  • OpenCode is a first-class cockpit-capable agent in AoE; its tools should render at parity.

User stories / regression tests

Implementation MUST add tests covering each story below; PR is not done without them.

  • As an OpenCode cockpit user, when the agent calls apply_patch, then the tool card shows the edit card (pencil icon, file path, old/new diff) instead of a generic "other" card.

    • Suggested test layer: Vitest + RTL in ToolCards.render.test.tsx.
  • As an OpenCode cockpit user, when the agent calls other edit tools (edit, write), then those continue to render as edit cards (no regression).

    • Suggested test layer: Vitest + RTL in ToolCards.render.test.tsx.
  • As a default/unknown agent profile user, when the agent calls apply_patch, then the tool card still falls through to the generic card (no accidental alias leak from OpenCode profile).

    • Suggested test layer: Vitest + RTL or unit test for resolveEffectiveKind().

Open questions

  • None. The fix is a direct alias addition matching the existing CODEX precedent.

Out of scope

  • Adding a new ToolKind::PatchText variant to the ACP schema or AoE's Rust code. The apply_patch tool is a custom tool name, not a standard ACP tool kind, and the alias layer is the correct place to handle agent-specific tool names.
  • Changes to any other agent profile or the render dispatch logic.

Cross-references

  • No existing issue covers this gap. Searches for opencode apply_patch alias, opencode tool kind other, and PatchText tool card returned no open issues.
  • Cockpit: full OpenCode ACP compatibility (umbrella) #1828 is the umbrella epic for full OpenCode ACP compatibility; this issue is a scoped sub-item.

Activity

  1. added
    P2Backlog: real, but not now
    on Jun 3, 2026
  2. self-assigned this
    on Jun 3, 2026
  3. moved this from Backlog to Ready in Agent of Empireson Jun 3, 2026
  4. moved this from Ready to In progress in Agent of Empireson Jun 3, 2026
  5. Seluj78 commented on Jun 3, 2026

    @Seluj78
    MemberAuthor

    Upstream fix identified. The root cause is in anomalyco/opencode - OpenCodes own toToolKind mapping at packages/opencode/src/acp/tool.ts:48 does not include "apply_patch" alongside "patch", "edit", and "write". This means the ACP protocol message carries kind: "other" from the source, before AoE even processes it.

    Status: Blocked on upstream fix. Once merged upstream, AoE will receive kind: "edit" natively and no downstream alias is needed.

    Local work reverted. The downstream alias commit has been reverted in favor of the upstream fix.

  6. moved this from In progress to Done in Agent of Empireson Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Backlog: real, but not nowblocked:upstreamBlocked on an external dependency

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions