diff --git a/desktop/src/workspace/local-workspace-agent-catalog.cjs b/desktop/src/workspace/local-workspace-agent-catalog.cjs index 16ede48..9ac5525 100644 --- a/desktop/src/workspace/local-workspace-agent-catalog.cjs +++ b/desktop/src/workspace/local-workspace-agent-catalog.cjs @@ -334,7 +334,7 @@ class LocalWorkspaceAgentCatalog { } const since = this.indeterminateSince.get(agent.kind) if (previous?.available !== true || runtimeMissing || !Number.isFinite(nowMs) - || !Number.isFinite(since) || nowMs - since >= INDETERMINATE_PROBE_GRACE_MS + || !Number.isFinite(since) || nowMs < since || nowMs - since >= INDETERMINATE_PROBE_GRACE_MS || this.detectedIdentities.get(agent.kind) !== agentVerificationIdentity(agent, this.state().agentPreferences) || !agentVersionIdentified(agent) || !agentCompatible(agent)) return null return { diff --git a/desktop/test/workspace/local-workspace-agent-catalog.test.cjs b/desktop/test/workspace/local-workspace-agent-catalog.test.cjs index df82b6f..14b3495 100644 --- a/desktop/test/workspace/local-workspace-agent-catalog.test.cjs +++ b/desktop/test/workspace/local-workspace-agent-catalog.test.cjs @@ -1265,6 +1265,25 @@ test('an Agent that was never usable is not made available by an inconclusive pr assert.equal(agents()[0].available, false) }) +test('a clock rollback expires the inconclusive probe grace period', async () => { + const time = clock() + let probe = { state: 'ready', source: 'native-auth-status' } + const { agents, catalog } = fixture({ + now: time.now, + detectAgents: async () => [OPENCLAW], + credentialState: async () => probe, + }) + await catalog.refresh() + probe = { state: 'unknown', source: 'native-probe-failed' } + await catalog.refresh() + assert.equal(agents()[0].available, true) + + time.advance(-1000) + await catalog.refresh() + assert.equal(agents()[0].available, false) + assert.equal(agents()[0].availabilitySource, 'native-probe-failed') +}) + test('OpenClaw immediately becomes unavailable when its guarded runtime is unavailable', async () => { let probe = { state: 'ready', source: 'native-auth-status' } const { agents, catalog } = fixture({