Skip to content

Conversation

@michaelneale
Copy link
Collaborator

this is an alternative to: #6350

this attempts to only load extensions when they are needed (as in launch)

Copilot AI review requested due to automatic review settings January 6, 2026 09:47
@michaelneale michaelneale marked this pull request as draft January 6, 2026 09:48
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 implements lazy loading for extensions to improve application startup performance. Instead of loading all extensions when the app launches, they are now registered for deferred loading and only initialized when actually needed (when tools are first requested).

Key Changes

  • Frontend no longer pre-loads extensions on app startup - extensions load lazily when the user begins interacting
  • Backend registers extensions on agent resume without immediately connecting to MCP servers
  • Extensions are automatically loaded on first tool request via get_prefixed_tools

Reviewed changes

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

File Description
ui/desktop/src/App.tsx Removes eager extension loading on app startup; removes unused imports and state setters
crates/goose/src/agents/extension_manager.rs Adds lazy loading infrastructure with pending_configs field and register_extension/ensure_pending_extensions_loaded methods
crates/goose/src/agents/agent.rs Adds register_extension method that handles frontend tools immediately and defers MCP extensions
crates/goose-server/src/routes/agent.rs Replaces eager add_extension calls with lazy register_extension calls in resume_agent

let config_name = config.key().to_string();
let sanitized_name = normalize(config_name);

// Skip if already loaded or already pending
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The comment states "Skip if already loaded or already pending" but the code only checks if the extension is already loaded, not if it's already pending. The code works correctly because HashMap::insert overwrites duplicates and add_extension is idempotent, but the comment should be updated to match the implementation.

Suggested change
// Skip if already loaded or already pending
// Skip if the extension is already loaded

Copilot uses AI. Check for mistakes.
@DOsinga
Copy link
Collaborator

DOsinga commented Jan 6, 2026

Isn't this just going to make the response slower by however long it takes to load the extension?

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