Fall back to the SDK session list when an older gateway rejects scope with 4000 (0.2.2)

The Docker gateway answers session.list with code 4000 and
"scope: Extra inputs are not permitted" (no data.reason), which the
fallback check did not recognise, so every bot showed a load error in
the Mac app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mikei386andClaude Opus 5.5 committed 2026-11-20 19:38:59 +01:00
1 parent 551913254c
commit ef185c0903
4 files changed
+22 -5

No files matched your search

+9
View File
@@ -188,3 +188,12 @@ test('error detail names the technical cause compactly', () => {
assert.equal(errorDetail({name:'AbortError',message:'x'}),'')
assert.equal(errorDetail(Error('x'.repeat(300))).length,178)
})
test('an older gateway rejecting the scope argument with 4000 falls back to the SDK list', async () => {
const scopeRejected={code:4000,message:'invalid params for session.list: scope: Extra inputs are not permitted — the client and the Hermes backend are out of sync (different versions); run `hermes update` and restart'}
assert.equal(unsupportedList(scopeRejected),true)
assert.equal(unsupportedList({code:4000,message:'permission denied'}),false)
assert.equal(unsupportedList({code:4000,message:'invalid params',data:{reason:'profile_mismatch'}}),false)
const res=await loadBot({requestProfile:async()=>{throw scopeRejected},
listPersistedSessions:async()=>({sessions:[{id:'kept',source:'gui',profile:'work'}],total:1,limit:500,offset:0,errors:[]})},route)
assert.deepEqual(res.sessions.map(s=>s.id),['kept'])
})