mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:01: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
@@ -44,4 +44,41 @@ describe("buildSystemPromptReport", () => {
|
||||
|
||||
expect(report.injectedWorkspaceFiles[0]?.injectedChars).toBe("trimmed".length);
|
||||
});
|
||||
|
||||
it("marks workspace files truncated when injected chars are smaller than raw chars", () => {
|
||||
const file = makeBootstrapFile({
|
||||
path: "/tmp/workspace/policies/AGENTS.md",
|
||||
content: "abcdefghijklmnopqrstuvwxyz",
|
||||
});
|
||||
const report = buildSystemPromptReport({
|
||||
source: "run",
|
||||
generatedAt: 0,
|
||||
bootstrapMaxChars: 20_000,
|
||||
systemPrompt: "system",
|
||||
bootstrapFiles: [file],
|
||||
injectedFiles: [{ path: "/tmp/workspace/policies/AGENTS.md", content: "trimmed" }],
|
||||
skillsPrompt: "",
|
||||
tools: [],
|
||||
});
|
||||
|
||||
expect(report.injectedWorkspaceFiles[0]?.truncated).toBe(true);
|
||||
});
|
||||
|
||||
it("includes both bootstrap caps in the report payload", () => {
|
||||
const file = makeBootstrapFile({ path: "/tmp/workspace/policies/AGENTS.md" });
|
||||
const report = buildSystemPromptReport({
|
||||
source: "run",
|
||||
generatedAt: 0,
|
||||
bootstrapMaxChars: 11_111,
|
||||
bootstrapTotalMaxChars: 22_222,
|
||||
systemPrompt: "system",
|
||||
bootstrapFiles: [file],
|
||||
injectedFiles: [{ path: "AGENTS.md", content: "trimmed" }],
|
||||
skillsPrompt: "",
|
||||
tools: [],
|
||||
});
|
||||
|
||||
expect(report.bootstrapMaxChars).toBe(11_111);
|
||||
expect(report.bootstrapTotalMaxChars).toBe(22_222);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user