From 3c9876a6785380d7b2f88abab5c0a77efcbbf6d1 Mon Sep 17 00:00:00 2001 From: jordan Date: Tue, 10 Feb 2026 23:14:20 -0700 Subject: [PATCH] fix(worker): increase SSE scanner buffer to 1MB in claudebox client 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 --- internal/adapter/claudebox/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/adapter/claudebox/client.go b/internal/adapter/claudebox/client.go index 92c0c8f..d8af85d 100644 --- a/internal/adapter/claudebox/client.go +++ b/internal/adapter/claudebox/client.go @@ -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: ") {