Repository navigation
Description
User story
As an agent delegating a write task through /external-agents:antigravity or /external-agents:codex, I name up front the exact directories the task needs beyond its worktree, so the external agent can finish without a refused write and without broader access than the task needs.
Today a write run is always workspace-only:
- Antigravity:
providers/antigravity.yamlwrite mode setsallowNonWorkspaceAccess: false, and--add-diris passed only forreview. - Codex:
providers/codex.yamlwrite mode passes--sandbox workspace-writeonly.
Both CLIs already accept extra writable directories: agy --add-dir ("Add a directory to the workspace (repeatable)", agy --help, 1.5.14) and codex exec --add-dir <DIR> ("Additional directories that should be writable alongside the primary workspace", codex exec --help, 0.169.1).
A second, smaller gap, found on agy 1.5.14: in headless print mode agy checks auto-mode availability before silent auth, so it prints --mode auto is not available for this account; continuing in the default mode, then switches to auto anyway. agy's own log (~/.gemini/antigravity-cli/log/cli-*.log) shows printmode.go:903 ... --mode auto is unavailable (rollout flag off), then silent auth succeeded, SetCycleMode called: auto, and auto mode: auto-approving file write. The plugin relays the first line as notice: the CLI warned: --mode auto is not available, so a correct auto-mode run reads like a fallback. This is an agy defect; the plugin only needs to stop presenting it as a fallback.
Acceptance criteria
external-agents run <antigravity|codex> --use task --mode writetakes a repeatable--add-dir <absolute path>, mapped to each CLI's own flag (agy--add-dir, codex--add-dir). Without the flag, behavior is unchanged: workspace-only.--add-diris refused (exit 2) for read-only runs and for a path that does not exist, and every added directory is recorded in the job record and printed inexternal-agents status <job>.- The antigravity and codex skills tell the delegating agent to work out, before the run, every directory outside the worktree the task will write, pass exactly those, and pass none when the worktree suffices; the prompt names them too.
- For Antigravity, a write run whose agy log for that run shows
SetCycleMode called: autoafter the fallback line is not reported as a fallback; the notice says auto mode was applied. A real fallback (no such line) keeps today's notice. - Tests cover both CLIs' argument mapping, the refusals, and both fallback-notice cases.
Affected area / component
plugins/external-agents: providers/antigravity.yaml, providers/codex.yaml, scripts/lib/runner.mjs, scripts/lib/outcome.mjs, skills/antigravity, skills/codex.
Owner decision (user, this session): per-run directories named up front by the delegating agent; worktree-only stays the default; no blanket non-workspace access.
Metadata
Metadata
Assignees
Labels
Type
Fields
Work status
Priority
Activity
github-actions commentedon Nov 22, 2026
Size: Medium
Complexity: Medium
Uncertainty: Known
Flags: none
Blocked by: none
Blast radius: the external-agents plugin (antigravity and codex provider files, runner and outcome scripts, two skills, tests); read by agents that delegate write runs.
Reversible: yes; revert the change. Without
--add-dir, runs stay workspace-only.Open questions: none
Understood: add a repeatable
--add-dir <absolute path>to write runs for antigravity and codex, with refusals, job-record and status output, and skill guidance. Also stop the antigravity notice from reading as an auto-mode fallback when agy's log shows auto mode was applied. The design and done-when are exact. No duplicate or merged fix found; #18179 touches the antigravity breaker but is a different change.Automated triage. A maintainer reviews it.
melodic-automation-lanes commentedon Nov 22, 2026
Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed
- [ ]criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).kyle-sexton commentedon Nov 22, 2026
Owner decision (this session): hard fence by default for Antigravity write runs.
In auto mode, agy can ask to run a command outside its terminal sandbox, and its own safety check then lets "safe, reversible" commands run with full disk and network access (sandbox docs). The per-run
--add-dirlist fences only the sandbox, so it does not bound those commands. agy's log for a run today shows two such requests (a test script and shellcheck).Added acceptance criteria:
--mode accept-editswith per-run settingsenableTerminalSandbox: true,toolPermission: "proceed-in-sandbox"andallowNonWorkspaceAccess: false. Workspace edits and sandboxed commands run without prompting (modes, sandbox CLI configuration), and a request to run outside the sandbox needs a prompt, which a headless run cannot answer, so it is refused and recorded through the existingpermission that headless mode cannot prompt forsoft-deny rule.external-agents run antigravity --use task --mode writetakes an explicit opt-in (for example--unsandboxed auto) that restores today's--mode autobehavior for one run. The job record andstatusshow which fence the run used.codex exec --sandbox workspace-writeand passes neither--approve-for-me("Route approval requests through automatic review using the workspace-write sandbox",codex exec --help, 0.169.1) nor--dangerously-bypass-approvals-and-sandbox, andproviders/codex.yamlalready records declined command items. So Codex's default is already fenced. Keep it that way, and offer--approve-for-meonly through the same explicit per-run opt-in. Codex otherwise needs only the--add-dirpart.kyle-sexton commentedon Nov 22, 2026
Owner decision (2026-11-22, in session, owner's words: "Sure, go with recommendations."): the Codex parity criterion is amended. Codex keeps its fenced default (
codex exec --sandbox workspace-write, no--approve-for-me, no--dangerously-bypass-approvals-and-sandbox) and gets no per-run opt-in for--approve-for-me; it takes only--add-dir. Reason: no task needs Codex approvals today, the fenced default already serves write tasks, and the opt-in would add an escape path nobody uses. This supersedes "offer--approve-for-meonly through the same explicit per-run opt-in" in #18213 (comment).kyle-sexton commentedon Nov 22, 2026
Live check against real agy 1.5.14 on WSL, merged code from #18240:
sandbox, per-run settings{"enableTerminalSandbox":true,"toolPermission":"proceed-in-sandbox","allowNonWorkspaceAccess":false}. The workspace write landed; the one outside-sandbox command (curl -sI https://example.com) was auto-denied (a tool required the "command" permission that headless mode cannot prompt for,denied_actions: [{action: command}]) and the run recordedblocked-by-mode, exit 3.--unsandboxed auto: job fenceunsandboxed auto; agy's per-run log shows the--mode auto is unavailablewarning thenSetCycleMode called: auto, and the command reported the mode as applied, not a fallback. The workspace write landed, exit 0.chezmoi statusshows no drift on agy's settings.json after both runs.