feat: Add model parameter to spawn session options#159
Open
mark9232 wants to merge 1 commit intoslopus:mainfrom
Open
feat: Add model parameter to spawn session options#159mark9232 wants to merge 1 commit intoslopus:mainfrom
mark9232 wants to merge 1 commit intoslopus:mainfrom
Conversation
Allows mobile app to specify model (e.g., 'sonnet', 'opus') when spawning sessions. Changes: - Add `model` field to SpawnSessionOptions interface - Extract `model` from spawn-happy-session RPC params - Set ANTHROPIC_MODEL env var from model option (takes precedence over profile) - Pass --model flag to Claude CLI when spawning This fixes an issue where model selection in the mobile app was ignored, causing sessions to always start with the default model. Fixes slopus#158 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
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.
Summary
Allows mobile app to specify model (e.g., 'sonnet', 'opus') when spawning sessions.
Changes:
modelfield toSpawnSessionOptionsinterfacemodelfromspawn-happy-sessionRPC paramsANTHROPIC_MODELenv var from model option (takes precedence over profile)--modelflag to Claude CLI when spawning (both regular and tmux modes)Problem
When selecting a model in the Happy Coder mobile app before spawning a session, the model selection was ignored. Sessions always started with the default model (Opus 4.5) regardless of user selection.
Evidence from daemon logs:
No
modelfield was being passed or used.Solution
This PR adds support for a
modelfield in the spawn session options. When the mobile app sendsmodel: "sonnet", the daemon will:ANTHROPIC_MODEL=sonnetin the spawned process environment--model sonnetflag to the Claude CLIThe fix is backward compatible - if mobile doesn't send
model, behavior is unchanged.Files Changed
src/modules/common/registerCommonHandlers.ts- Addmodelto interfacesrc/api/apiMachine.ts- Extract and passmodelfrom RPC paramssrc/daemon/run.ts- Usemodelin env and CLI argsTesting
Note for Mobile App
The mobile app (slopus/happy) needs to be updated to send
modelin the spawn params:{ "type": "spawn-in-directory", "directory": "/path/to/dir", "agent": "claude", "model": "sonnet" }Fixes #158
Generated with Claude Code
via Happy
Co-Authored-By: Claude noreply@anthropic.com
Co-Authored-By: Happy yesreply@happy.engineering