












@@ -1169,9 +1169,10 @@ describe("runCodexAppServerAttempt", () => {
11691169});
1170117011711171it("starts active OpenClaw sandbox turns with Codex native execution disabled", async () => {
1172+const runtimeId = `codex-test-runtime-${path.basename(tempDir)}`;
11721173const restoreSandboxBackend = registerSandboxBackend("codex-test-sandbox", async () => ({
11731174id: "codex-test-sandbox",
1174-runtimeId: "codex-test-runtime",
1175+ runtimeId,
11751176runtimeLabel: "Codex Test Sandbox",
11761177workdir: "/workspace",
11771178buildExecSpec: async () => ({
@@ -1203,6 +1204,8 @@ describe("runCodexAppServerAttempt", () => {
12031204mode: "all",
12041205backend: "codex-test-sandbox",
12051206scope: "session",
1207+workspaceAccess: "rw",
1208+prune: { idleHours: 0, maxAgeDays: 0 },
12061209},
12071210},
12081211},
@@ -1234,9 +1237,10 @@ describe("runCodexAppServerAttempt", () => {
12341237});
1235123812361239it("routes native Codex execution through an OpenClaw sandbox exec-server when opted in", async () => {
1240+const runtimeId = `codex-test-runtime-${path.basename(tempDir)}`;
12371241const restoreSandboxBackend = registerSandboxBackend("codex-test-sandbox", async () => ({
12381242id: "codex-test-sandbox",
1239-runtimeId: "codex-test-runtime",
1243+ runtimeId,
12401244runtimeLabel: "Codex Test Sandbox",
12411245workdir: "/workspace",
12421246buildExecSpec: async () => ({
@@ -1268,6 +1272,8 @@ describe("runCodexAppServerAttempt", () => {
12681272mode: "all",
12691273backend: "codex-test-sandbox",
12701274scope: "session",
1275+workspaceAccess: "rw",
1276+prune: { idleHours: 0, maxAgeDays: 0 },
12711277},
12721278},
12731279},
@@ -6073,14 +6079,11 @@ describe("runCodexAppServerAttempt", () => {
60736079};
60746080const config = threadStartParams.config;
607560816076-expect(threadStartParams.developerInstructions).toContain("OpenClaw Agent Soul");
6077-expect(threadStartParams.developerInstructions).toContain(
6078-"They define who you are, how you work",
6079-);
6080-expect(threadStartParams.developerInstructions).toContain(soulGuidance);
6081-expect(threadStartParams.developerInstructions).toContain(identityGuidance);
6082+expect(threadStartParams.developerInstructions).toContain("OpenClaw Workspace Instructions");
6083+expect(threadStartParams.developerInstructions).not.toContain(soulGuidance);
6084+expect(threadStartParams.developerInstructions).not.toContain(identityGuidance);
60826085expect(threadStartParams.developerInstructions).toContain(toolGuidance);
6083-expect(threadStartParams.developerInstructions).toContain(userProfile);
6086+expect(threadStartParams.developerInstructions).not.toContain(userProfile);
60846087expect(threadStartParams.developerInstructions).not.toContain(heartbeatChecklist);
60856088expect(threadStartParams.developerInstructions).not.toContain(memorySummary);
60866089expect(threadStartParams.developerInstructions).not.toContain("Codex loads AGENTS.md natively");
@@ -6090,7 +6093,23 @@ describe("runCodexAppServerAttempt", () => {
60906093const turnStart = harness.requests.find((request) => request.method === "turn/start");
60916094const turnStartParams = turnStart?.params as {
60926095input?: Array<{ text?: string }>;
6096+collaborationMode?: {
6097+settings?: {
6098+developer_instructions?: string | null;
6099+};
6100+};
60936101};
6102+const collaborationInstructions =
6103+turnStartParams.collaborationMode?.settings?.developer_instructions ?? "";
6104+expect(collaborationInstructions).toContain("# Collaboration Mode: Default");
6105+expect(collaborationInstructions).toContain("request_user_input availability");
6106+expect(collaborationInstructions).toContain("OpenClaw Agent Soul");
6107+expect(collaborationInstructions).toContain(soulGuidance);
6108+expect(collaborationInstructions).toContain(identityGuidance);
6109+expect(collaborationInstructions).not.toContain(toolGuidance);
6110+expect(collaborationInstructions).toContain(userProfile);
6111+expect(collaborationInstructions).not.toContain(heartbeatChecklist);
6112+expect(collaborationInstructions).not.toContain(memorySummary);
60946113const inputText = turnStartParams.input?.[0]?.text ?? "";
60956114expect(inputText).toContain("OpenClaw runtime context for this turn:");
60966115expect(inputText).not.toContain("does not override Codex system/developer instructions");
@@ -6104,6 +6123,10 @@ describe("runCodexAppServerAttempt", () => {
61046123expect(inputText).toContain("Codex loads AGENTS.md natively");
61056124expect(inputText).not.toContain(agentsGuidance);
61066125expect(inputText).toContain("Current user request:\nhello");
6126+expect(result.systemPromptReport?.systemPrompt.chars).toBe(
6127+[threadStartParams.developerInstructions ?? "", collaborationInstructions].join("\n\n")
6128+.length,
6129+);
6107613061086131const fileStats = new Map(
61096132result.systemPromptReport?.injectedWorkspaceFiles.map((file) => [file.name, file]) ?? [],
@@ -11038,17 +11061,25 @@ describe("runCodexAppServerAttempt", () => {
1103811061params.trigger = "user";
1103911062expect(
1104011063buildTurnCollaborationMode(params, {
11064+turnScopedDeveloperInstructions: "Turn-only workspace instructions.",
1104111065heartbeatCollaborationInstructions:
1104211066"HEARTBEAT.md exists at /tmp/workspace/HEARTBEAT.md. Read it before proceeding.",
1104311067}).settings.developer_instructions,
11044-).toBeNull();
11068+).toContain("Turn-only workspace instructions.");
11069+expect(
11070+buildTurnCollaborationMode(params, {
11071+turnScopedDeveloperInstructions: "Turn-only workspace instructions.",
11072+}).settings.developer_instructions,
11073+).toContain("# Collaboration Mode: Default");
1104511074});
11046110751104711076it("uses turn-scoped collaboration instructions for cron Codex turns", () => {
1104811077const params = createParams("/tmp/session.jsonl", "/tmp/workspace");
1104911078params.trigger = "cron";
110501107911051-const cronCollaborationMode = buildTurnCollaborationMode(params);
11080+const cronCollaborationMode = buildTurnCollaborationMode(params, {
11081+turnScopedDeveloperInstructions: "Turn-only workspace instructions.",
11082+});
1105211083expect(cronCollaborationMode.mode).toBe("default");
1105311084expect(cronCollaborationMode.settings.model).toBe("gpt-5.4-codex");
1105411085expect(cronCollaborationMode.settings.reasoning_effort).toBe("medium");
@@ -11061,6 +11092,9 @@ describe("runCodexAppServerAttempt", () => {
1106111092expect(cronCollaborationMode.settings.developer_instructions).toContain(
1106211093"Use context already provided by the runtime",
1106311094);
11095+expect(cronCollaborationMode.settings.developer_instructions).toContain(
11096+"Turn-only workspace instructions.",
11097+);
1106411098});
11065110991106611100it("preserves the bound auth profile when resume params omit authProfileId", async () => {
此內容由慣性聚合(RSS閱讀器)自動聚合整理,僅供閱讀參考。 原文來自 — 版權歸原作者所有。