Preserve raw JSON in tool result compaction - #1088
Quim Muntal (qmuntal) merged 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review comments remain, and regression coverage is included.
Pull request overview
Preserves raw JSON text in tool-result compaction summaries while retaining existing formatting for other result types.
Changes:
- Formats
json.RawMessageresults directly as strings. - Adds regression coverage for JSON and scalar result types.
File summaries
| File | Description |
|---|---|
agent/compaction/toolresult.go |
Preserves raw JSON formatting. |
agent/compaction/compaction_test.go |
Adds formatter regression coverage. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Scope: user-visible behavior
|
Fixes #1087
ToolResultStrategycurrently formatsjson.RawMessageresults as byte numbers. Preserve the JSON text in the summary by converting raw messages directly to strings, while keeping the existing formatting for other result types.Added regression coverage in the existing compaction test file for raw JSON objects, arrays, null, empty/nil values, and ordinary string and number results. The raw JSON cases fail before the fix and pass afterward.
Validation:
go test -race -shuffle=on ./..., golangci-lint (zero issues), and the local reproduction sample against the fix.