fix: increase message size limits to handle browser screenshots properly

- Increased MAX_ACCUMULATOR_SIZE from 1MB to 10MB
- Increased MAX_PARAM_LENGTH from 100KB to 5MB
- Updated tests to reflect new limits

This fixes the issue where browser screenshots would display as base64 text
blocks instead of images after multiple browser actions due to size limits
being exceeded.

Fixes #8045
This commit is contained in:
Roo Code 2025-09-16 23:40:14 +00:00
parent 2263d86a20
commit 5e8a0b5f6e
2 changed files with 4 additions and 4 deletions

View file

@ -14,8 +14,8 @@ export class AssistantMessageParser {
private currentToolUseStartIndex = 0
private currentParamName: ToolParamName | undefined = undefined
private currentParamValueStartIndex = 0
private readonly MAX_ACCUMULATOR_SIZE = 1024 * 1024 // 1MB limit
private readonly MAX_PARAM_LENGTH = 1024 * 100 // 100KB per parameter limit
private readonly MAX_ACCUMULATOR_SIZE = 10 * 1024 * 1024 // 10MB limit to accommodate browser screenshots
private readonly MAX_PARAM_LENGTH = 5 * 1024 * 1024 // 5MB per parameter limit for large screenshots
private accumulator = ""
/**

View file

@ -325,8 +325,8 @@ describe("AssistantMessageParser (streaming)", () => {
describe("size limit handling", () => {
it("should throw an error when MAX_ACCUMULATOR_SIZE is exceeded", () => {
// Create a message that exceeds 1MB (MAX_ACCUMULATOR_SIZE)
const largeMessage = "x".repeat(1024 * 1024 + 1) // 1MB + 1 byte
// Create a message that exceeds 10MB (MAX_ACCUMULATOR_SIZE)
const largeMessage = "x".repeat(10 * 1024 * 1024 + 1) // 10MB + 1 byte
expect(() => {
parser.processChunk(largeMessage)