fix(model-effort): preserve inherited default selections in chat and spawn dialog#257
fix(model-effort): preserve inherited default selections in chat and spawn dialog#257DerrickBarra wants to merge 2 commits intodaggerhashimoto:masterfrom
Conversation
📝 WalkthroughWalkthroughThis PR fixes inherited default model and effort display in chat and spawn dialogs by introducing sentinel values ( Changes
Sequence Diagram(s)sequenceDiagram
participant User as User (Chat UI)
participant Hook as useModelEffort Hook
participant Session as Session Context
participant Gateway as Gateway API
participant WS as WebSocket/HTTP
User->>Hook: Component mounts with inherited defaults
Hook->>Gateway: Fetch /api/gateway/models (get role: 'primary')
Gateway-->>Hook: Return models with roles
Note over Hook: Detect inherited state:<br/>- No explicit sessionModel<br/>- No explicit thinkingLevel
Hook->>Hook: Resolve inherited defaults<br/>selectedModel = 'primary'<br/>selectedEffort = 'thinkingDefault'
Hook-->>User: Display 'primary' in model dropdown<br/>Display 'thinkingDefault' in effort dropdown
User->>Hook: Keep inherited defaults (no change)
Hook->>Session: updateSession(thinkingLevel: undefined)
Session->>WS: PATCH with primaryModelId<br/>and thinkingLevel: null
WS-->>Session: Confirm update
Note over User: UI now correctly shows<br/>inherited state, not concrete<br/>resolved values
sequenceDiagram
participant User as User (Spawn Dialog)
participant Dialog as SpawnAgentDialog
participant Gateway as Gateway API
participant Callback as onSpawn Callback
User->>Dialog: Open spawn dialog
Dialog->>Gateway: Fetch /api/gateway/models (with roles)
Gateway-->>Dialog: Return models including primary role
Dialog->>Dialog: Build modelOptions:<br/>1. 'primary' option (inherited)<br/>2. Other fetched models
Dialog->>Dialog: Set defaultModelId = 'primary'
Dialog-->>User: Display 'primary' as default<br/>model selector option
User->>Dialog: Select 'primary' (inherited default)
User->>Dialog: Click spawn
Dialog->>Dialog: Convert 'primary' → undefined<br/>spawnModel = undefined
Dialog->>Callback: Call onSpawn({<br/> kind, agentName, task,<br/> model: undefined ← inherited<br/>})
Note over Callback: Downstream handler knows<br/>undefined = use inherited default
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Supersedes #256 solely to correct source-fork provenance. This PR uses the same validated |
What
Fix the model / effort UI so sessions that inherit OpenClaw defaults keep showing the inherited selection instead of looking like they were explicitly overridden.
In Plain English
This PR makes Nerve tell the truth about default model settings.
When a session or spawn flow is using the inherited OpenClaw defaults, the UI could make it look like some other model or effort level was explicitly selected. That is confusing because the screen stops matching the actual config.
This fix keeps inherited defaults visible as inherited defaults, so users can trust what the chat controls and spawn dialog are showing.
This covers two user-visible surfaces:
On the validated dogfood setup, inherited defaults now display as
primarymodel andmediumeffort, matching ouropenclaw.jsonconfiguration file for theprimarymodel and default thinking level.Why
Closes #255
Before this change, Nerve could resolve inherited defaults down to a concrete provider/model string or otherwise lose the inherited-default state in the UI. That made a default-inheriting session look like it had an explicit override, which is misleading and makes model / effort selection harder to reason about.
How
primaryinuseModelEffortprimaryis shown as the default inherited model optionmodelfrom spawn payloads when the user keeps the inheritedprimaryselectionBranch / validation notes for maintainers:
bug/default-model-effortupstream/master0 behind / 2 aheadversusupstream/masternpm run lint(passes with pre-existing warnings only)npm run build(passes)Type of Change
Checklist
npm run lintpassesnpm run build && npm run build:serversucceedsnpm test -- --runpassesSummary by CodeRabbit
New Features