fix: refresh available agents after doctor checks complete#406
Conversation
Previously, the list of available agent tools was only populated at app startup. Installing a new agent via Doctor and re-running checks would show it as installed, but it wouldn't appear in the agent selector until the app was reloaded. Now `refreshProviders()` is called after each doctor run so newly-installed agents are immediately selectable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoid delaying the doctor report by not awaiting refreshProviders(). The agent selector updates reactively once the promise resolves, so there's no need to block the loading spinner on provider discovery. 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: e35877f12f
ℹ️ 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".
| // available in the agent selector without requiring an app reload. | ||
| // Fire-and-forget: the agent selector updates reactively once the | ||
| // promise resolves, so no need to delay showing the doctor report. | ||
| refreshProviders(); |
There was a problem hiding this comment.
Serialize provider refresh before clearing loading state
runChecks() now launches refreshProviders() without awaiting it, then immediately drops doctorState.loading in the finally block. That allows a second doctor run to start while the first provider discovery is still in flight, and each refreshProviders() call overwrites agentState.providers when it resolves (apps/staged/src/lib/features/agents/agent.svelte.ts:83-94). In the common flow of installing an agent from Doctor and quickly pressing “Re-run”, the slower earlier refresh can win the race and put the selector back to the stale provider list until the user refreshes again or reloads the app.
Useful? React with 👍 / 👎.
Summary
Test plan
🤖 Generated with Claude Code