Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): keep a down api provider with no fallback retryable, not permanently blocked
[._.]/ Adam Eivy4dd32d54ccc1
diff --git a/server/services/agentProviderResolution.js b/server/services/agentProviderResolution.jsindex 48ee9aae46..403d1ac31b 100644--- a/server/services/agentProviderResolution.js+++ b/server/services/agentProviderResolution.js@@ -95,13 +95,16 @@ export async function resolveAgentProviderAndModel(task) {fallbackModelPin = fallbackResult.model || null;} else {const errorMsg = `Provider ${provider.id} unavailable (${status.message}) and no fallback available`;- // A directly-resolved api provider that is down with no fallback would- // return here — BEFORE the harness check below — as a transient- // "unavailable", so the task would retry forever even though an api provider- // can never supply a file-writing harness whether it's up or down. Mark it- // permanent so the caller retires it. A CLI provider that's merely down stays- // transient (it may recover).- return { ok: false, error: errorMsg, providerId: provider.id, providerStatus: status, permanent: directProviderType === 'api' };+ // TRANSIENT, never permanent: a null fallback here can mean a configured+ // CLI/TUI fallback is merely momentarily down (getFallbackProvider skips+ // unavailable candidates), so blocking would strand a task that recovers+ // when that fallback returns. Permanence is decided by PROVIDER TYPE where we+ // can actually inspect it — the harness check below, reached once the+ // provider is available again — not inferred from a transient unavailable ++ // null-fallback combination. A down api provider with no viable path retries+ // cheaply (it fails fast here, spawning no agent) and self-heals to a+ // permanent block the moment it becomes reachable.+ return { ok: false, error: errorMsg, providerId: provider.id, providerStatus: status };}}diff --git a/server/services/agentProviderResolution.test.js b/server/services/agentProviderResolution.test.jsindex b1e700816c..a7de3eceb3 100644--- a/server/services/agentProviderResolution.test.js+++ b/server/services/agentProviderResolution.test.js@@ -68,14 +68,16 @@ describe('resolveAgentProviderAndModel', () => {expect(r.error).toContain('no fallback available');expect(r.providerId).toBe('p1');expect(r.providerStatus).toEqual({ message: 'usage-limit', reason: 'limit' });- // A CLI provider that's merely down stays transient — it may recover.- expect(r.permanent).toBe(false);+ // A provider that's merely down stays transient — it may recover.+ expect(r.permanent).toBeFalsy();});- it('marks a down api provider with no fallback PERMANENT (never gains a harness)', async () => {- // An api provider that is unavailable with no fallback returns from the- // availability branch before the harness check; without a permanent flag the- // task would retry forever even though an api provider can never run an agent.+ it('keeps a down api provider with no fallback TRANSIENT (a null fallback may be a momentarily-down CLI fallback)', async () => {+ // Permanence is decided by provider TYPE at the harness check (reached once the+ // provider is available), NOT inferred from a transient unavailable + null+ // fallback here — a null fallback can mean a configured CLI/TUI fallback is+ // merely down, which must stay retryable. The down api provider retries cheaply+ // and self-heals to a permanent block the moment it's reachable.const provider = { id: 'ollama', type: 'api' };getActiveProvider.mockResolvedValue(provider);isProviderAvailable.mockReturnValue(false);@@ -86,6 +88,19 @@ describe('resolveAgentProviderAndModel', () => {const r = await resolveAgentProviderAndModel(TASK);expect(r.ok).toBe(false);expect(r.providerId).toBe('ollama');+ expect(r.permanent).toBeFalsy();+ });++ it('marks an AVAILABLE api provider permanent (harness check, self-heal target for a once-down api)', async () => {+ // The self-heal path for the transient case above: once the api provider is+ // reachable, resolution reaches the harness check and blocks permanently.+ const provider = { id: 'ollama', type: 'api' };+ getActiveProvider.mockResolvedValue(provider);+ isProviderAvailable.mockReturnValue(true);++ const r = await resolveAgentProviderAndModel(TASK);+ expect(r.ok).toBe(false);+ expect(r.error).toContain('no file-writing harness');expect(r.permanent).toBe(true);});