Skip to content

fix: refresh available agents after doctor checks complete#406

Merged
matt2e merged 2 commits intomainfrom
detect-new-agents
Mar 18, 2026
Merged

fix: refresh available agents after doctor checks complete#406
matt2e merged 2 commits intomainfrom
detect-new-agents

Conversation

@matt2e
Copy link
Contributor

@matt2e matt2e commented Mar 18, 2026

Summary

  • After doctor checks complete, re-discover providers so newly-installed agents are immediately available in the agent selector without requiring an app reload
  • Uses fire-and-forget pattern so the doctor report displays immediately while agent discovery happens in the background

Test plan

  • Run doctor checks after installing a new agent and verify it appears in the agent selector without reloading
  • Verify doctor report still displays promptly (not blocked by provider refresh)

🤖 Generated with Claude Code

matt2e and others added 2 commits March 18, 2026 11:30
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>
@matt2e matt2e requested review from baxen and wesbillman as code owners March 18, 2026 01:17
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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();

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@matt2e matt2e merged commit c824a29 into main Mar 18, 2026
4 checks passed
@matt2e matt2e deleted the detect-new-agents branch March 18, 2026 01:28
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.

1 participant