mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:31:24 +00:00
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:
committed by
GitHub
parent
5b185da366
commit
8a67016646
@@ -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...]");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user