




















@@ -1,5 +1,8 @@
11import { describe, expect, it, vi } from "vitest";
2-import { resolveAttemptWorkspaceBootstrapRouting } from "./attempt-bootstrap-routing.js";
2+import {
3+appendBootstrapFileToUserPromptPrefix,
4+resolveAttemptWorkspaceBootstrapRouting,
5+} from "./attempt-bootstrap-routing.js";
3647describe("runEmbeddedAttempt bootstrap routing", () => {
58it("resolves bootstrap pending from the canonical workspace instead of a copied sandbox", async () => {
@@ -25,4 +28,43 @@ describe("runEmbeddedAttempt bootstrap routing", () => {
2528expect(routing.bootstrapMode).toBe("none");
2629expect(routing.userPromptPrefixText).toBeUndefined();
2730});
31+32+it("falls back to limited bootstrap wording when a primary run cannot read files", async () => {
33+const routing = await resolveAttemptWorkspaceBootstrapRouting({
34+isWorkspaceBootstrapPending: vi.fn(async () => true),
35+trigger: "user",
36+isPrimaryRun: true,
37+isCanonicalWorkspace: true,
38+effectiveWorkspace: "/tmp/openclaw-workspace",
39+resolvedWorkspace: "/tmp/openclaw-workspace",
40+hasBootstrapFileAccess: false,
41+});
42+43+expect(routing.bootstrapMode).toBe("limited");
44+expect(routing.userPromptPrefixText).toContain("Bootstrap is still pending");
45+expect(routing.userPromptPrefixText).toContain("cannot safely complete");
46+});
47+48+it("appends BOOTSTRAP.md contents to the user prompt prefix for full bootstrap turns", () => {
49+const prompt = appendBootstrapFileToUserPromptPrefix({
50+prefixText: "[Bootstrap pending]",
51+bootstrapMode: "full",
52+contextFiles: [{ path: "/tmp/workspace/BOOTSTRAP.md", content: "Ask who I am." }],
53+});
54+55+expect(prompt).toContain("[Bootstrap pending]");
56+expect(prompt).toContain("[BEGIN BOOTSTRAP.md]");
57+expect(prompt).toContain("Ask who I am.");
58+expect(prompt).toContain("workspace/user instructions");
59+});
60+61+it("does not append BOOTSTRAP.md contents for limited bootstrap turns", () => {
62+const prompt = appendBootstrapFileToUserPromptPrefix({
63+prefixText: "[Bootstrap pending]",
64+bootstrapMode: "limited",
65+contextFiles: [{ path: "/tmp/workspace/BOOTSTRAP.md", content: "Ask who I am." }],
66+});
67+68+expect(prompt).toBe("[Bootstrap pending]");
69+});
2870});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。