mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 04:24:31 +00:00
Agent: unify bootstrap truncation warning handling (#32769)
Merged via squash.
Prepared head SHA: 5d6d4ddfa6
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
3ad3a90db3
commit
e4b4486a96
@@ -3,8 +3,10 @@ import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
buildBootstrapContextFiles,
|
||||
DEFAULT_BOOTSTRAP_MAX_CHARS,
|
||||
DEFAULT_BOOTSTRAP_PROMPT_TRUNCATION_WARNING_MODE,
|
||||
DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS,
|
||||
resolveBootstrapMaxChars,
|
||||
resolveBootstrapPromptTruncationWarningMode,
|
||||
resolveBootstrapTotalMaxChars,
|
||||
} from "./pi-embedded-helpers.js";
|
||||
import type { WorkspaceBootstrapFile } from "./workspace.js";
|
||||
@@ -194,3 +196,32 @@ describe("bootstrap limit resolvers", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveBootstrapPromptTruncationWarningMode", () => {
|
||||
it("defaults to once", () => {
|
||||
expect(resolveBootstrapPromptTruncationWarningMode()).toBe(
|
||||
DEFAULT_BOOTSTRAP_PROMPT_TRUNCATION_WARNING_MODE,
|
||||
);
|
||||
});
|
||||
|
||||
it("accepts explicit valid modes", () => {
|
||||
expect(
|
||||
resolveBootstrapPromptTruncationWarningMode({
|
||||
agents: { defaults: { bootstrapPromptTruncationWarning: "off" } },
|
||||
} as OpenClawConfig),
|
||||
).toBe("off");
|
||||
expect(
|
||||
resolveBootstrapPromptTruncationWarningMode({
|
||||
agents: { defaults: { bootstrapPromptTruncationWarning: "always" } },
|
||||
} as OpenClawConfig),
|
||||
).toBe("always");
|
||||
});
|
||||
|
||||
it("falls back to default for invalid values", () => {
|
||||
expect(
|
||||
resolveBootstrapPromptTruncationWarningMode({
|
||||
agents: { defaults: { bootstrapPromptTruncationWarning: "invalid" } },
|
||||
} as unknown as OpenClawConfig),
|
||||
).toBe(DEFAULT_BOOTSTRAP_PROMPT_TRUNCATION_WARNING_MODE);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user