Commit 1af6d3a
fix(backend): increase AG-UI event buffer size from 1MB to 10MB (#964)
## Summary
- Increase scannerMaxLineSize from 1MB to 10MB in agui_store.go to
support large MCP tool results
- Fixes "Failed to decode JSON: JSON message exceeded maximum buffer
size of 1048576 bytes" error
## Problem
When MCP tools (like Jira) return large datasets, the JSON-serialized
tool result can exceed the 1MB scanner buffer limit. This causes:
- Events failing to persist to the JSONL event log
- Session export failures
- Event replay failures on reconnection
## Solution
Increased the buffer size from 1MB to 10MB:
- Scanner still starts with 64KB and only grows as needed (no memory
waste for small events)
- 10MB is reasonable for large MCP tool results (Jira boards, database
queries, etc.)
- Matches common HTTP body size limits
## Changes
- `components/backend/websocket/agui_store.go`: Increase
`scannerMaxLineSize` from `1024 * 1024` (1MB) to `10 * 1024 * 1024`
(10MB)
## Test plan
- [x] Run websocket tests: `go test ./websocket/... -v` - all pass
- [x] Run go vet: `go vet ./websocket/...` - no issues
- [x] Run golangci-lint: `golangci-lint run ./websocket/...` - 0 issues
- [x] Verify gofmt: `gofmt -l websocket/` - no formatting issues
- [ ] Manual test: Fetch large Jira board via MCP and verify events
persist correctly
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 9d9d9b7 commit 1af6d3a
1 file changed
+5
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
223 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| |||
0 commit comments