Repository navigation
feat(codex): pre-trust the spawn folder on disk before the PTY starts - #715
Merged
Merged
Conversation
Refs #714 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E9UW81kpTBiDPhZFpcpjf6
The user's explicit folder choice is the trust decision; recording it in $CODEX_HOME/config.toml before spawn means the trust dialog never appears for app-spawned sessions — retiring the keystroke-driven dialog path that produced four distinct failures in one day (#705 #711 #712 #713). One await early in CodexSession.start covers fresh spawns, recover/wake respawns, orchestration children, and worktree cwds at the single spawn site; the helper never throws and never gates the spawn, so the dialog condition/modal remain the fallback. Fixes #714 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E9UW81kpTBiDPhZFpcpjf6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Driving Codex's trust dialog with synthesized keystrokes produced four distinct production failures in one day — #705 (inverted accept bytes, Claude sibling), #711 (clicks refused invisibly), #712 (wake readiness timeout killing a live CLI waiting on its own dialog), #713 (app-hostage modal). One root: the dialog exists at all for sessions the app spawns into a folder the user explicitly chose.
Fixes #714.
Implemented behavior
The folder choice is the trust decision, so it gets recorded where Codex records it —
[projects."<path>"] trust_level = "trusted"in$CODEX_HOME/config.toml— before the PTY spawns, and the dialog never appears.ensureCodexProjectTrust(cwd)— append-only and format-preserving (the config is user-owned; codex-rs itself uses toml_edit to avoid destroying it), never modifies an existing entry (an explicit non-trusted decision must not be upgraded behind the user's back), stands down on inlineprojects = {…}tables (appending alongside one is a duplicate-key parse error that would stop Codex from launching), atomic temp+rename, never throws. Format verified against the live config (a dozen organic entries) and codex-rsset_project_trust_level.await ensureCodexProjectTrust(this.cwd)early inCodexSession.start()— before ownership handoff, resume preparation, and the "config/read must remain the final await before spawn" invariant — covering fresh panes, recover/wake respawns, orchestration children, and worktree cwds at the single spawn site. Failure modes deliberately never gate the spawn; the trust-dialog condition/modal remain the fallback (whose own defects bug(codex): trust dialog clicks are refused invisibly — keystroke never reaches the agent #711/bug(session): wake readiness timeout kills a live codex blocked on its trust dialog — 30s kill loop #712/bug(ui): one pane's condition modal blocks the entire application and hides its own failure toasts #713 stay open for the fallback path).Tests
trust:ensure → handoff → resume:start(the write precedes every ownership step and the spawn) and exactly-once-per-attempt, via the existing recorded launch-ladder harness (mock records trust calls in a separate channel so the exact-array assertions of the ladder tests stay byte-identical). Codex runtime suites 18/18;tscnode + web clean.Notes
hasTrustDialogAcceptedin~/.claude.json) is a named follow-up in feat(codex): pre-trust project folders on disk before spawn — retire the trust dialog for app-spawned sessions #714; the bug(claude): trust dialog accept confirms "No, exit" — new default highlight kills the session #705 dialog driver keeps Claude covered meanwhile.package-lock.jsonuntouched: the package'spackage.jsondid not change (path-alias consumption).🤖 Generated with Claude Code
https://claude.ai/code/session_01E9UW81kpTBiDPhZFpcpjf6