Skip to content

[codex] Fix settings model selection#392

Merged
subsy merged 1 commit into
mainfrom
codex/settings-model-picker
May 13, 2026
Merged

[codex] Fix settings model selection#392
subsy merged 1 commit into
mainfrom
codex/settings-model-picker

Conversation

@subsy

@subsy subsy commented May 13, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the TUI settings model field so agents with enumerated models, such as Claude, show selectable model choices instead of only free text. The settings save path also refreshes the dashboard/header model display after a model change, matching the behavior of the dedicated agent/model picker.

Root Cause

The settings dialog always defined the model setting as text, even though agent plugins already expose listModels(). Saving through settings propagated the config to the engine, but did not update RunApp's local detectedModel display state, so the dashboard could continue showing the previous model.

Changes

  • Derive settings model options from the selected agent's listModels() metadata.
  • Preserve free-text input for agents with open-ended model identifiers.
  • Clear the stored model override when the default model option is selected.
  • Refresh local model display state after saving settings.
  • Add focused helper coverage for Claude model options, aliases, open-ended agents, and clearing overrides.

Validation

  • bun test src/tui/components/SettingsView.test.ts src/tui/components/AgentModelPicker.test.ts
  • bun test tests/commands/run.test.ts --grep propagateSettingsToEngine
  • bun run typecheck && bun run build
  • bun run lint (passes with existing unrelated warnings in test files)

Summary by CodeRabbit

  • New Features

    • Model selection options now dynamically update based on the selected agent
    • Enhanced handling of agent and model configuration settings
  • Tests

    • Added test coverage for settings view helper behavior and agent configuration

Review Change Stack

@vercel

vercel Bot commented May 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ralph-tui Ignored Ignored May 13, 2026 6:39pm

Request Review

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 88b4bbf4-7aa2-4eb2-8c1d-f6e74dc39c9f

📥 Commits

Reviewing files that changed from the base of the PR and between bae8094 and 54e78bb.

📒 Files selected for processing (3)
  • src/tui/components/RunApp.tsx
  • src/tui/components/SettingsView.test.ts
  • src/tui/components/SettingsView.tsx

📝 Walkthrough

Walkthrough

SettingsView now accepts agent plugin configuration to resolve active agent names and derive available model options dynamically. The Model setting becomes a select field when known models exist or falls back to text input. RunApp integrates these helpers via a new settings save callback that tracks agent and model changes to update the detected model.

Changes

Settings UI Agent/Model Configuration

Layer / File(s) Summary
SettingsView Agent/Model Helpers and Type Exports
src/tui/components/SettingsView.tsx
SettingType and SettingDefinition are exported; new helpers getConfiguredAgentName() and buildModelOptionsForAgent() resolve configured agent names and derive model choices from plugin configs. buildSettingDefinitions() signature is updated to accept StoredConfig and optional agentConfigs.
SettingsView Dynamic Model Setting and Agent Resolution
src/tui/components/SettingsView.tsx
Agent setting resolves configured name via getConfiguredAgentName(); Model setting dynamically becomes a select (when plugin models exist) or text field (otherwise), with clearing handled when empty string is selected. Empty string displays as "(not set)".
SettingsView Props and Integration
src/tui/components/SettingsView.tsx
SettingsViewProps adds optional agentConfigs parameter, defaults to empty array, and calls updated buildSettingDefinitions() with config and agent configs to produce settings list.
SettingsView Helper Tests
src/tui/components/SettingsView.test.ts
Test suite validates Model becomes select with Claude options for claude agent, resolves options for configured agent aliases, becomes text for open-ended agents, and clears model when default is selected.
RunApp Settings Callback and Config Wiring
src/tui/components/RunApp.tsx
RunApp imports getConfiguredAgentName, adds handleSettingsSave callback that validates availability, compares agent/model before and after, persists via onSaveSettings(), and updates detectedModel when agent or model changes. SettingsView receives agentConfigs={storedConfig.agents} and onSave={handleSettingsSave}.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • subsy/ralph-tui#304: Modifies agent-selection wiring in RunApp/SettingsView to reflect configured custom agents in the settings UI through agent name resolution and model options derivation from plugin configs.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[codex] Fix settings model selection' directly reflects the main change: fixing the settings dialog to properly present model options from agent plugins and ensuring model changes update the display state.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@subsy subsy marked this pull request as ready for review May 13, 2026 18:47
@subsy subsy merged commit b4b0c52 into main May 13, 2026
10 checks passed
@subsy subsy deleted the codex/settings-model-picker branch May 13, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant