-
Notifications
You must be signed in to change notification settings - Fork 855
Respect Codex sandbox config in plugin threads #241
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,8 @@ const REVIEW_SCHEMA = path.join(ROOT_DIR, "schemas", "review-output.schema.json" | |
| const DEFAULT_STATUS_WAIT_TIMEOUT_MS = 240000; | ||
| const DEFAULT_STATUS_POLL_INTERVAL_MS = 2000; | ||
| const VALID_REASONING_EFFORTS = new Set(["none", "minimal", "low", "medium", "high", "xhigh"]); | ||
| const VALID_SANDBOX_MODES = new Set(["read-only", "workspace-write", "danger-full-access"]); | ||
| const SANDBOX_MODE_ENV = "CODEX_COMPANION_SANDBOX_MODE"; | ||
| const MODEL_ALIASES = new Map([["spark", "gpt-5.3-codex-spark"]]); | ||
| const STOP_REVIEW_TASK_MARKER = "Run a stop-gate review of the previous Claude turn."; | ||
|
|
||
|
|
@@ -153,6 +155,20 @@ function resolveCommandWorkspace(options = {}) { | |
| return resolveWorkspaceRoot(resolveCommandCwd(options)); | ||
| } | ||
|
|
||
| function resolveSandboxMode(defaultMode) { | ||
| const configured = process.env[SANDBOX_MODE_ENV]?.trim(); | ||
| if (!configured) { | ||
| return defaultMode; | ||
| } | ||
| if (configured === "inherit") { | ||
| return null; | ||
| } | ||
| if (VALID_SANDBOX_MODES.has(configured)) { | ||
| return configured; | ||
| } | ||
| throw new Error(`Invalid ${SANDBOX_MODE_ENV}: ${configured}`); | ||
| } | ||
|
|
||
| function sleep(ms) { | ||
| return new Promise((resolve) => setTimeout(resolve, ms)); | ||
| } | ||
|
|
@@ -367,6 +383,7 @@ async function executeReviewRun(request) { | |
| const result = await runAppServerReview(request.cwd, { | ||
| target: reviewTarget, | ||
| model: request.model, | ||
| sandbox: resolveSandboxMode("read-only"), | ||
| onProgress: request.onProgress | ||
| }); | ||
| const payload = { | ||
|
|
@@ -408,7 +425,7 @@ async function executeReviewRun(request) { | |
| const result = await runAppServerTurn(context.repoRoot, { | ||
| prompt, | ||
| model: request.model, | ||
| sandbox: "read-only", | ||
| sandbox: resolveSandboxMode("read-only"), | ||
| outputSchema: readOutputSchema(REVIEW_SCHEMA), | ||
| onProgress: request.onProgress | ||
| }); | ||
|
|
@@ -485,7 +502,7 @@ async function executeTaskRun(request) { | |
| defaultPrompt: resumeThreadId ? DEFAULT_CONTINUE_PROMPT : "", | ||
| model: request.model, | ||
| effort: request.effort, | ||
|
Comment on lines
502
to
504
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 56cb002. |
||
| sandbox: request.write ? "workspace-write" : "read-only", | ||
| sandbox: resolveSandboxMode(request.write ? "workspace-write" : "read-only"), | ||
| onProgress: request.onProgress, | ||
| persistThread: true, | ||
| threadName: resumeThreadId ? null : buildPersistentTaskThreadName(request.prompt || DEFAULT_CONTINUE_PROMPT) | ||
|
|
||
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.
This call no longer pins a sandbox mode for adversarial reviews, so
/codex:adversarial-reviewnow inherits the user's global Codex sandbox. In environments configured asworkspace-writeordanger-full-access, the review turn can run with write-capable tooling and mutate the repo, which breaks the command’s documented read-only contract (README.mdsays adversarial review "does not fix code"). Please keep review flows explicitly read-only (or otherwise enforce read-only behavior independent of global task defaults).Useful? React with 👍 / 👎.
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.
Addressed in 56cb002. Native and adversarial review flows now keep the default
read-onlysandbox, preserving the documented review-only contract. The Codex-config inheritance path is now explicit viaCODEX_COMPANION_SANDBOX_MODE=inherit, with README and regression coverage for the opt-in behavior.