Q22: cap every tool result and bound connector responses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 05:04:59 -04:00
1 parent 4d6c74a21e
commit 8e8b66fed4
5 files changed
+79 -5

No files matched your search

+8 -1
View File
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, test } from "vitest";
import { compactToolHistory } from "../../src/main/services/run-context-compaction";
import { capToolOutput, compactToolHistory } from "../../src/main/services/run-context-compaction";
import { runAgentLoop } from "../../src/main/services/agent-run-loop";
import { DatabaseConnection } from "../../src/main/database/connection";
import { OrganizationService } from "../../src/main/services/organization-service";
@@ -83,4 +83,11 @@ describe("tool history compaction", () => {
expect(outputs.slice(2).every((output) => output.includes("y".repeat(3000)))).toBe(true);
connection.close();
});
test("every tool result is capped with a note that names the tool and the full size", () => {
expect(capToolOutput("composio_gmail_list", "short")).toBe("short");
const capped = capToolOutput("composio_gmail_list", "r".repeat(40_000));
expect(capped.length).toBeLessThan(26_200);
expect(capped.endsWith("[result of composio_gmail_list cut at 26000 of 40000 characters; ask for less (filters, pagination, fewer fields)]")).toBe(true);
});
});