mirror of
https://github.com/Ryder-Sun/Meldwork.git
synced 2026-11-07 06:56:03 -10:00
Expire readiness grace when the system clock rolls back
Avoid retaining stale Agent availability after a clock rollback. Checks: 107 readiness and routing tests.
This commit is contained in:
1 parent
38f54eebf6
commit
bbe0420619
2 files changed
+20
-1
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in new issue
Block a user