Repository navigation
fix(native-chat): apply or refuse saved Codex Arguments instead of silently dropping them - #26059
brennanb2025 wants to merge 11 commits into
Conversation
…lently dropping them Settings -> Agents -> Arguments is shared by terminal tabs and Codex native chat, and is written for the interactive `codex`. The chat launch put the Arguments before `app-server`, where Codex parses and then ignores -m, --search, --oss and --local-provider, and Orca itself silently dropped -s, -a, --profile, --add-dir, -C, -i, --strict-config and permission -c keys. A chat could run a different model or provider than the terminal, or a looser sandbox than `-s read-only` asked for, with no sign of it. Every saved Argument now either reaches Codex the way a terminal applies it, or the chat refuses to start and names the argument: - Pass after `app-server`: -c/--config (every key), --enable/--disable, --strict-config. - Translate to the config Codex itself derives: -m/--model -> model, --search -> web_search="live", --approve-for-me -> its three overrides. - Under Manual, -s/-a and -c sandbox_mode/approval_policy become the thread policy instead of Manual's defaults (validated); Yolo unchanged. - Refuse by name: --profile, --oss, --local-provider, --remote*, --add-dir, -C, -i, --worktree, --dangerously-bypass-hook-trust, prompts (also after --), invalid sandbox/approval values. - Drop: the bypass flag (Agent Permissions reads it), --yolo, display and help/version flags. The model-list probe launches with the same translated Arguments, its own config last. An unclosed quote in Arguments is now a named refusal for both agents, and the Agent Permissions tooltip says what the toggle does.
…w to fix refused Arguments A resumed Codex chat kept the approvals reviewer it last ran with, because the reviewer from --approve-for-me or -c approvals_reviewer= reached Codex only as process config, which a resume's saved setting outranks. Removing --approve-for-me left the automatic reviewer approving requests. Every thread start and resume now states the reviewer with the rest of the policy: the one the Arguments name under Manual, otherwise Codex's default, user. approval_policy on-failure (from -a or -c) now reads as on-request, which is Codex's own alias, instead of refusing the chat. Refusals now say what to do. A refused option reads "Codex chats can't use --profile from saved Arguments. Remove it from Codex's Arguments in Settings → Agents." plus, where one exists, what a chat honors instead (config.toml or -c for a profile, -c model_provider= for --oss, the chat's workspace folder for -C/--add-dir/--worktree, attaching an image for -i). An invalid sandbox, approval policy or reviewer names the setting and its accepted values. A lone "-" is a prompt, not an unnamed option.
…hat-codex-arguments # Conflicts: # src/main/runtime/orca-runtime-get-worktree-ps.ts # src/main/runtime/structured-agent-session-runtime.ts # src/renderer/src/components/native-chat/agent-session-failure-words-text.ts # src/renderer/src/i18n/locales/en.json
… model in the --oss hint The chat translated -c approvals_reviewer=guardian_subagent to auto_review before stating it on the thread. Codex 0.120-0.123 take only guardian_subagent there, so on those versions the chat failed to start where the terminal worked. The reviewer now goes to Codex exactly as the Arguments spell it (user, auto_review or guardian_subagent); every version accepts the spelling its own config accepts. --oss also picks a local default model, so the hint for --oss and --local-provider now says to choose a local model with -m as well.
…hat-codex-arguments
… alone Saved Arguments no longer set a Codex chat's sandbox, approval policy or reviewer. -s/--sandbox, -a/--ask-for-approval and --approve-for-me / --not-so-yolo are dropped quietly, like the bypass flag (a value option still consumes its value, and a missing one is still refused), and -c / --config whose top key is approval_policy, sandbox_mode, approvals_reviewer or sandbox_workspace_write never reaches app-server. The thread policy comes from the Agent Permissions setting only, and still states the reviewer, user, on every start and resume so a resumed chat never keeps a stale one. This removes the invalid-value refusal and its copy in every locale, the value aliases, and the policy parameter the Arguments used to feed.
…hat-codex-arguments
…f in the model probe Scope: the per-chat permission picker already states the approvals reviewer on every thread open and removes the Agent Permissions tooltip, and this PR now drops every reviewer key from Arguments. So the reviewer statement, its tests, the tooltip copy and its six translations, and the permission-policy wiring test come out; those files match main again. The model-list probe put its own config after the saved Arguments, but Codex applies --enable/--disable after every -c, so a saved --enable plugins re-enabled plugin startup in the short-lived probe. The probe now also passes --disable plugins, which Codex applies last.
…hat-codex-arguments
…e's --disable plugins
…hat-codex-arguments
Review summaryProblem. Settings → Agents → Arguments is shared by terminal tabs and native chat. In Codex native chat, saved Arguments were quietly lost:
So a chat could run a different model, provider or config than the terminal. For example, User-facing change.
What review fixed along the way (5 review rounds plus a readiness pass):
Deferred or accepted:
Verified:
Not verified:
Merge order (updated 2026-10-07): #26116 → this PR. The permission plan changed: chat gets its own "Permissions for new chats" setting (Settings → Chat) and stops reading the terminal Agent Permissions setting (#26116). #24508 is no longer in this stack. Nothing in this PR changes: it already drops permission flags from Arguments and leaves the thread policy to the chat's permission setting. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (30)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change updates how saved Codex arguments are normalized and passed to structured app-server launches and the model catalog probe. It converts model and search options to config overrides, filters permission options, and rejects unsupported arguments. It also adds structured reporting for unclosed quotes and argument failures, with updated guidance and translations. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No identified issue blocks merging; normal checks remain appropriate. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 38.46% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 23 files. (7 skipped: 7 unsupported.)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing unmerged. Native chat no longer reads saved Arguments for any agent; they are for terminal launches (#26506). So this per-flag Codex translation isn't needed. Codex chat starts as plain |
ELI5
Settings → Agents → Arguments is shared by terminal tabs and native chat. In Codex native chat, many saved Arguments were quietly lost. Some were dropped; others were placed where Codex reads them and then ignores them. A chat could run a different provider, model or config than the terminal, and nothing said so. Now every saved Codex Argument either works in chat the way it does in a terminal tab, is a permission setting (chat takes permissions from Agent Permissions only, see below), or the chat refuses to start and says which argument to change and what to use instead.
What Changed
Before (Codex native chat):
--oss --local-provider ollama: the terminal used the local model; chat silently sent prompts to the default cloud provider.-m gpt-5and--searchwere accepted but ignored in chat.--profile workwas dropped, so chat ran the base config, which can mean a different model, provider or MCP servers.--strict-config,--add-dir,-C,-i, and anything after--were dropped.After:
-c key=value,--enable,--disable,--strict-config.-m X→-c model="X";--search→-c web_search="live".-s/--sandbox,-a/--ask-for-approval,--approve-for-me, and-ckeys forapproval_policy,sandbox_mode,approvals_reviewerandsandbox_workspace_write. This is what main already did for most of them. Known cost: a user with-s read-onlysaved for terminal tabs does not get read-only in chat. Chat runs whatever the chat permission setting (or the chat's picker) says.--oss/--local-provider: choose the provider with-c model_provider=…and a local model with-m.-C/--cd/--add-dir/--worktree: a chat already works in its workspace folder.-i: attach the image in the chat instead.--remote,--dangerously-bypass-hook-trust, unknown options and prompts: a plain "remove it".--profile,--oss,-Cand--worktreehave replacements that work in both places, and the copy names them.--add-dirhas no chat equivalent: extra writable folders are a sandbox setting, and chat takes those from Agent Permissions.--no-alt-screen,--no-daemon, help/version, and the bypass flags (Agent Permissions already reads them).Mechanism:
codex-structured-launch-args.tsis one table. Each interactive Codex option is passed through, translated to the config Codex derives from it, dropped (terminal-only or a permission setting), or refused by name. The resulting options go afterapp-serverinstead of before it. Before the subcommand, Codex accepts every root option butapp-serveruses only the config ones. After it, an optionapp-serverdoesn't take fails loudly. The model-list probe runsapp-serverwith the same options, and its own overrides come last so they still win.Why
Saved Arguments are written for the interactive
codexthat a terminal runs, but a chat runscodex app-server. That reads only config (-c,--enable/--disable) and its own few options, and it silently ignores everything else placed before it. The common pattern hands launch arguments to the server process unfiltered after the subcommand, so bad arguments fail visibly. Orca can't do exactly that: its Arguments field is shared with terminals, and its default value (the terminal bypass flag) isn't anapp-serveroption. Passing it through would make every untouched profile fail to start. So the translation step stays (an intended difference), but its job changes from silently filtering to honoring or refusing by name.Alternatives considered:
-s/-ain Arguments set the chat's permissions. Rejected: permissions have one source, so the permission picker can always name the state the chat is in.Linked Issue
Follow-up to #25721 and #25667 (saved Command/Arguments in native chat). Merge order: after #26116 (chat permission setting + per-chat picker).
Visual Proof
QA ran on Windows (low spec), driven by a non-Claude agent over the DevTools protocol against a hidden window. Stand-in Codex/Claude CLIs logged every launch argument and JSON-RPC request. The box's real agent config files were unchanged at every step.
A refused saved option names the option and the fix (

--profile work; nothing is started, and Retry works after editing Arguments):--oss,-C,-irefusals (same wording rules; captured on the previous head, wording unchanged since):Translated Arguments start the chat. With saved

-m gpt-qa-arg --search -c foo.bar=1 --enable qa_feature, Codex was started asapp-server -c foo.bar=1 --enable qa_feature -c model="gpt-qa-arg" -c web_search="live". The model-list probe got the same options, then-c approval_policy=never -c features.plugins=false --disable plugins:Untouched Arguments (Yolo) start as


app-serverwith thread policy never / danger-full-access. Manual plus saved-s read-only -a untrusted --approve-for-me -c sandbox_mode=read-only: none of those reach Codex, and the thread runs on-request / workspace-write from Agent Permissions:Unclosed quote, existing chat restarting: the new card:

Unclosed quote, NEW chat from the tab bar: the existing toast from main's shared launch planning (follow-up, see Notes):

Testing
tc:node,tc:webandtc:clitypechecks.Review
Pending.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
--strict-configis now passed toapp-server. Codex 0.130–0.132 rejects it there, just as a terminal on those versions does.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)