Skip to content

Fix provider setup composer refresh#30

Merged
EYHN merged 3 commits into
AFK-surf:mainfrom
RayZhao1998:bugfix/provider-setup-refresh
May 18, 2026
Merged

Fix provider setup composer refresh#30
EYHN merged 3 commits into
AFK-surf:mainfrom
RayZhao1998:bugfix/provider-setup-refresh

Conversation

@RayZhao1998
Copy link
Copy Markdown
Contributor

Summary

  • broadcast AI provider store changes after settings or secrets are saved
  • reload the chat composer model state when AI provider settings change
  • keep this scoped to the stale composer state bug without broader runtime hot-reload changes

Fixes #29.

Notes

Draft PR #27 also touches this area as part of a broader runtime settings hot-reload change. This PR intentionally keeps the fix narrow and emits the notification at the provider store layer so any store mutation path can refresh the composer state.

Validation

  • BUILD_CONFIGURATION=UnsignedDebug bash DevKit/Scripts/workspace_build_debug.sh
  • swiftformat / swiftlint on modified Swift files

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses stale chat composer model/provider state after AI provider configuration changes by broadcasting provider store mutations and reloading the composer when those notifications arrive.

Changes:

  • Added an aiProviderSettingsDidChange notification name.
  • Posted that notification after provider settings or secrets are saved.
  • Subscribed ChatEditorViewModel to reload selected model state on provider changes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
macos/OpenBridge/Notifications/NotificationNames.swift Adds the AI provider settings change notification name.
macos/OpenBridge/Interface/Chat/ChatEditorViewModel.swift Observes provider settings notifications and reloads composer model state.
macos/OpenBridge/Agent/BridgeAIProviderSecretStore.swift Emits provider change notifications after settings/secret saves.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +138 to +140
.sink { [weak self] _ in
Task { [weak self] in
await self?.loadSelectedModel()
Comment on lines +134 to +136
private func setupAIProviderSettingsObservation() {
aiProviderSettingsCancellable = NotificationCenter.default
.publisher(for: .aiProviderSettingsDidChange)
@EYHN EYHN merged commit 08c8863 into AFK-surf:main May 18, 2026
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.

Chat composer does not refresh after first AI provider setup

3 participants