@@ -19,11 +19,12 @@ func (e *CodexEngine) RenderMCPConfig(yaml *strings.Builder, tools map[string]an
1919 // Codex uses TOML format without Copilot-specific fields and multi-line args
2020 createRenderer := func (isLast bool ) * MCPConfigRendererUnified {
2121 return NewMCPConfigRenderer (MCPRendererOptions {
22- IncludeCopilotFields : false , // Codex doesn't use "type" and "tools" fields
23- InlineArgs : false , // Codex uses multi-line args format
24- Format : "toml" ,
25- IsLast : isLast ,
26- ActionMode : GetActionModeFromWorkflowData (workflowData ),
22+ IncludeCopilotFields : false , // Codex doesn't use "type" and "tools" fields
23+ InlineArgs : false , // Codex uses multi-line args format
24+ Format : "toml" ,
25+ IsLast : isLast ,
26+ ActionMode : GetActionModeFromWorkflowData (workflowData ),
27+ WriteSinkGuardPolicies : deriveWriteSinkGuardPolicyFromWorkflow (workflowData ),
2728 })
2829 }
2930
@@ -69,7 +70,7 @@ func (e *CodexEngine) RenderMCPConfig(yaml *strings.Builder, tools map[string]an
6970 renderer .RenderMCPScriptsMCP (yaml , workflowData .MCPScripts , workflowData )
7071 }
7172 case "web-fetch" :
72- renderMCPFetchServerConfig (yaml , "toml" , " " , false , false )
73+ renderMCPFetchServerConfig (yaml , "toml" , " " , false , false , deriveWriteSinkGuardPolicyFromWorkflow ( workflowData ) )
7374 default :
7475 // Handle custom MCP tools using shared helper (with adapter for isLast parameter)
7576 HandleCustomMCPToolInSwitch (yaml , toolName , expandedTools , false , func (yaml * strings.Builder , toolName string , toolConfig map [string ]any , isLast bool ) error {
@@ -112,11 +113,12 @@ func (e *CodexEngine) RenderMCPConfig(yaml *strings.Builder, tools map[string]an
112113 actionMode = workflowData .ActionMode
113114 }
114115 return NewMCPConfigRenderer (MCPRendererOptions {
115- IncludeCopilotFields : false , // Gateway doesn't need Copilot fields
116- InlineArgs : false , // Use standard multi-line format
117- Format : "json" ,
118- IsLast : isLast ,
119- ActionMode : actionMode ,
116+ IncludeCopilotFields : false , // Gateway doesn't need Copilot fields
117+ InlineArgs : false , // Use standard multi-line format
118+ Format : "json" ,
119+ IsLast : isLast ,
120+ ActionMode : actionMode ,
121+ WriteSinkGuardPolicies : deriveWriteSinkGuardPolicyFromWorkflow (workflowData ),
120122 })
121123 }
122124
@@ -152,7 +154,7 @@ func (e *CodexEngine) RenderMCPConfig(yaml *strings.Builder, tools map[string]an
152154 renderer .RenderMCPScriptsMCP (yaml , mcpScripts , workflowData )
153155 },
154156 RenderWebFetch : func (yaml * strings.Builder , isLast bool ) {
155- renderMCPFetchServerConfig (yaml , "json" , " " , isLast , false )
157+ renderMCPFetchServerConfig (yaml , "json" , " " , isLast , false , deriveWriteSinkGuardPolicyFromWorkflow ( workflowData ) )
156158 },
157159 RenderCustomMCPConfig : func (yaml * strings.Builder , toolName string , toolConfig map [string ]any , isLast bool ) error {
158160 return e .renderCodexJSONMCPConfigWithContext (yaml , toolName , toolConfig , isLast , workflowData )
@@ -177,6 +179,7 @@ func (e *CodexEngine) renderCodexMCPConfigWithContext(yaml *strings.Builder, too
177179 IndentLevel : " " ,
178180 Format : "toml" ,
179181 RewriteLocalhostToDocker : rewriteLocalhost ,
182+ GuardPolicies : deriveWriteSinkGuardPolicyFromWorkflow (workflowData ),
180183 }
181184
182185 err := renderSharedMCPConfig (yaml , toolName , toolConfig , renderer )
@@ -200,6 +203,7 @@ func (e *CodexEngine) renderCodexJSONMCPConfigWithContext(yaml *strings.Builder,
200203 Format : "json" ,
201204 IndentLevel : " " ,
202205 RewriteLocalhostToDocker : rewriteLocalhost ,
206+ GuardPolicies : deriveWriteSinkGuardPolicyFromWorkflow (workflowData ),
203207 }
204208
205209 yaml .WriteString (" \" " + toolName + "\" : {\n " )
0 commit comments