perf: parallelize provider resolution and eagerly init SQLite pool - #8899
Conversation
Replace the sequential `for` loop in `entries()` with `futures::future::join_all` so all 47 providers resolve their identity and configuration concurrently. Each `entry_for_provider` call is read-only (registry read lock, config reads, SQLite SELECT), so parallel execution is safe. This should reduce per-call time from ~1.6s to ~200ms (bounded by the slowest single provider at ~208ms). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…solution The SQLite pool uses connect_lazy_with, so initialization (schema check, migrations) only triggers on first use — currently inside read_snapshot during provider inventory. This adds ~1.6s to the critical path. Spawn a background task to call pool() immediately after SessionManager creation, so the pool initializes concurrently with provider resolution (~811ms) and describe_provider work. By the time read_snapshot or listSessions actually needs the pool, the OnceCell should already be resolved. This is safe because pool() uses get_or_try_init which handles concurrent callers correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
join_all runs all futures on the same tokio task, only interleaving at .await points. Since describe_provider does blocking work (config reads, hash computation) between awaits, the futures executed sequentially. Use tokio::spawn to dispatch each provider onto a separate thread from the tokio thread pool, enabling actual concurrent execution across all 47 providers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2ed8c7d459
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Remove implementation detail lines from the comment about eager SQLite pool initialization, keeping only the intent description per code review feedback. Signed-off-by: Matt Toohey <contact@matttoohey.com>
The filter_map chain silently discarded JoinErrors (task panics) and anyhow::Errors (SQLite/config failures), only filtering Ok(None). Replace with explicit error handling that propagates JoinError and inner errors with ?, matching the original sequential behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be152ca359
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Store the pool warmup JoinHandle and abort it in Drop, preventing the fire-and-forget task from outliving the agent (causing nondeterministic cleanup failures in tests). Also log a warning if eager init fails, instead of silently discarding the error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e24e758cf5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This reverts commit e24e758.
* main: (24 commits) fix: copy and content improvements in goose2 (#8886) feat: make ollama host configurable in goose2 (#8912) polish sidebar navigation and project icons (#8896) fix: model picker stays usable during provider loading (#8900) feat: update provider row after saving credentials (#8914) feat: support google model inventory refresh (#8913) chore: Added goose 2 UI refactor review skill (#8903) blog: goose with peekaboo (#8884) blog: Built-in Local Inference blogpost. (#8808) perf: parallelize provider resolution and eagerly init SQLite pool (#8899) refactor: update goose2 credential management behind provider-scoped ACP/core API (#8887) fix: handle acp requests concurrently (#8781) build: set LLAMA_STATIC_CRT for Windows CUDA (#8901) perf: deduplicate _goose/providers/list RPC call at startup (#8873) chore: add a bit more instructions in the release pr (#8890) chore: disable spellcheck in model search (#8889) add skills to the chat composer (#8881) mergeable configs + cleanup (#8378) refactor: agent provider to use explicit type states (#8879) [goose2] MCP Apps: hydrate and replay app payloads in Goose2 (#8632) ...
…aif-goose#8899) Signed-off-by: Matt Toohey <contact@matttoohey.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Stats
Initial call to get all providers: 3.3s -> 1.0s
Subsequent calls to get all providers: 1.6s -> 244ms
Summary
tokio::spawnfor concurrent provider resolutionTest plan
_goose/providers/listreturns the same results as before🤖 Generated with Claude Code