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.

chore(cost): the gate self-heal covers both new gated tools, and wave two finds its settings

David8d3af32c20d1
diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.ts
index 7b7559f1..6c5bd135 100644
--- a/src/hooks/useCodex.ts
+++ b/src/hooks/useCodex.ts
@@ -52,7 +52,7 @@ import { CREDITS_EXHAUSTED_MESSAGE } from '../lib/credits-exhausted'
import { streamOllamaChatWithTools } from '../lib/ollama-stream-tools'
import { extractToolCallsWithRanges, stripRanges } from '../lib/tool-call-repair'
import { canonicalToolName } from '../lib/loose-tool-parse'
-import { selectRelevantTools, selectRelevantToolsAsync, SMALL_MODEL_MAX_TOOLS, gateCreateTools, wantsMediaTools, CREATE_TOOLS } from '../lib/tool-selection'
+import { selectRelevantTools, selectRelevantToolsAsync, SMALL_MODEL_MAX_TOOLS, gateCreateTools, wantsMediaTools, isGatedTool } from '../lib/tool-selection'
import { generateEmbeddings } from '../api/rag'
import { truncateToolResult } from '../lib/truncate-tool-result'
import { toolCallCapMs, raceWithToolTimeout, SHELL_EXECUTE_DEFAULT_TIMEOUT_MS } from '../lib/tool-timeout'
@@ -1838,7 +1838,7 @@ export function useCodex() {
// A create tool the gate had closed still reaches the registry, so
// the run self-heals: this call runs, and the next step offers the
// schemas instead of pretending the capability is gone.
- if (CREATE_TOOLS.includes(name)) createGateOpened = true
+ if (isGatedTool(name)) createGateOpened = true
return dispatchTool(name, args)
},
lookupCache: convId ? makeInTurnCacheLookup({ convId, turnStartMs }) : undefined,
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 5bf5833b..4f315749 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -52,6 +52,8 @@ export const DEFAULT_SETTINGS: Settings = {
// default; the switch is the support way back without a rollback release.
contextDecay: true,
codexSendWindowTokens: 64000,
+ memoryCloudOptIn: false,
+ codexDefaultMode: 'ask' as const,
builtinEngine: {
ctx: 8192,
flashAttn: 'auto',
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index b893e601..6a929dc6 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -60,7 +60,10 @@ import { DEFAULT_SETTINGS, BUILT_IN_PERSONAS } from '../lib/constants'
// land in the now-built local mode; the visible switch flips back anytime.
// Windows/Linux appMode reflects a real user choice and is never touched.
// v20 (2.6.6): added settings.contextDecay (default true) and
-// settings.codexSendWindowTokens (default 64000) for the tool-result age decay
+// settings.codexSendWindowTokens (default 64000) for the tool-result age decay,
+// plus settings.memoryCloudOptIn (default false, plan A7) and
+// settings.codexDefaultMode (default 'ask', plan C1); all four ride the
+// default-merge, strictly additive, no one-shot reset (R1 downgrade contract)
// and the paid-provider send cap. STRICTLY ADDITIVE and IDEMPOTENT: the merge
// below fills both defaults in and preserves every existing value, and this
// version adds NO one-shot reset the way v10 and v19 did.
diff --git a/src/types/settings.ts b/src/types/settings.ts
index 2b0f46fb..d3815aae 100644
--- a/src/types/settings.ts
+++ b/src/types/settings.ts
@@ -128,6 +128,18 @@ export interface Settings {
* costs more. Local backends ignore it.
*/
codexSendWindowTokens: number
+ /**
+ * Auto memory extraction on lu-cloud only with explicit opt-in (2.6.6, plan
+ * A7): every extraction is a paid model call. Local and BYOK providers are
+ * not gated by this.
+ */
+ memoryCloudOptIn: boolean
+ /**
+ * Global default for the coding mode dropdown (2.6.6, plan C1). A
+ * conversation without its own remembered mode starts here. Approve-and-run
+ * after a plan never inherits bypass implicitly, it falls back to ask.
+ */
+ codexDefaultMode: 'ask' | 'bypass' | 'plan'
// Built-in engine expert tuning (2.6.0 Engine-Sweep). Forwarded to the Rust
// EngineTuning (whitelisted there) on every engine start/swap — Onboarding,
// Discover, model picker and the post-offload self-heal all inherit it via