[Bug] ACP: content-part tool results (image reads, multi-part MCP output, executor errors) are sent to the editor as a JSON string
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- tooling
Línea de trabajo
Start in packages/acp-server/src/convert.ts at toolResultToAcpContent, which currently only handles string output and falls back to JSON.stringify. Compare it with the part-by-part mapping already done in replay.ts, and mirror that: text parts to text blocks, base64 images to image blocks, other parts to a [type] placeholder, [] to no content. Add cases to packages/acp-server/test/convert.test.ts; done means those pass and string, hidden and other outputs are unchanged.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What version of Kimi Code is running?
2.7.2 (source main at e12cad1, 2026-11-22). Reproduced with a unit test on toolResultToAcpContent.
Which open platform/subscription were you using?
None involved. This is in the ACP server (kimi acp).
Which model were you using?
None involved. Any model.
What platform is your computer?
Darwin 25.6.0 arm64 arm (the code path is platform-independent).
What issue are you seeing?
In ACP mode (Zed, JetBrains or any ACP client), tool results whose output is a content-part array are sent to the editor as a single JSON string, not as readable content.
toolResultToAcpContent in packages/acp-server/src/convert.ts handles only string outputs. Anything else goes through JSON.stringify:
if (typeof out === 'string') {
if (out.length === 0) return [];
return [{ type: 'content', content: { type: 'text', text: out } }];
}
let text: string;
try {
text = JSON.stringify(out);
} catch {
text = '[object]';
}
A content-part array (ContentPart[]) is the normal output shape for several kinds of tool result:
- MCP tool results with more than one content block or with an image (a single text block is collapsed to a string first)
ReadMediaFileimage reads- tool calls that end with an executor-level error (timed out, cancelled or abandoned): the executor's output is
[{ type: 'text', text: reason }] - a call that ends with no result and no error:
[], which the editor shows as the text[]
So the editor's tool panel shows things like [{"type":"text","text":"…"}]. For an image read it shows the whole data:image/png;base64,… URL as text, which can be hundreds of KB. ACP has native text and image content blocks for this.
Session replay (replay.ts) already maps stored tool content part by part: text parts become text blocks and other parts become a [type] placeholder. So the live view and the replayed view of the same tool call differ.
What steps can reproduce the bug?
- Run
kimi acpfrom an ACP client. - Ask the agent to read an image file (
ReadMediaFile), or call an MCP tool that returns several content blocks or an image, such as a browser screenshot tool. - Look at the tool call output in the editor.
Unit-level, calling the real converter:
toolResultToAcpContent({ type: 'tool.result', origin: 'loop', turnId: 1, toolCallId: 'c',
output: [{ type: 'text', text: 'tool failed: boom' }], isError: true })
returns
[{ "type": "content", "content": { "type": "text", "text": "[{\"type\":\"text\",\"text\":\"tool failed: boom\"}]" } }]
For [{ type: 'text', … }, { type: 'image_url', imageUrl: { url: 'data:image/png;base64,…' } }], the single text block contains the full base64 data URL.
What is the expected behavior?
- Text parts are sent as ACP text blocks.
- Base64 image parts are sent as ACP image blocks.
- Other parts get the same
[type]placeholder that session replay uses. - An empty array produces no content.
rawOutput keeps carrying the full structure, and string outputs, hidden outputs and other values are unchanged.
Additional information
The fix is local to toolResultToAcpContent, plus tests in packages/acp-server/test/convert.test.ts. I have it ready with regression tests that fail on current main, and can open the PR once this is approved.
- Lenguaje dominante
- TypeScript
- Estrellas
- 8.3k
- Forks
- 1.4k
- Merge medio
- 12 h 6 min
- PR fusionados (30 d)
- 596
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de MoonshotAI/kimi-code
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
MoonshotAI/kimi-code#5539 ·
Los mantenedores suelen responder en 1 día
-
[Bug] Kimi RC workspace folder picker does not display symbolic link directoriesPosiblemente ocupada @markankamaransheogarat-sys la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
MoonshotAI/kimi-code#5296 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
MoonshotAI/kimi-code#5256 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
MoonshotAI/kimi-code#5062 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
MoonshotAI/kimi-code#5057 ·
Los mantenedores suelen responder en 1 día
Todos los issues de MoonshotAI/kimi-code
Issues similares
-
Add Alice&BotAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
slavakurilyak/awesome-ai-agents#1048 ·
-
bot:ai-assisted component:faucet github_actions security status:untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
midnightntwrk/midnight-faucet-api#215 ·
Los mantenedores suelen responder en 1 día
-
[功能] 手机端命令执行显示 AI 动作描述Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NanmiCoder/cc-haha#2034 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
mobile prio:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
digitalfabrik/entitlementcard#3324 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día