Agents: raise bootstrap total cap and warn on /context truncation (#18229)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f6620526df
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Gustavo Madeira Santana
2026-02-16 12:04:53 -05:00
committed by GitHub
parent 5b185da366
commit 8a67016646
16 changed files with 188 additions and 14 deletions

View File

@@ -58,7 +58,7 @@ describe("buildBootstrapContextFiles", () => {
expect(result?.content).not.toContain("[...truncated, read AGENTS.md for full content...]");
});
it("caps total injected bootstrap characters across files", () => {
it("keeps total injected bootstrap characters under the new default total cap", () => {
const files = [
makeFile({ name: "AGENTS.md", content: "a".repeat(10_000) }),
makeFile({ name: "SOUL.md", path: "/tmp/SOUL.md", content: "b".repeat(10_000) }),
@@ -68,6 +68,19 @@ describe("buildBootstrapContextFiles", () => {
const totalChars = result.reduce((sum, entry) => sum + entry.content.length, 0);
expect(totalChars).toBeLessThanOrEqual(DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS);
expect(result).toHaveLength(3);
expect(result[2]?.content).toBe("c".repeat(10_000));
});
it("caps total injected bootstrap characters when totalMaxChars is configured", () => {
const files = [
makeFile({ name: "AGENTS.md", content: "a".repeat(10_000) }),
makeFile({ name: "SOUL.md", path: "/tmp/SOUL.md", content: "b".repeat(10_000) }),
makeFile({ name: "USER.md", path: "/tmp/USER.md", content: "c".repeat(10_000) }),
];
const result = buildBootstrapContextFiles(files, { totalMaxChars: 24_000 });
const totalChars = result.reduce((sum, entry) => sum + entry.content.length, 0);
expect(totalChars).toBeLessThanOrEqual(24_000);
expect(result).toHaveLength(3);
expect(result[2]?.content).toContain("[...truncated, read USER.md for full content...]");
});