Skip to content

Conversation

@lifeizhou-ap
Copy link
Collaborator

@lifeizhou-ap lifeizhou-ap commented Jan 23, 2026

Summary

  1. Optimise the load time when app starts or new session starts

    • Reduce the call to check ELEVENLAB_API_KEY exists or not. This call is expensive as takes around 3s because it checks keychain at the backend

      • Consolidate dictation settings retrieval to eliminate duplicate hook calls which makes the duplicated api call
      • Only check ELEVENLAB_API_KEY when the provider is eleven_lab, otherwise no need to check
      • Add module-level caching for ElevenLabs API key checks to avoid redundant keychain reads
    • Fix getProviders callback memoization in ConfigContext using a ref to prevent unnecessary recreations

  2. Enhanced user experience to show the puzzle of current session extension only after the extensions are loaded.

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Manual testing by adding sleep in the /config/read endpoint

Before
https://github.com/user-attachments/assets/2818649f-fce3-48de-806f-861de3612d74

After
https://github.com/user-attachments/assets/56546fdc-c722-4d5a-a7b5-5adde2f66b19

Copilot AI review requested due to automatic review settings January 23, 2026 12:30
Copy link
Contributor

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 optimizes config loading in the desktop UI to improve performance, particularly around dictation settings and provider configuration. The main issue being addressed appears to be excessive calls to read config values (especially secret keys from the keychain).

Changes:

  • Add module-level caching for ElevenLabs API key checks to avoid redundant keychain reads
  • Fix getProviders callback memoization in ConfigContext using a ref to prevent unnecessary recreations
  • Consolidate dictation settings retrieval to eliminate duplicate hook calls

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ui/desktop/src/hooks/useWhisper.ts Add constant for elevenlabs provider and export dictationSettings
ui/desktop/src/hooks/useDictationSettings.ts Implement module-level cache for ElevenLabs key with conditional loading
ui/desktop/src/hooks/dictationConstants.ts Add DICTATION_PROVIDER_ELEVENLABS constant and isSecretKeyConfigured helper
ui/desktop/src/components/settings/dictation/VoiceDictationToggle.tsx Replace string literal with constant
ui/desktop/src/components/settings/dictation/ProviderSelector.tsx Replace string literals with constant
ui/desktop/src/components/settings/dictation/ProviderInfo.tsx Replace string literal with constant
ui/desktop/src/components/settings/dictation/ElevenLabsKeyInput.tsx Use helper function and update cache, remove debug logs
ui/desktop/src/components/bottom_menu/BottomMenuExtensionSelection.tsx Add loading state to prevent button visibility flicker
ui/desktop/src/components/ConfigContext.tsx Fix getProviders memoization with ref pattern
ui/desktop/src/components/ChatInput.tsx Get dictationSettings from useWhisper, remove duplicate hook call
crates/goose-server/src/routes/config_management.rs Add 3-second debug sleep for secret config reads (TODO comment)

Comment on lines 225 to 229
// TODO: Remove this - simulating slow keychain access for debugging
if query.is_secret {
tokio::time::sleep(std::time::Duration::from_secs(3)).await;
}

Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

This debug code adds a 3-second delay to all secret config reads and should not be merged to production. Remove this entire block before merging.

Suggested change
// TODO: Remove this - simulating slow keychain access for debugging
if query.is_secret {
tokio::time::sleep(std::time::Duration::from_secs(3)).await;
}

Copilot uses AI. Check for mistakes.
@zanesq zanesq merged commit 6375aac into main Jan 23, 2026
19 checks passed
@zanesq zanesq deleted the lifei/optimise-load-config branch January 23, 2026 16:45
@zanesq
Copy link
Collaborator

zanesq commented Jan 23, 2026

Thanks!

zanesq added a commit that referenced this pull request Jan 26, 2026
* origin/main:
  fix: dispatch ADD_ACTIVE_SESSION event before navigating from "View All" (#6679)
  Speed up Databricks provider init by removing fetch of supported models (#6616)
  fix: correct typos in documentation and Justfile (#6686)
  docs: frameDomains and baseUriDomains for mcp apps (#6684)
  docs: add Remotion video creation tutorial (#6675)
  docs: export recipe and copy yaml (#6680)
  Test against fastmcp (#6666)
  docs: mid-session changes (#6672)
  Fix MCP elicitation deadlock and improve UX (#6650)
  chore: upgrade to rmcp 0.14.0 (#6674)
  [docs] add MCP-UI to MCP Apps blog (#6664)
  ACP get working dir from args.cwd (#6653)
  Optimise load config in UI (#6662)

# Conflicts:
#	ui/desktop/src/components/Layout/AppLayout.tsx
katzdave added a commit that referenced this pull request Jan 26, 2026
…o dkatz/canonical-context

* 'dkatz/canonical-provider' of github.com:block/goose: (27 commits)
  docs: add Remotion video creation tutorial (#6675)
  docs: export recipe and copy yaml (#6680)
  Test against fastmcp (#6666)
  docs: mid-session changes (#6672)
  Fix MCP elicitation deadlock and improve UX (#6650)
  chore: upgrade to rmcp 0.14.0 (#6674)
  [docs] add MCP-UI to MCP Apps blog (#6664)
  ACP get working dir from args.cwd (#6653)
  Optimise load config in UI (#6662)
  Fix GCP Vertex AI global endpoint support for Gemini 3 models (#6187)
  fix: macOS keychain infinite prompt loop    (#6620)
  chore: reduce duplicate or unused cargo deps (#6630)
  feat: codex subscription support (#6600)
  smoke test allow pass for flaky providers (#6638)
  feat: Add built-in skill for goose documentation reference (#6534)
  Native images (#6619)
  docs: ml-based prompt injection detection (#6627)
  Strip the audience for compacting (#6646)
  chore(release): release version 1.21.0 (minor) (#6634)
  add collapsable chat nav (#6649)
  ...
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