Skip to content

persist and reliably apply chat model selection#8734

Merged
morgmart merged 9 commits into
mainfrom
morganm/fix-chat-model-selection-review
Apr 21, 2026
Merged

persist and reliably apply chat model selection#8734
morgmart merged 9 commits into
mainfrom
morganm/fix-chat-model-selection-review

Conversation

@morgmart
Copy link
Copy Markdown
Collaborator

Category: fix
User Impact: New chats now remember and visibly use the selected Goose model instead of quietly falling back to a different one.
Problem: Goose could appear selected without any model shown, even though ACP would still resolve one at send time. After a user chose a model, new chats and Home-session handoffs did not consistently inherit it, and failed model switches could leave the UI showing a sticky preference that never actually took effect.
Solution: This change resolves an effective model for the picker, seeds new chats from either the user's last explicit choice or Goose's configured default, and only persists model state after ACP has accepted it. The model-resolution logic is centralized so Home sessions, provider switches, and new-chat creation all stay in sync.

File changes

ui/goose2/src/app/AppShell.tsx
Seeds Home sessions and brand-new chats from a resolved provider/model preference instead of leaving Goose visually blank. Reused Home drafts now apply the chosen model to ACP before session state says that model is active.

ui/goose2/src/app/lib/homeSessionStorage.ts
Extracts Home-session localStorage helpers so AppShell stays focused on session orchestration instead of storage plumbing.

ui/goose2/src/features/chat/hooks/tests/useChatSessionController.test.ts
Adds coverage for stored model defaults, Goose config fallback behavior, pending Home-session handoff, and rollback after a failed model switch. These tests lock in the UX expectations behind the picker changes.

ui/goose2/src/features/chat/hooks/useChatSessionController.ts
Moves session controller model handling onto a resolved effective-model state and ensures pending Home state is prepared in ACP before the session records the model. This keeps first-send behavior aligned with what the composer shows.

ui/goose2/src/features/chat/hooks/useResolvedAgentModelPicker.ts
Introduces a dedicated hook to resolve the current picker model from session state, stored preferences, provider inventory defaults, and Goose config defaults. It also makes explicit model selections sticky per agent and restores the prior preference if ACP rejects a model switch.

ui/goose2/src/features/chat/lib/modelPreferences.ts
Adds localStorage-backed persistence for per-agent model choices so new chats can inherit the last successful explicit selection.

ui/goose2/src/features/chat/lib/sessionModelPreference.ts
Adds a small resolver for turning provider/project context into the provider/model pair that new sessions should start with.

  1. Open Goose 2 on Home with Goose selected in the composer.
  2. Verify the composer shows an actual model for Goose instead of leaving the model state blank.
  3. Choose a different Goose-backed model, then start a chat and return to Home or open another new chat.
  4. Verify the next new chat inherits that chosen model automatically and the visible provider/model match the backend session that gets prepared.
  5. If you simulate a failed model switch, verify the previous stored model remains the sticky default instead of the failed choice.

Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5dc7943c1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/goose2/src/features/chat/hooks/useResolvedAgentModelPicker.ts Outdated
Comment thread ui/goose2/src/features/chat/hooks/useChatSessionController.ts Outdated
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed0beb941d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/goose2/src/features/chat/lib/sessionModelPreference.ts Outdated
Comment thread ui/goose2/src/app/AppShell.tsx Outdated
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f74fbc9589

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/goose2/src/app/AppShell.tsx
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 048456cb01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/goose2/src/features/chat/hooks/useResolvedAgentModelPicker.ts Outdated
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ec1eb0c74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/goose2/src/app/AppShell.tsx
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e4603c252

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/goose2/src/features/chat/hooks/useResolvedAgentModelPicker.ts
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8821790dd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/goose2/src/app/lib/resolveSupportedSessionModelPreference.ts Outdated
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
@morgmart morgmart added this pull request to the merge queue Apr 21, 2026
Merged via the queue into main with commit 7325fbd Apr 21, 2026
24 checks passed
@morgmart morgmart deleted the morganm/fix-chat-model-selection-review branch April 21, 2026 21:54
spikewang pushed a commit to spikewang/goose that referenced this pull request Apr 22, 2026
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
lifeizhou-ap added a commit that referenced this pull request Apr 22, 2026
* main:
  feat: extend goose2 context window ux with auto-compaction (#8721)
  improve goose2 agent management flows (#8737)
  alexhancock/tui-improvements (#8736)
  fix: add strict:false to Responses API tools and gpt-5.4 to known models (#8636)
  persist and reliably apply chat model selection (#8734)
  merge goose-acp crate into goose (#8726)
  docs: AGENTS.md section on goose2 desktop backend architecture (#8732)
  feat: goose2 message bubble + action tray (#8720)
  consolidate provider ACP methods onto inventory (#8710)
  ci: declare and enforce MSRV of 1.91.1 (#8670)
  fix(ui): correct grammar in apps view description (#8668) (#8679)
  Stop load openai fast model for openapi compatible custom endpoint (#8644)
lifeizhou-ap added a commit that referenced this pull request Apr 22, 2026
* main: (41 commits)
  removed the specific code owner for documentation change (#8749)
  fix(providers): handle missing delta field in streaming chunks (#8700)
  refactor(providers): extract http_status module and rename handle_status_openai_compat (#8620)
  fix(providers/openai): accept streaming chunks with both reasoning fields (#8715)
  feat: associate threads with projects (#8745)
  upgrade goose sdk and tui to be compatible with the latest agentclientprotocol/sdk package (#8667)
  feat: extend goose2 context window ux with auto-compaction (#8721)
  improve goose2 agent management flows (#8737)
  alexhancock/tui-improvements (#8736)
  fix: add strict:false to Responses API tools and gpt-5.4 to known models (#8636)
  persist and reliably apply chat model selection (#8734)
  merge goose-acp crate into goose (#8726)
  docs: AGENTS.md section on goose2 desktop backend architecture (#8732)
  feat: goose2 message bubble + action tray (#8720)
  consolidate provider ACP methods onto inventory (#8710)
  ci: declare and enforce MSRV of 1.91.1 (#8670)
  fix(ui): correct grammar in apps view description (#8668) (#8679)
  Stop load openai fast model for openapi compatible custom endpoint (#8644)
  feat(hooks): add Husky git hooks for ui/goose2 (#8577)
  fix: links in chat could not be opened (#8544)
  ...
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.

3 participants