You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Description
- Removed variables for hardcoded configuration options, and replaced
with variables for base config, and additional mcp servers.
- Set module defaults so that this will run with minimal module
configuration for tasks, while allowing further configuration if needed
by the user for codex through the base configuration.
- Updated tests for expected responses and new configuration options.
- Move all codex related files outside of project folder.
<!-- Briefly describe what this PR does and why -->
## Type of Change
- [ ] New module
- [ ] Bug fix
- [X] Feature/enhancement
- [ ] Documentation
- [ ] Other
## Module Information
<!-- Delete this section if not applicable -->
**Path:** `registry/coder-labs/modules/codex`
**New version:** `v1.1.0`
**Breaking change:** [X] Yes [ ] No
## Testing & Validation
- [X] Tests pass (`bun test`)
- [X] Code formatted (`bun run fmt`)
- [X] Changes tested locally
## Related Issues
<!-- Link related issues or write "None" if not applicable -->
---------
Co-authored-by: Atif Ali <[email protected]>
> **Security Notice**: This module configures Codex with a `workspace-write` sandbox that allows AI tasks to read/write files in the specified folder. While the sandbox provides security boundaries, Codex can still modify files within the workspace. Use this module in trusted environments and be aware of the security implications.
78
+
> This module configures Codex with a `workspace-write` sandbox that allows AI tasks to read/write files in the specified folder. While the sandbox provides security boundaries, Codex can still modify files within the workspace. Use this module_only_ in trusted environments and be aware of the security implications.
78
79
79
80
## How it Works
80
81
81
82
-**Install**: The module installs Codex CLI and sets up the environment
82
-
-**System Prompt**: If `codex_system_prompt`and `folder` are set, creates the directory (if needed) and writes the prompt to `AGENTS.md`
83
+
-**System Prompt**: If `codex_system_prompt`is set, writes the prompt to `AGENTS.md` in the `~/.codex/` directory
83
84
-**Start**: Launches Codex CLI in the specified directory, wrapped by AgentAPI
84
85
-**Configuration**: Sets `OPENAI_API_KEY` environment variable and passes `--model` flag to Codex CLI (if variables provided)
85
86
86
-
## Sandbox Configuration
87
-
88
-
The module automatically configures Codex with a secure sandbox that allows AI tasks to work effectively:
89
-
90
-
-**Sandbox Mode**: `workspace-write` - Allows Codex to read/write files in the specified `folder`
91
-
-**Approval Policy**: `on-request` - Codex asks for permission before performing potentially risky operations
92
-
-**Network Access**: Enabled within the workspace for package installation and API calls
93
-
94
-
### Customizing Sandbox Behavior
87
+
## Configuration
95
88
96
-
You can customize the sandbox behavior using dedicated variables:
89
+
### Default Configuration
97
90
98
-
#### **Using Dedicated Variables (Recommended)**
91
+
When no custom `base_config_toml` is provided, the module uses these secure defaults:
99
92
100
-
For most use cases, use the dedicated sandbox variables:
> The dedicated variables (`sandbox_mode`, `approval_policy`, `network_access`) are the recommended way to configure sandbox behavior. Use `extra_codex_settings_toml` only for advanced configuration that isn't covered by the dedicated variables.
130
+
> If no custom configuration is provided, the module uses secure defaults. The Coder MCP server is always included automatically. For containerized workspaces (Docker/Kubernetes), you may need `sandbox_mode = "danger-full-access"` to avoid permission issues. For advanced options, see [Codex config docs](https://github.com/openai/codex/blob/main/codex-rs/config.md).
140
131
141
132
## Troubleshooting
142
133
@@ -150,6 +141,6 @@ module "codex" {
150
141
151
142
## References
152
143
153
-
-[OpenAI API Documentation](https://platform.openai.com/docs)
0 commit comments