mirror of
https://github.com/Ryder-Sun/Meldwork.git
synced 2026-11-07 06:56:03 -10:00
Keep system probe failures distinct from incompatibility
Treat CLI spawn errors as inconclusive rather than proof of missing capabilities. Verified the CLI discovery suite and git diff --check.
This commit is contained in:
1 parent
250cef7619
commit
65937244c4
2 files changed
+18
-2
No files matched your search
@@ -465,11 +465,12 @@ async function probeAgentCapabilities(kind, executable, options = {}) {
|
||||
const timedOut = error?.killed === true || error?.code === 'ETIMEDOUT'
|
||||
if (timedOut && timeout === 8000) continue
|
||||
const diagnostic = `${error?.stdout || ''}\n${error?.stderr || ''}\n${error?.message || ''}`
|
||||
return { probe, error: true, timedOut, authRequired: authFailureCertainty(diagnostic) === 'definitive' }
|
||||
return { probe, error: true, timedOut, systemError: typeof error?.code === 'string' && !timedOut,
|
||||
authRequired: authFailureCertainty(diagnostic) === 'definitive' }
|
||||
}
|
||||
}
|
||||
}))
|
||||
const failed = results.find(result => !result.timedOut && !result.authRequired && (result.error
|
||||
const failed = results.find(result => !result.timedOut && !result.systemError && !result.authRequired && (result.error
|
||||
|| result.probe.requiredText.some(value => !result.output.includes(value))
|
||||
|| (result.probe.validateOutput && !result.probe.validateOutput(result.output))))
|
||||
if (failed) capabilityCache.delete(cacheKey)
|
||||
@@ -492,6 +493,11 @@ async function probeAgentCapabilities(kind, executable, options = {}) {
|
||||
}
|
||||
}
|
||||
if (result.timedOut) continue
|
||||
if (result.systemError && !failed) {
|
||||
return { compatibilityState: 'unknown', incompatibilityReason: 'LOCAL_AGENT_CAPABILITY_PROBE_FAILED',
|
||||
incompatibilityProbe: probe.id }
|
||||
}
|
||||
if (result.systemError) continue
|
||||
if (result.error) {
|
||||
return {
|
||||
compatibilityState: 'incompatible',
|
||||
|
||||
@@ -164,6 +164,16 @@ test('capability timeouts retry once and remain inconclusive when both attempts
|
||||
}
|
||||
})
|
||||
|
||||
test('capability probes do not treat operating system spawn failures as missing features', async () => {
|
||||
for (const code of ['EACCES', 'ENOENT', 'EAGAIN']) {
|
||||
const result = await probeAgentCapabilities('workbuddy', '/test/unavailable-workbuddy', {
|
||||
env: {}, execFileFn: async () => { throw Object.assign(new Error('spawn failed'), { code }) },
|
||||
})
|
||||
assert.equal(result.compatibilityState, 'unknown', code)
|
||||
assert.equal(result.incompatibilityReason, 'LOCAL_AGENT_CAPABILITY_PROBE_FAILED', code)
|
||||
}
|
||||
})
|
||||
|
||||
function argsForProbe(_command, args) {
|
||||
return args.includes('--mode')
|
||||
? '{"type":"session","version":3,"id":"probe-session"}'
|
||||
|
||||
Reference in new issue
Block a user