Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(codex): bypass means bypass on a cloud model too

David51f98f16b3e3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9de74f58..925ba1bc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,7 +13,8 @@ and gives the Code view a mode menu, a plan panel and a real file explorer.
- **A mode menu in the Code composer.** Ask permissions, Bypass permissions or
Plan mode, chosen per conversation with a global default in Settings. Bypass
- never lifts the cloud shell lock, and the menu says so. Plan mode explores
+ bypasses on a cloud model too, and a setting brings the cloud shell confirm
+ back for anyone who wants it. Plan mode explores
read only and stops for your yes; Approve and run then carries the whole plan
out in the same run and never lands in Bypass on its own, showing the mode it
will run in and the real commands first.
diff --git a/src/components/chat/CodexConfirmDialog.tsx b/src/components/chat/CodexConfirmDialog.tsx
index 80754aab..69464319 100644
--- a/src/components/chat/CodexConfirmDialog.tsx
+++ b/src/components/chat/CodexConfirmDialog.tsx
@@ -26,7 +26,7 @@ export function CodexConfirmDialog() {
// Clear whichever arm is asking. When the cloud arm is the reason, the
// general confirm is already off, so clearing that one would change nothing
// and the prompt would return on the very next command.
- if (pending.cloudReason) updateSettings({ codexCloudConfirmShell: false })
+ if (pending.cloudReason) updateSettings({ codexCloudConfirmOptIn: false })
else updateSettings({ codexConfirmShell: false })
answer(true)
}
diff --git a/src/components/chat/CodexModeDropdown.tsx b/src/components/chat/CodexModeDropdown.tsx
index cc1a0ae2..b4e4a70a 100644
--- a/src/components/chat/CodexModeDropdown.tsx
+++ b/src/components/chat/CodexModeDropdown.tsx
@@ -1,5 +1,5 @@
import { useState } from 'react'
-import { ChevronDown, ShieldCheck, Zap, ClipboardList, Cloud } from 'lucide-react'
+import { ChevronDown, ShieldCheck, Zap, ClipboardList } from 'lucide-react'
import { useChatStore } from '../../stores/chatStore'
import { useCodexStore } from '../../stores/codexStore'
import { useSettingsStore } from '../../stores/settingsStore'
@@ -139,18 +139,6 @@ export function CodexModeDropdown({ openUpward = false }: { openUpward?: boolean
)
})}
</div>
- {/* The one thing Bypass deliberately does NOT lift. Said here
- because a switch labelled "bypass permissions" that still
- asks would otherwise read as a broken toggle. */}
- <div className="mt-1 pt-1 border-t border-gray-200 dark:border-white/[0.06] px-3">
- <p className="flex items-start gap-1 py-1 text-[0.5rem] leading-snug text-gray-400">
- <Cloud size={9} className="mt-px shrink-0" />
- <span>
- Bypass never lifts the cloud shell confirm. A remote model reaching your
- local shell unattended stays a decision you make each time.
- </span>
- </p>
- </div>
</>
)}
</div>
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index fb50b6c1..c5df7b0b 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -923,15 +923,14 @@ function CodexAgentSettings() {
enabled={settings.codexConfirmShell}
onChange={() => updateSettings({ codexConfirmShell: !settings.codexConfirmShell })}
/>
- {/* Cloud arm of the same gate. Until 2.5.9 this was hard-wired on and
- invisible, so the toggle above appeared to do nothing whenever the
- coding agent ran on a cloud model. Always shown since G15a: it also
- governs Agent mode, which ignores the Codex-only toggle above, so
- hiding it while that toggle is on would strand the Agent side. */}
+ {/* Cloud arm of the same gate, an opt-in since David's decision of
+ 2026-08-22: off by default, a cloud model runs like a local one, and
+ Bypass really bypasses. Always shown, because it governs Agent mode
+ too, which ignores the Codex-only toggle above. */}
<InlineToggle
- label="Also confirm when Agent or Coding runs on an LU Cloud model (recommended)"
- enabled={settings.codexCloudConfirmShell}
- onChange={() => updateSettings({ codexCloudConfirmShell: !settings.codexCloudConfirmShell })}
+ label="Also confirm shell & code when Agent or Coding runs on an LU Cloud model (off by default, and it asks in Bypass too)"
+ enabled={settings.codexCloudConfirmOptIn}
+ onChange={() => updateSettings({ codexCloudConfirmOptIn: !settings.codexCloudConfirmOptIn })}
/>
</div>
)
diff --git a/src/hooks/__tests__/agent-shell-gate.test.ts b/src/hooks/__tests__/agent-shell-gate.test.ts
index f9b0edc6..c6ea4e74 100644
--- a/src/hooks/__tests__/agent-shell-gate.test.ts
+++ b/src/hooks/__tests__/agent-shell-gate.test.ts
@@ -1,9 +1,14 @@
/**
- * One cloud shell policy for both surfaces (G15a, decided 2026-08-07): the
- * Code tab confirms shell_execute / code_execute / shell_execute_background on
- * an LU Cloud model, and R23 proved Agent mode ran the same tools on the same
- * model unattended. Agent now lifts an exec tool to pending_approval when the
- * shared gate's cloud arm says so, on top of its per-tool permission levels.
+ * One cloud shell policy for both surfaces (G15a, 2026-08-07): the Code tab
+ * and Agent mode read the SAME helper and the SAME setting, because R23 found
+ * Agent running the exec tools on a cloud model unattended while the Code tab
+ * confirmed them.
+ *
+ * David 2026-08-22 replaces the policy that shared setting carried: bypass
+ * means bypass on a cloud model too, so the setting is an opt-in and ships
+ * OFF. With it off, a cloud model is gated by the per-tool permission level
+ * and by nothing else. With it on, the confirm rides ON TOP of that level, in
+ * Bypass as well, which is the whole point of opting in.
*
* Run: npx vitest run src/hooks/__tests__/agent-shell-gate.test.ts
*/
@@ -13,34 +18,60 @@ import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
import { CODEX_CONFIRM_TOOLS, codexConfirmEnabled } from '../codexShellGate'
+import { DEFAULT_SETTINGS } from '../../lib/constants'
const here = dirname(fileURLToPath(import.meta.url))
const read = (rel: string) => readFileSync(resolve(here, rel), 'utf8')
const agent = read('../useAgentChat.ts')
-describe('the shared policy, as Agent mode consumes it', () => {
- const agentArm = (providerId: string, cloudConfirmShell: boolean) =>
- codexConfirmEnabled({ confirmShell: false, cloudConfirmShell, providerId })
+// The two lines useAgentChat runs per tool call, kept in the same shape as the
+// source (pinned below, so this stops being a paraphrase the moment it drifts).
+const cloudArm = (toolName: string, providerId: string, cloudOptIn: boolean) =>
+ CODEX_CONFIRM_TOOLS.has(toolName) && codexConfirmEnabled({ confirmShell: false, cloudOptIn, providerId })
+const needsApproval = (permLevel: string, toolName: string, providerId: string, cloudOptIn: boolean) =>
+ permLevel !== 'auto' || cloudArm(toolName, providerId, cloudOptIn)
+
+const OPT_IN_DEFAULT = DEFAULT_SETTINGS.codexCloudConfirmOptIn
+
+describe('the shipped default: a cloud model is not special', () => {
+ it('ships with the cloud opt-in off', () => {
+ expect(OPT_IN_DEFAULT).toBe(false)
+ })
- it('a cloud model must ask before running local shell', () => {
- expect(agentArm('lu-cloud', true)).toBe(true)
+ it('THE DECISION: permission level auto runs shell on a cloud model unattended', () => {
+ expect(needsApproval('auto', 'shell_execute', 'lu-cloud', OPT_IN_DEFAULT)).toBe(false)
+ expect(needsApproval('auto', 'code_execute', 'lu-cloud', OPT_IN_DEFAULT)).toBe(false)
+ expect(needsApproval('auto', 'shell_execute_background', 'lu-cloud', OPT_IN_DEFAULT)).toBe(false)
})
- it('NEGATIVE CONTROL: a local model the user chose to trust stays unattended', () => {
- expect(agentArm('ollama', true)).toBe(false)
- expect(agentArm('openai', true)).toBe(false)
+ it('a cloud model and a local model are gated identically', () => {
+ for (const providerId of ['lu-cloud', 'ollama', 'openai']) {
+ expect(needsApproval('auto', 'shell_execute', providerId, OPT_IN_DEFAULT)).toBe(false)
+ }
})
- it('NEGATIVE CONTROL: the visible switch really turns it off', () => {
- expect(agentArm('lu-cloud', false)).toBe(false)
+ it('NEGATIVE CONTROL: the permission level itself still gates, it was never loosened', () => {
+ expect(needsApproval('ask', 'shell_execute', 'lu-cloud', OPT_IN_DEFAULT)).toBe(true)
+ expect(needsApproval('ask', 'shell_execute', 'ollama', OPT_IN_DEFAULT)).toBe(true)
+ })
+})
+
+describe('the opt-in, for the user who wants the cloud confirm back', () => {
+ it('an opted-in user is asked again on a cloud model, even at level auto', () => {
+ expect(needsApproval('auto', 'shell_execute', 'lu-cloud', true)).toBe(true)
+ })
+
+ it('opting in does not touch local providers', () => {
+ expect(needsApproval('auto', 'shell_execute', 'ollama', true)).toBe(false)
+ expect(needsApproval('auto', 'shell_execute', 'openai', true)).toBe(false)
})
it('only the arbitrary-exec tools are gated, never the jailed file tools', () => {
- expect(CODEX_CONFIRM_TOOLS.has('shell_execute')).toBe(true)
- expect(CODEX_CONFIRM_TOOLS.has('code_execute')).toBe(true)
- expect(CODEX_CONFIRM_TOOLS.has('shell_execute_background')).toBe(true)
- expect(CODEX_CONFIRM_TOOLS.has('file_write')).toBe(false)
- expect(CODEX_CONFIRM_TOOLS.has('web_fetch')).toBe(false)
+ expect(cloudArm('shell_execute', 'lu-cloud', true)).toBe(true)
+ expect(cloudArm('code_execute', 'lu-cloud', true)).toBe(true)
+ expect(cloudArm('shell_execute_background', 'lu-cloud', true)).toBe(true)
+ expect(cloudArm('file_write', 'lu-cloud', true)).toBe(false)
+ expect(cloudArm('web_fetch', 'lu-cloud', true)).toBe(false)
})
})
@@ -51,8 +82,11 @@ describe('wiring in useAgentChat', () => {
it('the gate reads the SAME shared helper and setting as the Code tab', () => {
expect(agent).toContain("import { CODEX_CONFIRM_TOOLS, codexConfirmEnabled } from './codexShellGate'")
- expect(agent).toContain('cloudConfirmShell: settings.codexCloudConfirmShell')
+ expect(agent).toContain('cloudOptIn: settings.codexCloudConfirmOptIn')
expect(agent).toContain('CODEX_CONFIRM_TOOLS.has(tc.function.name)')
+ // Negative control: the retired key must be gone from this surface, or a
+ // profile that still has it on disk would quietly keep the old policy.
+ expect(agent).not.toContain('codexCloudConfirmShell')
})
it('a gated call lands in the EXISTING approval flow, not a new dialog', () => {
@@ -65,19 +99,27 @@ describe('wiring in useAgentChat', () => {
expect(agent).toContain('await waitForApproval(convId!, entry.ac, abort.signal)')
})
- it('NEGATIVE CONTROL: the Codex side of the gate is untouched', () => {
+ it('the Codex side feeds the same two settings into the same helper', () => {
const codex = read('../useCodex.ts')
- // Since 2.6.6 C1 the Code tab feeds the SAME two settings into the shared
- // gate through the mode preset instead of calling it inline. Same inputs,
- // same helper, and the cloud arm survives all three modes.
+ // Since 2.6.6 C1 the Code tab reaches the gate through the mode preset
+ // instead of calling it inline. Same inputs, same helper, same opt-in.
expect(codex).toContain('codexModeKnobs({')
expect(codex).toContain('codexConfirmShell: settings.codexConfirmShell')
- expect(codex).toContain('codexCloudConfirmShell: settings.codexCloudConfirmShell')
+ expect(codex).toContain('codexCloudConfirmOptIn: settings.codexCloudConfirmOptIn')
+ expect(codex).not.toContain('codexCloudConfirmShell')
})
- it('the settings toggle is always visible now, since it governs Agent too', () => {
+ it('the settings toggle stays visible, and reads as the opt-in it now is', () => {
const page = read('../../components/settings/SettingsPage.tsx')
- expect(page).toContain('Also confirm when Agent or Coding runs on an LU Cloud model')
+ expect(page).toContain('when Agent or Coding runs on an LU Cloud model')
+ expect(page).toContain('off by default')
+ expect(page).toContain('settings.codexCloudConfirmOptIn')
expect(page).not.toContain('{!settings.codexConfirmShell && (')
})
+
+ it('the mode dropdown no longer carries the cloud exception, there is none', () => {
+ const dropdown = read('../../components/chat/CodexModeDropdown.tsx')
+ expect(dropdown).not.toContain('Bypass never lifts')
+ expect(dropdown).not.toMatch(/cloud shell confirm/i)
+ })
})
diff --git a/src/hooks/__tests__/codex-mode-wiring.test.ts b/src/hooks/__tests__/codex-mode-wiring.test.ts
index 481d4146..2ab146eb 100644
--- a/src/hooks/__tests__/codex-mode-wiring.test.ts
+++ b/src/hooks/__tests__/codex-mode-wiring.test.ts
@@ -100,7 +100,7 @@ describe('the Agent surface is untouched by the Code tab mode', () => {
expect(agent).toContain(
'codexConfirmEnabled({\n'
+ ' confirmShell: false,\n'
- + ' cloudConfirmShell: settings.codexCloudConfirmShell,\n'
+ + ' cloudOptIn: settings.codexCloudConfirmOptIn,\n'
+ ' providerId,\n'
+ ' })',
)
@@ -146,7 +146,7 @@ describe('runtime: a pick in one conversation leaves everything else alone', ()
const s = useSettingsStore.getState().settings
return JSON.stringify({
confirmShell: false,
- cloudConfirmShell: s.codexCloudConfirmShell,
+ cloudOptIn: s.codexCloudConfirmOptIn,
})
}
const before = inputs()
@@ -169,7 +169,7 @@ describe('runtime: a pick in one conversation leaves everything else alone', ()
useSettingsStore.getState().updateSettings({ codexConfirmShell: true, codexStageMode: true })
expect(JSON.stringify(useSettingsStore.getState().settings)).not.toBe(before)
// ... and it would have reached the Agent surface through the same object.
- useSettingsStore.getState().updateSettings({ codexCloudConfirmShell: false })
- expect(useSettingsStore.getState().settings.codexCloudConfirmShell).toBe(false)
+ useSettingsStore.getState().updateSettings({ codexCloudConfirmOptIn: true })
+ expect(useSettingsStore.getState().settings.codexCloudConfirmOptIn).toBe(true)
})
})
diff --git a/src/hooks/__tests__/codexShellGate.test.ts b/src/hooks/__tests__/codexShellGate.test.ts
index de05ba29..8eba38c4 100644
--- a/src/hooks/__tests__/codexShellGate.test.ts
+++ b/src/hooks/__tests__/codexShellGate.test.ts
@@ -1,5 +1,6 @@
import { describe, it, expect } from 'vitest'
import { CODEX_CONFIRM_TOOLS, codexNeedsConfirm, codexConfirmEnabled } from '../codexShellGate'
+import { DEFAULT_SETTINGS } from '../../lib/constants'
// H2: the coding-agent shell/code confirm gate. These tests lock the contract
// that (a) the autonomous workflow is unchanged when the gate is off, (b) the
@@ -44,39 +45,50 @@ describe('codexShellGate (H2)', () => {
})
})
- // 2.5.9 — David 2026-07-24: "auto approve bei cloud modellen setting nicht
- // funktional". The 2.5.7 review hard-wired providerId === 'lu-cloud' into the
- // gate, so the confirm toggle silently did nothing on a cloud model. These
- // lock the new contract: same safe default, but the user can now actually
- // turn the cloud arm off.
- describe('codexConfirmEnabled (cloud arm)', () => {
+ // History: the 2.5.7 review hard-wired providerId === 'lu-cloud' into the
+ // gate, so the confirm toggle silently did nothing on a cloud model (David
+ // 2026-07-24, "auto approve bei cloud modellen setting nicht funktional").
+ // 2.5.9 made it a visible setting that still defaulted ON, and G15a
+ // (2026-08-07) carried the same default to the Agent surface.
+ //
+ // David 2026-08-22 replaces that decision: bypass means bypass, on a cloud
+ // model too, and the customer who picks it makes the call. The cloud arm is
+ // an opt-in now and ships OFF. These lock both halves.
+ describe('codexConfirmEnabled (cloud arm, opt-in since 2026-08-22)', () => {
const LOCALS = ['ollama', 'openai', 'anthropic']
- it('both off on a local model: unattended, the autonomous default', () => {
- for (const providerId of LOCALS) {
- expect(codexConfirmEnabled({ confirmShell: false, cloudConfirmShell: true, providerId })).toBe(false)
- }
+ it('THE DECISION: the shipped default leaves a cloud model unattended', () => {
+ expect(DEFAULT_SETTINGS.codexCloudConfirmOptIn).toBe(false)
+ expect(
+ codexConfirmEnabled({
+ confirmShell: false,
+ cloudOptIn: DEFAULT_SETTINGS.codexCloudConfirmOptIn,
+ providerId: 'lu-cloud',
+ })
+ ).toBe(false)
})
- it('global toggle on: confirms on every provider, cloud arm irrelevant', () => {
+ it('a cloud model with the opt-in off behaves exactly like a local one', () => {
for (const providerId of [...LOCALS, 'lu-cloud']) {
- expect(codexConfirmEnabled({ confirmShell: true, cloudConfirmShell: false, providerId })).toBe(true)
- expect(codexConfirmEnabled({ confirmShell: true, cloudConfirmShell: true, providerId })).toBe(true)
+ expect(codexConfirmEnabled({ confirmShell: false, cloudOptIn: false, providerId })).toBe(false)
}
})
- it('default (cloud arm on): a cloud model still confirms — 2.5.8 behaviour preserved', () => {
- expect(codexConfirmEnabled({ confirmShell: false, cloudConfirmShell: true, providerId: 'lu-cloud' })).toBe(true)
+ it('the opt-in is what brings the cloud confirm back', () => {
+ expect(codexConfirmEnabled({ confirmShell: false, cloudOptIn: true, providerId: 'lu-cloud' })).toBe(true)
})
- it('THE FIX: cloud arm off means auto-approve finally works on cloud models', () => {
- expect(codexConfirmEnabled({ confirmShell: false, cloudConfirmShell: false, providerId: 'lu-cloud' })).toBe(false)
+ it('global toggle on: confirms on every provider, cloud arm irrelevant', () => {
+ for (const providerId of [...LOCALS, 'lu-cloud']) {
+ expect(codexConfirmEnabled({ confirmShell: true, cloudOptIn: false, providerId })).toBe(true)
+ expect(codexConfirmEnabled({ confirmShell: true, cloudOptIn: true, providerId })).toBe(true)
+ }
})
- it('the cloud arm never gates a local provider', () => {
+ it('the cloud arm never gates a local provider, opted in or not', () => {
for (const providerId of LOCALS) {
- expect(codexConfirmEnabled({ confirmShell: false, cloudConfirmShell: true, providerId })).toBe(false)
- expect(codexConfirmEnabled({ confirmShell: false, cloudConfirmShell: false, providerId })).toBe(false)
+ expect(codexConfirmEnabled({ confirmShell: false, cloudOptIn: true, providerId })).toBe(false)
+ expect(codexConfirmEnabled({ confirmShell: false, cloudOptIn: false, providerId })).toBe(false)
}
})
})
diff --git a/src/hooks/codexShellGate.ts b/src/hooks/codexShellGate.ts
index 10687597..58c1cf7b 100644
--- a/src/hooks/codexShellGate.ts
+++ b/src/hooks/codexShellGate.ts
@@ -1,4 +1,4 @@
-// H2 security gate — shared, pure, testable.
+// H2 security gate: shared, pure, testable.
//
// Consumed by BOTH loops since G15a (2026-08-07): useCodex gates on it
// directly, and useAgentChat lifts an exec tool to pending_approval when
@@ -7,7 +7,7 @@
// shell_execute unattended on the Agent surface (R23).
//
// The coding agent (useCodex) auto-runs tools unattended by design. These are
-// the arbitrary-code-execution tools — the prompt-injection RCE surface (a tool
+// the arbitrary-code-execution tools, the prompt-injection RCE surface (a tool
// result or a read file steering the model into running a command). When the
// user enables `settings.codexConfirmShell`, each of these pauses for an
// explicit confirm before dispatch.
@@ -27,28 +27,31 @@ export function codexNeedsConfirm(toolName: string, confirmEnabled: boolean): bo
}
/**
- * Is the confirm gate active for THIS run? (David 2026-07-24: "auto approve bei
- * cloud modellen setting nicht funktional".)
+ * Is the confirm gate active for THIS run?
*
- * The 2.5.7 security review hard-wired `providerId === 'lu-cloud'` into the gate,
- * so on a cloud model every shell/code call confirmed even with the setting off.
- * The setting was silently overridden with nothing in the UI saying so, which
- * reads as a broken toggle rather than a policy.
+ * David 2026-08-22, replacing G15a (2026-08-07) and the 2.5.9 default:
+ * bypass means bypass, on a cloud model too. The 2.5.7 review hard-wired
+ * `providerId === 'lu-cloud'` into the gate, 2.5.9 turned that into a visible
+ * setting that still defaulted ON, and G15a carried it to the Agent surface.
+ * All three kept asking a user who had just said do not ask, which reads as a
+ * broken switch rather than a policy. Picking Bypass IS the decision, and the
+ * customer who picks it makes it themselves.
*
- * The policy is still the right default — a remote model reaching unattended
- * local shell is a bigger blast radius than a local model the user deliberately
- * trusts — so it stays ON by default. It is now a real, visible, user-owned
- * switch instead of a hidden override: turn `cloudConfirmShell` off and cloud
- * models follow the same rule as local ones.
+ * What stays is the opt-in: `codexCloudConfirmOptIn` is OFF by default, so a
+ * cloud model behaves exactly like a local one. Turn it on and the cloud
+ * confirm is back in every mode, Bypass included, because that is what opting
+ * in means.
*/
export function codexConfirmEnabled(opts: {
- /** settings.codexConfirmShell — confirm for EVERY provider. */
+ /** settings.codexConfirmShell: confirm for EVERY provider. */
confirmShell: boolean
- /** settings.codexCloudConfirmShell — also confirm on LU Cloud. Default true. */
- cloudConfirmShell: boolean
+ /** settings.codexCloudConfirmOptIn: also confirm on LU Cloud. Default false. */
+ cloudOptIn: boolean
/** Provider driving this run ('lu-cloud' | 'ollama' | 'openai' | ...). */
providerId: string
}): boolean {
if (opts.confirmShell) return true
- return opts.providerId === 'lu-cloud' && opts.cloudConfirmShell
+ // `=== true` on purpose: a profile the persist merge never touched carries
+ // the key as undefined, and the new policy is what undefined must mean.
+ return opts.providerId === 'lu-cloud' && opts.cloudOptIn === true
}
diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.ts
index 02a552f0..52b9b081 100644
--- a/src/hooks/useAgentChat.ts
+++ b/src/hooks/useAgentChat.ts
@@ -1563,17 +1563,19 @@ export function useAgentChat() {
permissions,
perToolOverrides
)
- // G15a (decided 2026-08-07): the cloud shell rule covers BOTH
- // surfaces. The Code tab confirms the arbitrary-exec tools on an LU
- // Cloud model (codexShellGate); Agent mode ran the SAME tools on the
- // SAME model unattended (R23), so the surface a casual user is more
- // likely in had the looser rule. Same policy, same visible setting;
- // rides ON TOP of the per-tool permission level, never loosens it.
+ // One cloud shell rule for BOTH surfaces (G15a, 2026-08-07): the
+ // Code tab and Agent mode read the same helper and the same setting,
+ // so the same cloud model cannot be stricter in one tab than the
+ // other (R23). David's decision of 2026-08-22 made that setting an
+ // opt-in that defaults OFF, so this arm normally does nothing and
+ // permission level auto runs unattended on a cloud model too. For a
+ // user who opted in it rides ON TOP of the per-tool permission
+ // level, never loosens it.
const cloudShellConfirm =
CODEX_CONFIRM_TOOLS.has(tc.function.name) &&
codexConfirmEnabled({
confirmShell: false,
- cloudConfirmShell: settings.codexCloudConfirmShell,
+ cloudOptIn: settings.codexCloudConfirmOptIn,
providerId,
})
const needsApproval = permLevel !== 'auto' || cloudShellConfirm
diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.ts
index b56ddcfd..a9f5a50e 100644
--- a/src/hooks/useCodex.ts
+++ b/src/hooks/useCodex.ts
@@ -520,12 +520,12 @@ export function useCodex() {
// over the switches that already exist; nothing here is ever written back
// into the settings, so a Bypass in this conversation cannot reach another
// conversation or the Agent surface (plan C1 BINDUNG). The cloud shell
- // gate is inside codexConfirmEnabled and stays armed in all three modes.
+ // gate is inside codexConfirmEnabled and is off unless the user opts in.
const knobs = codexModeKnobs({
mode: codexMode,
settings: {
codexConfirmShell: settings.codexConfirmShell,
- codexCloudConfirmShell: settings.codexCloudConfirmShell,
+ codexCloudConfirmOptIn: settings.codexCloudConfirmOptIn,
codexStageMode: settings.codexStageMode,
codexReviewMode: settings.codexReviewMode,
},
@@ -1949,13 +1949,17 @@ export function useCodex() {
//
// 2.5.9 (David 2026-07-24 "auto approve bei cloud modellen setting
// nicht funktional"): that override was invisible, so the confirm
- // toggle looked broken on cloud models. Same default, but the cloud arm
- // is now settings.codexCloudConfirmShell — a real switch the user owns.
- // See codexConfirmEnabled for the whole rule.
+ // toggle looked broken on cloud models. It became the visible
+ // setting the user owns.
+ //
+ // 2026-08-22 (David, replacing G15a): that setting is an opt-in now
+ // and defaults OFF. Bypass means bypass on a cloud model too, and
+ // the customer who picks Bypass makes that call themselves. See
+ // codexConfirmEnabled for the whole rule.
//
// 2.6.6 (plan C1): the mode preset decides whether this gate is
- // armed. Ask forces it on, Bypass turns the LOCAL arm off, and
- // codexConfirmEnabled keeps the cloud arm alive in every mode.
+ // armed. Ask forces it on, Bypass turns the local arm off, and the
+ // cloud arm only survives Bypass for a user who opted in.
awaitApproval: knobs.confirmExec
? async (req) => {
if (!CODEX_CONFIRM_TOOLS.has(req.toolName)) return true
diff --git a/src/lib/__tests__/codex-mode.test.ts b/src/lib/__tests__/codex-mode.test.ts
index ecc9443a..6d8ab301 100644
--- a/src/lib/__tests__/codex-mode.test.ts
+++ b/src/lib/__tests__/codex-mode.test.ts
@@ -17,7 +17,7 @@ import { MUTATING_TOOLS } from '../mutating-tools'
const SETTINGS = {
codexConfirmShell: false,
- codexCloudConfirmShell: true,
+ codexCloudConfirmOptIn: false,
codexStageMode: false,
codexReviewMode: false,
}
@@ -100,17 +100,30 @@ describe('switch point 3: the read-only chain', () => {
})
})
-describe('the cloud shell gate survives all three modes', () => {
- it.each(CODEX_MODES)('%s still confirms on lu-cloud', (mode) => {
- expect(knobs(mode, { codexConfirmShell: false, codexCloudConfirmShell: true }, 'lu-cloud').confirmExec).toBe(true)
- })
- it('negative control: the same three modes on a local provider do not all confirm', () => {
- expect(knobs('bypass', { codexConfirmShell: false }, 'ollama').confirmExec).toBe(false)
- })
- it('the user can still switch the cloud arm off themselves, and that is the ONLY way', () => {
- expect(knobs('bypass', { codexCloudConfirmShell: false }, 'lu-cloud').confirmExec).toBe(false)
- // Bypass alone never reaches that state.
- expect(knobs('bypass', { codexCloudConfirmShell: true }, 'lu-cloud').confirmExec).toBe(true)
+// David 2026-08-22, replacing G15a: the cloud arm is the user's opt-in, not a
+// fourth mode. Off by default, so lu-cloud goes through the same three modes a
+// local provider does.
+describe('the cloud shell gate is an opt-in, not a fourth mode', () => {
+ it('THE DECISION: Bypass on a cloud model runs unattended, like Bypass on a local one', () => {
+ expect(knobs('bypass', { codexConfirmShell: false }, 'lu-cloud').confirmExec).toBe(false)
+ expect(knobs('bypass', { codexConfirmShell: true }, 'lu-cloud').confirmExec).toBe(false)
+ })
+ it.each(CODEX_MODES)('%s treats lu-cloud exactly like ollama while the opt-in is off', (mode) => {
+ expect(knobs(mode, { codexConfirmShell: false }, 'lu-cloud').confirmExec)
+ .toBe(knobs(mode, { codexConfirmShell: false }, 'ollama').confirmExec)
+ })
+ it('negative control: Ask still asks on a cloud model, because Ask means ask', () => {
+ expect(knobs('ask', { codexConfirmShell: false }, 'lu-cloud').confirmExec).toBe(true)
+ })
+ it.each(CODEX_MODES)('%s confirms on lu-cloud once the user opts in, Bypass included', (mode) => {
+ expect(knobs(mode, { codexConfirmShell: false, codexCloudConfirmOptIn: true }, 'lu-cloud').confirmExec).toBe(true)
+ })
+ it('negative control: opting in never gates a local provider', () => {
+ expect(knobs('bypass', { codexConfirmShell: false, codexCloudConfirmOptIn: true }, 'ollama').confirmExec).toBe(false)
+ expect(knobs('plan', { codexConfirmShell: false, codexCloudConfirmOptIn: true }, 'ollama').confirmExec).toBe(false)
+ })
+ it('an undefined value from an older profile counts as not opted in', () => {
+ expect(codexModeKnobs({ mode: 'bypass', settings: {}, providerId: 'lu-cloud' }).confirmExec).toBe(false)
})
})
diff --git a/src/lib/codex-mode.ts b/src/lib/codex-mode.ts
index a5d15616..4e5b9673 100644
--- a/src/lib/codex-mode.ts
+++ b/src/lib/codex-mode.ts
@@ -132,7 +132,7 @@ export interface CodexModeKnobInput {
mode: CodexMode
settings: {
codexConfirmShell?: boolean
- codexCloudConfirmShell?: boolean
+ codexCloudConfirmOptIn?: boolean
codexStageMode?: boolean
codexReviewMode?: boolean
}
@@ -146,9 +146,10 @@ export interface CodexModeKnobInput {
* Effective knobs = f(mode, settings). Pure, so the gate path and the request
* path cannot disagree, and so a test can prove no settings write happens.
*
- * The cloud shell gate is deliberately untouched in all three modes: Bypass
- * turns the LOCAL asking off and leaves codexCloudConfirmShell to decide for
- * lu-cloud, which is the security decision the plan pins down.
+ * The cloud shell gate is not a fourth mode: it is the user's own opt-in and
+ * is off by default, so on a cloud model every mode behaves exactly as it does
+ * on a local one (David 2026-08-22). A user who opts in gets the cloud confirm
+ * in all three modes, Bypass included.
*
* Where a mode and Code-Review Mode or a read-only slash command disagree, the
* more restrictive behaviour wins.
@@ -157,13 +158,13 @@ export function codexModeKnobs(input: CodexModeKnobInput): CodexModeKnobs {
const { mode, settings, providerId } = input
const reviewMode = settings.codexReviewMode === true
const readOnlyTurn = input.readOnlyTurn === true
- const cloudConfirmShell = settings.codexCloudConfirmShell !== false
+ const cloudOptIn = settings.codexCloudConfirmOptIn === true
const restrictedRead = reviewMode || readOnlyTurn
if (mode === 'bypass') {
return {
- // Local asking off, cloud gate untouched.
- confirmExec: codexConfirmEnabled({ confirmShell: false, cloudConfirmShell, providerId }),
+ // Local asking off. Nothing else asks unless the user opted in.
+ confirmExec: codexConfirmEnabled({ confirmShell: false, cloudOptIn, providerId }),
// Restrictive wins: a read-only turn has nothing to stage anyway.
stageWrites: false,
readOnly: restrictedRead,
@@ -174,11 +175,10 @@ export function codexModeKnobs(input: CodexModeKnobInput): CodexModeKnobs {
if (mode === 'plan') {
return {
// Nothing mutating survives the read-only chain, so the confirm gate
- // keeps following the user's own settings here. The cloud arm is what
- // must never soften, and codexConfirmEnabled carries it.
+ // keeps following the user's own settings here, cloud opt-in included.
confirmExec: codexConfirmEnabled({
confirmShell: settings.codexConfirmShell === true,
- cloudConfirmShell,
+ cloudOptIn,
providerId,
}),
stageWrites: false,
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 4f315749..96633ff9 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -89,10 +89,11 @@ export const DEFAULT_SETTINGS: Settings = {
// H2 security gate. OFF by default = the autonomous coding agent keeps
// running shell/code unattended; ON pauses each exec for a confirm.
codexConfirmShell: false,
- // Cloud arm of the same gate. ON = a cloud model always confirms shell/code
- // even with the toggle above off. Keeps the 2.5.7 security-review default,
- // but as a switch the user owns instead of a hidden override.
- codexCloudConfirmShell: true,
+ // Cloud arm of the same gate, now an opt-in. OFF = a cloud model follows the
+ // same rule as a local one, so Bypass and permission level auto run
+ // unattended (David 2026-08-22, replacing the ON default of 2.5.9/G15a).
+ // ON = shell/code confirms on LU Cloud in every mode, Bypass included.
+ codexCloudConfirmOptIn: false,
defaultWorkspace: null,
// v8: user-uploaded profile picture (base64 data URL, ≤256px). '' = default icon.
userAvatarDataUrl: '',
diff --git a/src/lib/release-notes.ts b/src/lib/release-notes.ts
index 3ed365a3..0a84b44e 100644
--- a/src/lib/release-notes.ts
+++ b/src/lib/release-notes.ts
@@ -51,7 +51,7 @@ export const RELEASE_NOTES: ReleaseNote[] = [
'The context sent on a paid step is capped, and the meter now counts against that cap instead of the whole model window, so the warning fires before a step gets expensive rather than after.',
'The stable half of the prompt no longer changes every step. The minute clock and everything else that moves each turn sit at the end now, so the upstream cache survives a long run instead of going cold on a timestamp.',
'The coding tool catalog is leaner: the git and gh cookbook, paragraphs the system prompt already states, and the PR and delegate tools all left the every-step budget, and the image and video tools share one settings schema.',
- 'A mode menu in the Code composer picks Ask permissions, Bypass permissions or Plan mode per conversation, with a global default in Settings. Bypass never lifts the cloud shell lock, and the menu says so.',
+ 'A mode menu in the Code composer picks Ask permissions, Bypass permissions or Plan mode per conversation, with a global default in Settings. Bypass bypasses on a cloud model too, and a setting brings the cloud shell confirm back for anyone who wants it.',
'Plan mode explores read only, writes the plan, then stops for your yes. Approve and run carries the whole plan out in the same run and never lands in Bypass on its own: the button shows the mode it will run in, and it shows you the real commands first.',
'The plan moved out of the prompt box into the right panel, live above the files.',
'The file explorer is a real tree you expand folder by folder, widen by dragging its edge, with the width remembered across a restart. Click a file to preview it: code with highlighting, images inline, HTML in a sandboxed frame with scripts off until you ask. node_modules, .git, target and dist stay out of the way.',
diff --git a/src/stores/__tests__/settingsStore-cloud-confirm-optin.test.ts b/src/stores/__tests__/settingsStore-cloud-confirm-optin.test.ts
new file mode 100644
index 00000000..2cbb2903
--- /dev/null
+++ b/src/stores/__tests__/settingsStore-cloud-confirm-optin.test.ts
@@ -0,0 +1,119 @@
+/**
+ * v21: the cloud shell confirm becomes an opt-in that ships OFF (David
+ * 2026-08-22, replacing G15a). This store writes the WHOLE settings object to
+ * disk, so every profile out there already has `codexCloudConfirmShell: true`
+ * materialised and a flipped default would never have reached a single
+ * existing user. The flip therefore rides a NEW key, not a one-shot reset of
+ * the old one, because R1's downgrade contract forbids one-shot resets while
+ * 2.6.5 and 2.6.6 share one WebView profile and re-run this migration on every
+ * build switch.
+ *
+ * Driven black-box like settingsStore-migrate-mac-appmode: seed a versioned
+ * blob, fresh-import the store, assert what the user actually gets.
+ *
+ * Run: npx vitest run src/stores/__tests__/settingsStore-cloud-confirm-optin.test.ts
+ */
+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
+import { codexConfirmEnabled } from '../../hooks/codexShellGate'
+
+const backing = new Map<string, string>()
+const localStorageShim = {
+ getItem: (k: string) => backing.get(k) ?? null,
+ setItem: (k: string, v: string) => void backing.set(k, String(v)),
+ removeItem: (k: string) => void backing.delete(k),
+ clear: () => backing.clear(),
+ key: (i: number) => [...backing.keys()][i] ?? null,
+ get length() {
+ return backing.size
+ },
+} as Storage
+
+const KEY = 'chat-settings'
+const CURRENT = 21
+/** What a 2.6.5 build stamps back into the shared profile. */
+const OLD_BUILD = 20
+
+function seed(settings: Record<string, unknown>, version: number) {
+ backing.set(
+ KEY,
+ JSON.stringify({
+ state: { settings, personas: [], activePersonaId: 'unrestricted', _version: version },
+ version,
+ })
+ )
+}
+
+async function freshStore() {
+ vi.resetModules()
+ vi.stubGlobal('window', globalThis)
+ vi.stubGlobal('localStorage', localStorageShim)
+ const mod = await import('../settingsStore')
+ return mod.useSettingsStore
+}
+
+describe('the cloud confirm opt-in reaches existing profiles, not just fresh installs', () => {
+ beforeEach(() => backing.clear())
+ afterEach(() => vi.unstubAllGlobals())
+
+ it('THE DECISION: a profile carrying the old materialised true still lands on the opt-in off', async () => {
+ seed({ codexCloudConfirmShell: true, temperature: 0.42 }, OLD_BUILD)
+ const s = (await freshStore()).getState().settings
+ expect(s.codexCloudConfirmOptIn).toBe(false)
+ // Unrelated settings survive the migration.
+ expect(s.temperature).toBe(0.42)
+ })
+
+ it('the retired key is never read again, whatever it says on disk', async () => {
+ seed({ codexCloudConfirmShell: true, codexConfirmShell: false }, OLD_BUILD)
+ const s = (await freshStore()).getState().settings
+ expect(s.codexCloudConfirmOptIn).toBe(false)
+ expect(codexConfirmEnabled({
+ confirmShell: s.codexConfirmShell,
+ cloudOptIn: s.codexCloudConfirmOptIn,
+ providerId: 'lu-cloud',
+ })).toBe(false)
+ })
+
+ it('fails safe: a blob the merge never ran on has the key undefined, which is not an opt-in', async () => {
+ // Only reachable at the same store version, where zustand skips migrate
+ // and swaps the settings object in wholesale. The gate reads `=== true`,
+ // so undefined lands on the new policy rather than the old one.
+ seed({ codexCloudConfirmShell: true }, CURRENT)
+ const s = (await freshStore()).getState().settings
+ expect(s.codexCloudConfirmOptIn).toBeUndefined()
+ expect(codexConfirmEnabled({
+ confirmShell: false,
+ cloudOptIn: s.codexCloudConfirmOptIn,
+ providerId: 'lu-cloud',
+ })).toBe(false)
+ })
+
+ it('a profile that predates the key at all gets the new default', async () => {
+ seed({ temperature: 0.7 }, 15)
+ const s = (await freshStore()).getState().settings
+ expect(s.codexCloudConfirmOptIn).toBe(false)
+ })
+
+ it('NO one-shot reset: an opt-in survives the 2.6.5 / 2.6.6 A/B switch', async () => {
+ // The old build stamps its own version back, so this migration runs again
+ // on the next 2.6.6 start. A reset here would quietly wipe the opt-in
+ // every single time the user changed builds.
+ seed({ codexCloudConfirmOptIn: true }, OLD_BUILD)
+ const s = (await freshStore()).getState().settings
+ expect(s.codexCloudConfirmOptIn).toBe(true)
+ })
+
+ it('and it survives however often the migration re-runs', async () => {
+ seed({ codexCloudConfirmOptIn: true }, OLD_BUILD)
+ for (let i = 0; i < 3; i++) {
+ const store = await freshStore()
+ expect(store.getState().settings.codexCloudConfirmOptIn).toBe(true)
+ seed({ ...store.getState().settings }, OLD_BUILD)
+ }
+ })
+
+ it('a fresh install starts opted out', async () => {
+ const s = (await freshStore()).getState().settings
+ expect(s.codexCloudConfirmOptIn).toBe(false)
+ })
+})
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 6a929dc6..e907037c 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -72,7 +72,20 @@ import { DEFAULT_SETTINGS, BUILT_IN_PERSONAS } from '../lib/constants'
// version back when the old build writes the store, so this migration runs
// AGAIN on the next 2.6.6 start. A one-shot reset here would fire on every
// build switch and quietly wipe a user preference each time.
-const STORE_VERSION = 20
+// v21 (2.6.6): added settings.codexCloudConfirmOptIn (default false) and
+// retired settings.codexCloudConfirmShell (default true). Bypass means bypass
+// on a cloud model too (David 2026-08-22, replacing G15a of 2026-08-07), so
+// the cloud shell confirm is an opt-in now.
+// The key had to be a NEW one, not a flipped default on the old one: this
+// store persists the whole settings object, so every existing profile has
+// `codexCloudConfirmShell: true` written to disk, and a changed default alone
+// would never reach it. Reusing the key would have meant a one-shot reset,
+// which the R1 downgrade contract above rules out while 2.6.5 and 2.6.6 share
+// one WebView profile. A new key rides the additive merge instead: the default
+// fills in for everyone, an opt-in the user makes survives every A/B switch,
+// and the stale old key is simply never read again. STRICTLY ADDITIVE and
+// IDEMPOTENT, like v20 and unlike v10 and v19.
+const STORE_VERSION = 21
interface SettingsState {
settings: Settings
diff --git a/src/types/settings.ts b/src/types/settings.ts
index d3815aae..2767bf7d 100644
--- a/src/types/settings.ts
+++ b/src/types/settings.ts
@@ -242,19 +242,23 @@ export interface Settings {
*/
codexConfirmShell: boolean
/**
- * Also confirm shell/code on LU Cloud models even when `codexConfirmShell`
- * is off. Default ON — a remote model reaching unattended local shell is a
- * bigger blast radius than a local model the user deliberately trusts.
+ * Opt in to confirming shell/code on LU Cloud models even when
+ * `codexConfirmShell` is off. Governs BOTH surfaces (Code tab and Agent
+ * mode), and rides on top of Agent's per-tool permission levels.
*
- * Until 2.5.9 this was hard-wired into useCodex, so the confirm toggle above
- * silently did nothing on a cloud model (David 2026-07-24). Same safe default,
- * but now it is a real switch the user can see and turn off.
+ * Default OFF (David 2026-08-22, replacing the ON default this carried as
+ * `codexCloudConfirmShell` since 2.5.9 and the G15a decision of 2026-08-07):
+ * a cloud model follows the same rule as a local one, so Bypass really
+ * bypasses and permission level auto really runs unattended. The user who
+ * picks Bypass has made that decision. Turning this on brings the cloud
+ * confirm back everywhere, Bypass included: that is what the opt-in is for.
*
- * G15a (2026-08-07): governs BOTH surfaces. Agent mode ran the same exec
- * tools on the same cloud model unattended while the Code tab confirmed
- * them; one policy now, riding on top of Agent's per-tool permission levels.
+ * The key is new on purpose. Every profile out there has the old key
+ * materialised as `true`, so reusing it would need a one-shot reset in the
+ * store migration, and R1's downgrade contract forbids one-shot resets while
+ * two builds share a profile. A new key with a new default needs no reset.
*/
- codexCloudConfirmShell: boolean
+ codexCloudConfirmOptIn: boolean
/**
* Shared default workspace for Codex AND Agent (Underlying refactor —
* workspace unification). When set, both surfaces resolve relative paths