@@ -141,6 +141,7 @@ describe("Codex app-server attempt context", () => {
141141 sessionKey : "agent:main:session-1" ,
142142 sessionAgentId : "main" ,
143143 memoryToolNames : [ "memory_search" , "memory_get" ] ,
144+ ringZeroActive : false ,
144145 } ) ;
145146
146147 expect ( context . memoryReferenceFiles ) . toEqual ( [ ] ) ;
@@ -181,6 +182,7 @@ describe("Codex app-server attempt context", () => {
181182 sessionKey : "agent:marketing-agent:session-1" ,
182183 sessionAgentId : "marketing-agent" ,
183184 memoryToolNames : [ "memory_search" , "memory_get" ] ,
185+ ringZeroActive : false ,
184186 sandboxed : true ,
185187 } ) ;
186188
@@ -219,6 +221,7 @@ describe("Codex app-server attempt context", () => {
219221 sessionKey : "agent:main:session-1" ,
220222 sessionAgentId : "main" ,
221223 memoryToolNames : [ "memory_search" , "memory_get" ] ,
224+ ringZeroActive : false ,
222225 } ) ;
223226
224227 expect ( context . threadDeveloperInstructions ) . toContain ( "Canonical agent instructions" ) ;
@@ -241,6 +244,37 @@ describe("Codex app-server attempt context", () => {
241244 }
242245 } ) ;
243246
247+ it ( "keeps ambient workspace instructions out of overlapping ring-zero restrictions" , async ( ) => {
248+ const workspaceDir = await fs . mkdtemp ( path . join ( os . tmpdir ( ) , "codex-ring-zero-workspace-" ) ) ;
249+ const executionDir = await fs . mkdtemp ( path . join ( os . tmpdir ( ) , "codex-ring-zero-execution-" ) ) ;
250+ await fs . writeFile ( path . join ( workspaceDir , "AGENTS.md" ) , "Ambient workspace instructions" ) ;
251+
252+ try {
253+ const context = await buildCodexWorkspaceBootstrapContext ( {
254+ params : {
255+ sessionId : "session-1" ,
256+ sessionKey : "agent:openclaw:session-1" ,
257+ toolsAllow : [ "openclaw" ] ,
258+ pluginHarnessToolPolicyRestricted : true ,
259+ config : { agents : { defaults : { workspace : workspaceDir } } } ,
260+ } as EmbeddedRunAttemptParams ,
261+ resolvedWorkspace : workspaceDir ,
262+ executionWorkspace : executionDir ,
263+ effectiveWorkspace : executionDir ,
264+ sessionKey : "agent:openclaw:session-1" ,
265+ sessionAgentId : "openclaw" ,
266+ memoryToolNames : [ ] ,
267+ ringZeroActive : true ,
268+ } ) ;
269+
270+ expect ( context . threadDeveloperInstructions ) . toBeUndefined ( ) ;
271+ expect ( context . threadDeveloperInstructionFiles ) . toEqual ( [ ] ) ;
272+ } finally {
273+ await fs . rm ( workspaceDir , { recursive : true , force : true } ) ;
274+ await fs . rm ( executionDir , { recursive : true , force : true } ) ;
275+ }
276+ } ) ;
277+
244278 it ( "reads and compares thread-bootstrap context-engine projections" , ( ) => {
245279 const projection = readContextEngineThreadBootstrapProjection ( {
246280 mode : "thread_bootstrap" ,
0 commit comments