[Bug][desktop]: Tool results above 64 KiB are replaced in the transcript by a model-facing receipt instead of the output

Aperta
#622 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
desktop

Direzione di ricerca

Start with buildExternalizedReceipt in packages/agent-extension/src/tool-output-budget.ts, then follow the handle through mcp-tool-result-history-externalizer.ts and tool-result-archiver.ts to see how details.mcp.reference reaches the transcript. Next read the Desktop renderer that renders tool result cards and confirm it never looks at details.mcp.reference, as the report claims. Done means a large tool result renders a human summary plus an openable view of the artifact, with the model-facing receipt no longer shown; reproduce by grepping session messages.jsonl for "Tool output externalized".

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

desktop
Product or interface

Desktop app

Version

3.1.17 (build 3.1.17.226, /Applications/MiniMax Code.app)

Platform

macOS

OS version and architecture

macOS 27.2.1 (Darwin 27.2.0) arm64

Issue area

UI / UX — how tool results are rendered in the chat transcript

Desktop log upload ID

Not available (no upload was performed; the symptom is text-only and is reproducible from the on-disk session transcript, see below).


Steps to reproduce
  1. In the Desktop app, start a session and let the agent run a tool whose result is large — web_search with a query that returns many results is the easiest trigger.
  2. Let the tool call complete.
  3. Look at the tool result card in the transcript.
Expected and actual behavior

Expected: the tool result card shows the actual result, or at least a user-facing summary plus a way to open the full output.

Actual: the tool result card shows a ~1 KB English receipt that was written for the model, not the result. It reads:

[Tool output externalized
Tool: web_search
Source: query="..."
Artifact: ~/.minimax/v2/sessions/<date>/<session>/reports/tool-outputs/<sha>.readable.v1.jsonl
Artifact format: chunked JSONL; concatenate each chunk row's text field in index order.

Recover the needed facts from this artifact now, before answering, inferring, or searching another source.
Search this artifact first with bounded rg/grep when available, then read the relevant ranges with read(path, offset, limit).
If artifact search is unavailable, use bounded read directly.
Do not read or print the entire artifact in a single call.
When complete content is required, continue with bounded reads until all of it has been read.
Do not treat this receipt as evidence.]

(The absolute path above is redacted; on disk it is a full /Users/<user>/... path.)

So the user sees internal model instructions ("Do not treat this receipt as evidence", "read the relevant ranges with read(path, offset, limit)") plus a non-clickable absolute path, instead of the search results or command output.

Root cause (verified on this machine)

This is not a rendering glitch — the transcript genuinely no longer contains the payload.

  1. The runtime replaces the result with a receipt. In the persisted transcript, the tool result's visible content (content[0].text) is the receipt above; the original payload is moved out of the message.

  2. The payload survives only as an out-of-line artifact handle. The same tool result carries a machine-readable handle:

    {
      "kind": "mcp_tool_result_artifact",
      "version": 1,
      "externalized": true,
      "reference": "<abs path>/reports/tool-outputs/<sha>.readable.v1.jsonl",
      "raw_reference": "<abs path>/reports/tool-outputs/<sha>",
      "original_bytes": 168853,
      "content_type": "application/json",
      "read_format": "chunked_jsonl_v1",
      "content_sha256": "..."
    }
    
  3. The threshold is small enough to trigger constantly. The runtime keeps a tool result inline only while it fits the inline budget. The defaults are maxInlineKiB: 64 and mcpDetailsMaxInlineKiB: 32 (see TOOL_RESULT_COMPACTION_DEFAULTS; overridable via toolResultCompaction in config.yaml). Both keys were unset on this machine, so the defaults applied. A single web_search result routinely exceeds 64 KiB — on this machine every externalized result was above the limit (smallest was 66,340 B).

  4. The desktop renderer never resolves the handle. In the shipped desktop bundle (app.asar, build 3.1.17.226) there is no read of details.mcp.reference: mcp?.reference and .mcp?.reference both occur 0 times, while details?.mcp occurs only 3 times, all on the runtime side. So the handle is available to the agent (it is what lets the model recover the facts via read/rg) but the UI has no path to it.

