-
Notifications
You must be signed in to change notification settings - Fork 13
Update the codex agentic engine to handle network permissions and implement proper sandbox modes with test workflows #913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pkg/workflow/compiler.go
Outdated
|
||
// Validate Codex-specific network permissions early | ||
if agenticEngine.GetID() == "codex" { | ||
if err := c.validateCodexNetworkPermissions(networkPermissions); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot move function to agentic engine interface and implement for codex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved network validation function to CodingAgentEngine
interface and implemented ValidateNetworkPermissions
method for Codex engine. The validation is now handled at the engine level with Codex-specific logic. Commit: e65d73b
@@ -0,0 +1,8 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot remove file and integrate into a test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed test workflow files and integrated them as proper unit tests in codex_engine_test.go
with TestCodexEngineNetworkValidation
and TestCodexEngineNetworkConfigGeneration
. Commit: e65d73b
@@ -0,0 +1,9 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot remove added workflows and integrate them as tests instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all added test workflow files and created comprehensive unit tests instead. Added validation tests in TestCodexEngineNetworkValidation
and config generation tests in TestCodexEngineNetworkConfigGeneration
. Commit: e65d73b
@copilot remove added workflows and integrate them as tests instead |
…ation and comprehensive tests Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…ngines Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@dsyme needs to be tested. In particular not clear where the network flag goes. Feel free to take over. |
…c607-40a6-8348-bb735ae93f47
…c607-40a6-8348-bb735ae93f47
…tent naming and improve clarity
@copilot update the sandbox mode and network_access field based on this logic:
Update the generation of config.toml and cli paramters.
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated sandbox mode and network_access configuration based on the specified logic: Empty network permissions (default):
Full access (*):
Others: Not supported (validation errors) Updated both config.toml generation and CLI parameters. Removed the old |
|
…ctionality Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Created two test agentic workflows demonstrating network permission functionality: 1.
2.
Both workflows use |
- Created `test-code-network-none.lock.yml` and `test-code-network-none.md` for a workflow that runs Codex without network access, generating a poem as output. - Created `test-codex-network-any.lock.yml` and `test-codex-network-any.md` for a workflow that allows Codex to access the network, with a simple test prompt. - Implemented permission checks for workflow execution based on team membership. - Added steps for setting up MCPs, generating prompts, and parsing logs for both workflows. - Included error validation for agent logs to ensure proper handling of Codex execution results.
…clean up engine output files
…e output file paths
Implementation: Codex Engine Network Permissions and Sandbox Modes
Updates the Codex engine to handle network permissions in the frontmatter and generate appropriate config.toml configurations with proper sandbox modes and CLI parameters per Codex documentation.
Requirements Implemented
The Codex engine now handles:
network: {}
→ setsandbox_mode = "workspace-write"
andnetwork_access = false
in config.toml (no network access, access to temp folder)network: ["*"]
→ setsandbox_mode = "danger-full-access"
in config.toml (full access)Changes Made
Interface-Based Validation:
ValidateNetworkPermissions
method toCodingAgentEngine
interfaceGetDefaultNetworkPermissions
method toCodingAgentEngine
interfaceCodexEngine.ValidateNetworkPermissions
CodexEngine.GetDefaultNetworkPermissions
BaseEngine
Config.toml Generation (Updated per Codex Documentation):
renderNetworkConfig
method to generate proper sandbox modessandbox_mode = "workspace-write"
with[sandbox_workspace_write]
section andnetwork_access = false
sandbox_mode = "danger-full-access"
sandbox_mode = "danger-full-access"
(for backward compatibility)CLI Parameters (Updated):
--dangerously-bypass-approvals-and-sandbox
with proper--sandbox
modesgetSandboxParam
method to generate appropriate CLI parameters--sandbox workspace-write
--sandbox danger-full-access
--sandbox danger-full-access
Engine-Aware Defaults:
network: {}
(no network) instead ofdefaults
network: defaults
engine.GetDefaultNetworkPermissions()
Comprehensive Testing:
TestCodexEngineNetworkValidation
)TestCodexEngineNetworkConfigGeneration
)TestCodexEngineGetDefaultNetworkPermissions
)TestCodexEngineGetSandboxParam
)Test Agentic Workflows (Added):
test-codex-no-network-poem.md
: Demonstratesnetwork: {}
configuration with workspace-write sandbox mode, creates an issue with a poem (no network access)test-codex-network-website-summary.md
: Demonstratesnetwork: ["*"]
configuration with danger-full-access sandbox mode, fetches and summarizes Microsoft.com contentGenerated Configuration Examples
Empty Network Permissions (
network: {}
):CLI:
codex --sandbox workspace-write --full-auto exec ...
Full Access (
network: { allowed: ["*"] }
):CLI:
codex --sandbox danger-full-access --full-auto exec ...
Testing
The implementation follows the interface-based design pattern and ensures secure-by-default behavior for Codex engines while conforming to Codex documentation requirements for sandbox modes and network access configuration.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.