Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test-codex.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions pkg/workflow/codex_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ func NewCodexEngine() *CodexEngine {
BaseEngine: BaseEngine{
id: "codex",
displayName: "Codex",
description: "Uses OpenAI Codex CLI (experimental)",
description: "Uses OpenAI Codex CLI with MCP server support",
experimental: true,
supportsToolsWhitelist: false,
supportsToolsWhitelist: true,
},
}
}
Expand Down Expand Up @@ -74,6 +74,10 @@ codex exec \
func (e *CodexEngine) RenderMCPConfig(yaml *strings.Builder, tools map[string]any, mcpTools []string) {
yaml.WriteString(" cat > /tmp/mcp-config/config.toml << EOF\n")

// Add history configuration to disable persistence
yaml.WriteString(" [history]\n")
yaml.WriteString(" persistence = \"none\"\n")

// Generate [mcp_servers] section
for _, toolName := range mcpTools {
switch toolName {
Expand Down
4 changes: 2 additions & 2 deletions pkg/workflow/codex_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func TestCodexEngine(t *testing.T) {
t.Error("Codex engine should be experimental")
}

if engine.SupportsToolsWhitelist() {
t.Error("Codex engine should not support MCP tools")
if !engine.SupportsToolsWhitelist() {
t.Error("Codex engine should support MCP tools")
}

// Test installation steps
Expand Down
40 changes: 40 additions & 0 deletions pkg/workflow/codex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ This is a test workflow.
if !strings.Contains(lockContent, "[mcp_servers.github]") {
t.Errorf("Expected lock file to contain '[mcp_servers.github]' section in config.toml but it didn't.\nContent:\n%s", lockContent)
}
// Check that history configuration is present
if !strings.Contains(lockContent, "[history]") {
t.Errorf("Expected lock file to contain '[history]' section in config.toml but it didn't.\nContent:\n%s", lockContent)
}
if !strings.Contains(lockContent, "persistence = \"none\"") {
t.Errorf("Expected lock file to contain 'persistence = \"none\"' in config.toml but it didn't.\nContent:\n%s", lockContent)
}
// Ensure it does NOT contain mcp-servers.json
if strings.Contains(lockContent, "mcp-servers.json") {
t.Errorf("Expected lock file to NOT contain 'mcp-servers.json' when using codex.\nContent:\n%s", lockContent)
Expand Down Expand Up @@ -289,6 +296,27 @@ tools:
expectMcpServersJson: true,
expectCodexHome: false,
},
{
name: "codex with custom MCP tools generates config.toml",
frontmatter: `---
engine: codex
tools:
github:
allowed: [get_issue, create_issue]
custom-server:
mcp:
type: stdio
command: "python"
args: ["-m", "my_server"]
env:
API_KEY: "{{ secrets.API_KEY }}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot missing $

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 1ea81dc. The missing $ has been added to both the test input and assertion to use the correct GitHub Actions template syntax: ${{ secrets.API_KEY }}.

allowed: ["*"]
---`,
expectedAI: "codex",
expectConfigToml: true,
expectMcpServersJson: false,
expectCodexHome: true,
},
}

for _, tt := range tests {
Expand Down Expand Up @@ -332,6 +360,18 @@ This is a test workflow for MCP configuration with different AI engines.
if !strings.Contains(lockContent, "command = \"docker\"") {
t.Errorf("Expected docker command in config.toml but didn't find it in:\n%s", lockContent)
}
// Check for custom MCP server if test includes it
if strings.Contains(tt.name, "custom MCP") {
if !strings.Contains(lockContent, "[mcp_servers.custom-server]") {
t.Errorf("Expected [mcp_servers.custom-server] section but didn't find it in:\n%s", lockContent)
}
if !strings.Contains(lockContent, "command = \"python\"") {
t.Errorf("Expected python command for custom server but didn't find it in:\n%s", lockContent)
}
if !strings.Contains(lockContent, "\"API_KEY\" = \"{{ secrets.API_KEY }}\"") {
t.Errorf("Expected API_KEY env var for custom server but didn't find it in:\n%s", lockContent)
}
}
// Should NOT have services section (services mode removed)
if strings.Contains(lockContent, "services:") {
t.Errorf("Expected NO services section in workflow but found it in:\n%s", lockContent)
Expand Down
Loading