@@ -11,7 +11,6 @@ import {
1111 registerMemoryCapability ,
1212} from "openclaw/plugin-sdk/memory-host-core" ;
1313import { afterEach , describe , expect , it , vi } from "vitest" ;
14- import { useAutoCleanupTempDirTracker } from "../../../../test/helpers/temp-dir.js" ;
1514import {
1615 buildCodexOpenClawPromptContext ,
1716 buildCodexWatchedSessionsContext ,
@@ -29,8 +28,6 @@ afterEach(() => {
2928 clearMemoryPluginState ( ) ;
3029} ) ;
3130
32- const tempDirs = useAutoCleanupTempDirTracker ( afterEach ) ;
33-
3431describe ( "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 ( ) => {
0 commit comments