-
Notifications
You must be signed in to change notification settings - Fork 48
feat(claude-code): add model selection for the claude-code engine#434
feat(claude-code): add model selection for the claude-code engine #434r-sayar wants to merge 2 commits into
Conversation
libsignal and @electron/node-gyp were pinned to commit hashes that no longer exist on any branch, causing `yarn install` to fail for anyone without those exact SHAs in their local git cache. Replaced the resolved SHA pins with branch-head references so the lockfile resolves cleanly on a fresh clone. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allows users to choose which Claude model the claude-code engine uses instead of always relying on the CLI default (claude-sonnet-4-6). Changes: - authStore: add `claudeCodeModel` field to the credentials blob with `loadClaudeCodeModel` / `saveClaudeCodeModel` helpers - apiKeyIpc: register `settings:claude-code:model:get/set` IPC handlers - preload/shell: expose `getModel` / `setModel` on the claudeCode API - globals.d.ts: add TypeScript types for the new IPC methods - runEngine: load the saved model for the claude-code engine path and populate SpawnContext.model - adapter: pass `--model <id>` to the claude CLI when a model is set (omitted when null so the CLI default is preserved) - ConnectionsPane: add a model <select> under the Anthropic card, visible when connected; persists immediately on change Available options: Haiku 4.5, Sonnet 4.5, Sonnet 4.6, Opus 4.5, Opus 4.7, and a "Default" option that omits the flag entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/src/main/settings/apiKeyIpc.ts">
<violation number="1" location="app/src/main/settings/apiKeyIpc.ts:582">
P2: `handleClaudeCodeModelSet` accepts renderer-provided `model` without runtime validation (no `assertString` or allowlist check), unlike every other IPC handler in this file that validates user input before persisting. This risks invalid persisted state and downstream CLI invocation with malformed `--model` values.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Fix all with cubic | Re-trigger cubic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: handleClaudeCodeModelSet accepts renderer-provided model without runtime validation (no assertString or allowlist check), unlike every other IPC handler in this file that validates user input before persisting. This risks invalid persisted state and downstream CLI invocation with malformed --model values.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/settings/apiKeyIpc.ts, line 582:
<comment>`handleClaudeCodeModelSet` accepts renderer-provided `model` without runtime validation (no `assertString` or allowlist check), unlike every other IPC handler in this file that validates user input before persisting. This risks invalid persisted state and downstream CLI invocation with malformed `--model` values.</comment>
<file context>
@@ -570,6 +574,19 @@ async function handleClaudeCodeLogout(): Promise<{ opened: boolean; error?: stri
+ return { model };
+}
+
+async function handleClaudeCodeModelSet(
+ _e: Electron.IpcMainInvokeEvent,
+ model: string | null,
</file context>
Cheggin
commented
May 17, 2026
thanks! will take a look at this
didnt add this yet bc I didn't get requests for it but clearly I should haha
Uh oh!
There was an error while loading. Please reload this page.
Summary
The claude-code engine currently passes no
--modelflag to theclaudeCLI, meaning every session uses whatever the CLI defaults to. This PR lets users pick a specific Claude model from the Settings panel.--modelflag entirely, preserving the CLI's current default (claude-sonnet-4-6).Changes
authStore.tsclaudeCodeModelfield to credentials blob +loadClaudeCodeModel/saveClaudeCodeModelapiKeyIpc.tssettings:claude-code:model:getandsettings:claude-code:model:setIPC handlerspreload/shell.tsgetModel/setModelon theclaudeCodeAPI bridgeglobals.d.tsrunEngine.tsclaude-codeengine path and populatesSpawnContext.modeladapter.ts--model <id>to the claude CLI when a model is set; omits it when nullConnectionsPane.tsx<select>under the Anthropic card, visible when connected; persists on changeTest plan
claude-sonnet-4-6)--modelflag🤖 Generated with Claude Code
Summary by cubic
Adds model selection to the
claude-codeengine so you can choose a Claude model in Settings; the engine passes--modelto theclaudeCLI when set and falls back to the CLI default otherwise. Also fixesyarn.lockto resolve install failures from stale git SHAs.New Features
claudewith--model <id>; "Default" omits the flag (CLI default isclaude-sonnet-4-6).Dependencies
yarn.lockfor@electron/node-gypandlibsignalwith branch heads to allow cleanyarn install.Written for commit 1e1c2bf. Summary will update on new commits. Review in cubic