perf: split agent setup into staged phases to reduce startup blocking#8746
Merged
Conversation
setProvider was blocked for ~7s waiting for all extensions (including failing MCPs) to finish loading, even though it only needs the provider. Reorder spawn_agent_setup so provider initialization (~55ms) runs before extension loading (~7s). Signal ProviderReady on the watch channel as soon as the provider and goose-mode are set, then continue loading extensions in the background. update_provider now uses the new get_session_agent_provider_ready() which returns at ProviderReady, while on_prompt and other extension-dependent callers still wait for FullyReady. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…cking Address code review feedback on the staged ProviderReady/FullyReady agent setup: - Phase-2 (extension loading) failures no longer overwrite the watch channel with Err. Since extension failures are non-fatal (individual failures are already logged as warnings), always send FullyReady so late callers to get_session_agent_provider_ready aren't incorrectly rejected. - Promote AgentHandle to Ready and apply pending_working_dir even when phase 2 errors, preventing the session from being bricked when extensions fail but the provider works fine. - Hoist Config::new before the phase split so both phases share a single config read instead of redundant file I/O. - Switch on_set_model and on_set_mode to use get_session_agent_provider_ready since they only touch the provider and goose_mode (both initialized in phase 1), giving the same latency win as update_provider during startup. Signed-off-by: Matt Toohey <contact@matttoohey.com>
… in build_config_update Address remaining code review feedback on the staged ProviderReady/FullyReady agent setup: - Extract get_agent_or_receiver() to deduplicate the session-lookup and AgentHandle matching logic shared by get_session_agent and get_session_agent_provider_ready. The helper returns Either<Agent, Receiver> so each caller only implements its own wait predicate. - Switch build_config_update from get_session_agent (FullyReady) to get_session_agent_provider_ready, since it only reads agent.provider() and agent.goose_mode() — both initialized in phase 1. This prevents build_config_update (called by set_config_option and its background refresh) from blocking on extension loading during startup. Signed-off-by: Matt Toohey <contact@matttoohey.com>
morgmart
approved these changes
Apr 22, 2026
lifeizhou-ap
added a commit
that referenced
this pull request
Apr 23, 2026
* main: fix: preprompt would show after loading session (#8744) commands to acp+ migration: extensions management (#8733) feat: desktop notification when goose finishes a task (#8647) harden code review skill for async state and default-resolution bugs (#8740) Feature/at agent mention (#8571) fix: removed hardcoded dependency of goose-acp-macro (#8753) perf: split agent setup into staged phases to reduce startup blocking (#8746) Add /skills command (#8600) Replace deprecated Claude ACP package links (#8625)
lifeizhou-ap
added a commit
that referenced
this pull request
Apr 23, 2026
* main: (34 commits) fix(goose-server): cache TLS cert to disk to avoid slow startup on first launch (#8174) feat: add Exa AI-powered search tool (#8487) fix: preprompt would show after loading session (#8744) commands to acp+ migration: extensions management (#8733) feat: desktop notification when goose finishes a task (#8647) harden code review skill for async state and default-resolution bugs (#8740) Feature/at agent mention (#8571) fix: removed hardcoded dependency of goose-acp-macro (#8753) perf: split agent setup into staged phases to reduce startup blocking (#8746) Add /skills command (#8600) Replace deprecated Claude ACP package links (#8625) 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) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
set_model,update_provider,build_config_update,update_goose_mode) unblock as soon as the provider is initialized instead of waiting for all extensionsget_agent_or_receiverhelper to deduplicate session lookup logic acrossget_session_agentand the newget_session_agent_provider_readyTest plan
set_model/update_providerrespond faster during startup (before extensions finish loading)on_promptstill waits for full readiness (extensions loaded)🤖 Generated with Claude Code