fix(worker): increase SSE scanner buffer to 1MB in claudebox client
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

The HTTP claudebox client's ExecuteStream method used a bare
bufio.NewScanner with the default 64KB max token size. When Claude Code
produces tool results > 64KB (e.g., reading large files), the SSE event
exceeds the scanner limit and fails with "token too long".

Every other scanner in the codebase (claudecode adapter, claudebox
executor, kubernetes executor) already uses scanner.Buffer(buf, 1MB).
This was the only one missed.

Fixes: "agent execution failed: read stream: bufio.Scanner: token too long"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jordan 2026-02-10 23:14:20 -07:00
parent f8554a5e6f
commit 3c9876a678

View File

@ -175,6 +175,8 @@ func (c *Client) ExecuteStream(ctx context.Context, req *ExecuteRequest, handler
// Parse SSE events
scanner := bufio.NewScanner(resp.Body)
buf := make([]byte, 0, 64*1024)
scanner.Buffer(buf, 1024*1024) // 1MB max to match other streaming paths
for scanner.Scan() {
line := scanner.Text()
if !strings.HasPrefix(line, "data: ") {