Repository navigation
Description
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.
- Suggested test layer: Vitest + RTL in
-
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.
- Suggested test layer: Vitest + RTL in
-
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().
- Suggested test layer: Vitest + RTL or unit test for
Open questions
- None. The fix is a direct alias addition matching the existing CODEX precedent.
Out of scope
- Adding a new
ToolKind::PatchTextvariant to the ACP schema or AoE's Rust code. Theapply_patchtool 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, andPatchText tool cardreturned 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Seluj78 commentedon Jun 3, 2026
Upstream fix identified. The root cause is in
anomalyco/opencode-OpenCodes owntoToolKindmapping atpackages/opencode/src/acp/tool.ts:48does not include"apply_patch"alongside"patch","edit", and"write". This means the ACP protocol message carrieskind: "other"from the source, before AoE even processes it.case "apply_patch":to the"edit"arm intoToolKindStatus: 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.