Relevant upstream sources in this repository:

  • packages/agent-extension/src/tool-output-budget.ts — buildExternalizedReceipt (the receipt text).
  • packages/local-runtime-v2/src/service/turn-system/agent-host/execution/mcp-tool-result-history-externalizer.ts
  • packages/local-runtime-v2/src/service/turn-system/compaction/algorithm/tool-result-archiver.ts
  • packages/local-runtime-v2/src/service/turn-system/agent-host/runner/policy/session-readable-grants.ts — toolOutputGrantSource
  • packages/local-runtime-v2/src/service/turn-system/production-composition.ts
Why this reads as a bug rather than a design choice
  • The receipt text is model-facing. "Recover the needed facts from this artifact now", "Do not read or print the entire artifact in a single call", "Do not treat this receipt as evidence" are instructions to an agent. They are rendered verbatim into a user-visible transcript.
  • The path is unusable for a user. It is a machine-local absolute path: not clickable, not portable, meaningless on another machine, and dangling if the session directory is moved or reports/tool-outputs/ is cleaned up.
  • The artifact is not the original output either. It is chunked_jsonl_v1 — a chunked JSONL envelope that the reader has to reassemble — so even a user who opens it by hand does not see the tool output as it was produced.
  • The threshold makes it the common case, not an edge case. Anything above 64 KiB is externalized; 64 KiB is a routine tool payload size.
Measured impact on one machine (Desktop 3.1.17.226, macOS)
  • 72 tool results in the persisted session transcripts had their visible content replaced by the receipt: 71 web_search, 1 task_output.
  • For the 71 with a size handle: original_bytes median 113,123 B, mean 169,541 B, max 648,694 B, min 66,340 B — all above the 64 KiB inline budget, and all above the 32 KiB MCP-details budget.
  • The receipt marker appears 86 times in messages.jsonl (2026-10: 64, 2026-11: 22) across 15 sessions, plus 233 further occurrences inside compaction snapshots.

Reproduce the count locally:

grep -rc "Tool output externalized" ~/.minimax/v2/sessions/*/*/*/*/messages.jsonl
grep -rl "Tool output externalized" ~/.minimax/v2/sessions/*/*/*/*/snapshots | wc -l
Suggested fixes (any one of these resolves the user-visible symptom)
  1. Resolve the artifact in the renderer. When a tool result carries details.mcp.reference, the Desktop UI should render a user-facing summary ("web_search returned 12 results (84 KB)") plus an expandable / openable view of the artifact, instead of printing the receipt.
  2. Split model-facing from user-facing text. Keep the receipt for the model, but give the transcript a separate human-readable label (tool name, result size, and a link). The internal instructions should not be user-visible at all.
  3. Make the path relative and clickable (e.g. resolve it against the session directory and expose an in-app "open file" action), so it stays valid and is usable.
Note on configuration

toolResultCompaction.maxInlineKiB (default 64) and mcpDetailsMaxInlineKiB (default 32) can be raised in config.yaml. That only delays the symptom — the payload still leaves the transcript, it just crosses the threshold later. It is a mitigation, not a fix.

Redacted error summary

The desktop logs (~/Library/Logs/MiniMax/main-*.log) and the v2 runtime logs (~/.minimax/v2/observability/logs/runtime-*.log) contain no error or warning corresponding to this symptom, which is why no log excerpt is attached: the runtime considers this a normal, successful path. The runtime log lines that do mention the artifact upload ([eval-capture] ... upload failed, [messages-file-api] upload failed; keeping inline media block) refer to internal telemetry and are unrelated to what the user sees in the transcript.

Screenshots

None attached — the symptom is fully described by the transcript text above, and it can be verified directly from the on-disk session artifacts using the commands given above.

Before submitting
  • I have searched existing issues.
  • I have included my version and removed sensitive information.
Lingua principale
TypeScript
Stelle
2.3k
Fork
315
Merge medio
3h 54m
PR unite (30g)
9

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MiniMax-AI/minimax-code

Tutte le issue di MiniMax-AI/minimax-code

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.