fix(agents): keep agent_refresh_models off the main thread and cache newest_install (#8070)

Opening the New Agent Task page froze the UI when a native agent such as Codex had several installs on PATH: agent_refresh_models was a synchronous command, so it resolved provider specs and ran <agent> --version for every candidate on the main thread, while agent_commands, agent_probe and catalog completion repeated the same blocking lookup on Tokio workers. agent_refresh_models now runs on the blocking pool, the remaining provider_specs / resolve_for_launch / catalog requests move to spawn_blocking, and newest_install probes candidates in parallel with a per-binary cache (canonical path, mtime, size, inode; 60 s) and single-flight deduplication.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-12-05 01:59:50 +08:00
1 джерело 5cfd5157d0
коміт d48146f52d
8 files changed
+226 -28

No files matched your search

+5 -1
Переглянути файл
@@ -200,7 +200,11 @@ export const commands = {
* recovery policy and safety guardrails.
*/
agentReconcileInterrupted: () => typedError<AgentRecoveryReport, IdeError>(__TAURI_INVOKE("agent_reconcile_interrupted")),
/** Refreshes the model catalog; force bypasses freshness, not the cooldown. */
/**
* Refreshes the model catalog; force bypasses freshness, not the cooldown.
* Reads provider config and resolves the agent executable on PATH, so it runs on the
* blocking pool.
*/
agentRefreshModels: (provider: string, force: boolean, model: string | null) => typedError<AgentModelCatalog, IdeError>(__TAURI_INVOKE("agent_refresh_models", { provider, force, model })),
/**
* Installs the registry's current version of agent `id` (also to update it), streaming