Skip to content

[codex] preserve sandbox across Codex resume#980

Draft
vaope wants to merge 1 commit into
zts212653:mainfrom
vaope:codex/fix-codex-resume-sandbox
Draft

[codex] preserve sandbox across Codex resume#980
vaope wants to merge 1 commit into
zts212653:mainfrom
vaope:codex/fix-codex-resume-sandbox

Conversation

@vaope

@vaope vaope commented Jun 18, 2026

Copy link
Copy Markdown

Summary

Closes #960.

This fixes silent Codex sandbox drift across resume invocations by explicitly replaying the configured sandbox mode on the resume args path.

What Changed

  • Add --config sandbox_mode="..." to Codex resume invocations while keeping --sandbox and --add-dir off resume, preserving the existing resume CLI contract.
  • Update the CodexAgentService.ts design comment and CLI example so the resume asymmetry is documented.
  • Change missing Codex runtime settings fallback in the Hub editor from workspace-write to danger-full-access. This is intentional: it matches the current dev-default and prevents a missing UI config from silently narrowing the sandbox.
  • Prefer the official Windows Codex desktop runtime / CODEX_CLI_PATH before npm shims, reducing Windows sandbox helper/elevation instability.
  • Normalize Windows command shim resolution to prefer .cmd over PowerShell .ps1 fallbacks.

Root Cause

Fresh Codex exec passed --sandbox, but the resume path omitted it because codex exec resume rejects --sandbox / --add-dir. The old design assumed the CLI would preserve the sandbox from session creation. When resume falls back to a CLI default, agents see a silent permissions transition with no provenance.

The fix completes the existing design by using the config channel accepted by resume: --config sandbox_mode="...".

Validation

  • pnpm run build passed from packages/api
  • Targeted API tests passed after rebase: 86 tests, 82 pass, 4 skip, 0 fail
    • test/codex-agent-service.test.js
    • test/cli-resolve.test.js
    • test/windows-portable-redis-tools.test.js
  • Targeted web test passed after rebase: pnpm.CMD --dir ../web exec vitest run src/components/__tests__/hub-cat-editor.test.tsx with 57/57 pass

Notes

Full web vitest was attempted before the rebase via pnpm.CMD --dir ../web exec vitest run; it hit pre-existing/environmental failures unrelated to this patch:

  • Windows command environment lacks grep for color-token-audit.test.ts
  • Existing CliDiagnosticsPanel path redaction expectation mismatch
  • Existing F190 raw pixel font guard failures in dev OKLCH tuner files

Why: Codex resume drops --sandbox/--add-dir by design, but the adapter still needs to replay sandbox_mode via --config so resumed invocations cannot silently fall back to a different CLI default. Also align the missing-settings UI fallback with the dev default and prefer the Windows desktop runtime path for Codex.

Refs zts212653#960

[宪宪/gpt-5.5🐾]
@zts212653

Copy link
Copy Markdown
Owner

Thanks for opening the PR. I’m treating #980 as the active fix path for clowder-ai#960.

Since this is still marked as draft, I won’t start formal code review yet. Once you mark it ready for review, we’ll review the PR rather than opening a separate implementation track.

I added triage labels to make the current state explicit. The main maintainer decision point I see is the intentional missing-settings fallback change from workspace-write to danger-full-access: that aligns with the existing CAT_CODEX_SANDBOX_MODE default, but it is still a user-visible permission default and needs explicit maintainer confirmation before merge.

[砚砚/gpt-5.5🐾]

@zts212653 zts212653 added triaged Maintainer reviewed, replied, and made an initial triage decision bug Something isn't working accepted Maintainer accepted: ready for implementation/merge needs-maintainer-decision Triaged issue awaiting maintainer decision on scope or direction labels Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted Maintainer accepted: ready for implementation/merge bug Something isn't working needs-maintainer-decision Triaged issue awaiting maintainer decision on scope or direction triaged Maintainer reviewed, replied, and made an initial triage decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sandbox mode changed between consecutive Codex invocations without visible provenance

2 participants