Skip to content

Commit 1e20508

Browse files
committed
fix(codex): keep repair checks within plugin boundaries
1 parent b26c878 commit 1e20508

2 files changed

Lines changed: 27 additions & 24 deletions

File tree

‎extensions/codex/src/app-server/attempt-context.test.ts‎

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
registerMemoryCapability,
1212
} from "openclaw/plugin-sdk/memory-host-core";
1313
import { afterEach, describe, expect, it, vi } from "vitest";
14-
import { useAutoCleanupTempDirTracker } from "../../../../test/helpers/temp-dir.js";
1514
import {
1615
buildCodexOpenClawPromptContext,
1716
buildCodexWatchedSessionsContext,
@@ -29,8 +28,6 @@ afterEach(() => {
2928
clearMemoryPluginState();
3029
});
3130

32-
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
33-
3431
describe("Codex app-server attempt context", () => {
3532
it("treats missing mirrored session history as empty without hook warning", async () => {
3633
const warn = vi.spyOn(embeddedAgentLog, "warn").mockImplementation(() => undefined);
@@ -151,28 +148,32 @@ describe("Codex app-server attempt context", () => {
151148
});
152149

153150
it("does not load OpenClaw-managed workspace context when injection is never", async () => {
154-
const workspaceDir = tempDirs.make("codex-context-injection-never-");
155-
await fs.writeFile(path.join(workspaceDir, "SOUL.md"), "must not reach the prompt");
151+
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "codex-context-injection-never-"));
152+
try {
153+
await fs.writeFile(path.join(workspaceDir, "SOUL.md"), "must not reach the prompt");
156154

157-
const context = await buildCodexWorkspaceBootstrapContext({
158-
params: {
159-
sessionId: "session-1",
160-
sessionKey: "agent:main:session-1",
161-
agentId: "main",
162-
config: {
163-
agents: {
164-
defaults: { workspace: workspaceDir, contextInjection: "never" },
155+
const context = await buildCodexWorkspaceBootstrapContext({
156+
params: {
157+
sessionId: "session-1",
158+
sessionKey: "agent:main:session-1",
159+
agentId: "main",
160+
config: {
161+
agents: {
162+
defaults: { workspace: workspaceDir, contextInjection: "never" },
163+
},
165164
},
166-
},
167-
} as EmbeddedRunAttemptParams,
168-
resolvedWorkspace: workspaceDir,
169-
effectiveWorkspace: workspaceDir,
170-
sessionKey: "agent:main:session-1",
171-
sessionAgentId: "main",
172-
memoryToolNames: [],
173-
});
165+
} as EmbeddedRunAttemptParams,
166+
resolvedWorkspace: workspaceDir,
167+
effectiveWorkspace: workspaceDir,
168+
sessionKey: "agent:main:session-1",
169+
sessionAgentId: "main",
170+
memoryToolNames: [],
171+
});
174172

175-
expect(context).toEqual({ bootstrapFiles: [], contextFiles: [] });
173+
expect(context).toEqual({ bootstrapFiles: [], contextFiles: [] });
174+
} finally {
175+
await fs.rm(workspaceDir, { recursive: true, force: true });
176+
}
176177
});
177178

178179
it("passes agent context to Codex memory collaboration guidance", async () => {

‎scripts/plugin-sdk-surface-report.mts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ export function readPluginSdkSurfaceBudgets(env: NodeJS.ProcessEnv = process.env
272272
// +1: normalized Gateway public origin resolver for plugin-generated links.
273273
// -2: retire the dead progress-draft render reader; it counted twice via
274274
// channel-outbound and channel-message's wildcard re-export of it.
275-
4306,
275+
// +1: context-injection mode resolver for bundled agent harnesses.
276+
4307,
276277
env,
277278
),
278279
publicFunctionExports: readPluginSdkSurfaceBudgetEnv(
@@ -341,7 +342,8 @@ export function readPluginSdkSurfaceBudgets(env: NodeJS.ProcessEnv = process.env
341342
// +1: normalized Gateway public origin resolver for plugin-generated links.
342343
// -2: retire the dead progress-draft render reader; it counted twice via
343344
// channel-outbound and channel-message's wildcard re-export of it.
344-
2570,
345+
// +1: context-injection mode resolver for bundled agent harnesses.
346+
2571,
345347
env,
346348
),
347349
publicDeprecatedExports: readPluginSdkSurfaceBudgetEnv(

0 commit comments

Comments
 (0)