The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): registry-missing server request answers -32601
kshitijk4poor4c214157d8a2
diff --git a/apps/desktop/src/store/gateway.test.ts b/apps/desktop/src/store/gateway.test.tsindex ae30501d001..293488781bb 100644--- a/apps/desktop/src/store/gateway.test.ts+++ b/apps/desktop/src/store/gateway.test.ts@@ -49,6 +49,7 @@ const {activeGateway,closeSecondaryGateways,configureGatewayRegistry,+ dispatchPrimaryServerRequest,ensureGatewayForProfile,openGatewayForAgent,pruneSecondaryGateways,@@ -356,3 +357,24 @@ describe('secondary connection timeout (#93454)', () => {expect(activeGateway()).toBe(gatewayMocks.instances[0])})})++describe('server→client request routing without a registry handler (#112791)', () => {+ it('answers -32601 when the registry has no onServerRequest, and forwards with the profile when it does', () => {+ const request = { fail: vi.fn(), id: 'srq-1', method: 'clarify', params: { session_id: 's1' }, respond: vi.fn() }++ // beforeEach configured a registry with onEvent only: nobody can answer,+ // so the backend must hear -32601 now instead of waiting out its deadline.+ dispatchPrimaryServerRequest(request as never, 'default')+ expect(request.fail).toHaveBeenCalledTimes(1)+ expect(request.fail).toHaveBeenCalledWith(-32601, expect.stringMatching(/registry/))++ const onServerRequest = vi.fn()++ configureGatewayRegistry({ onEvent: vi.fn(), onServerRequest } as never)+ request.fail.mockClear()+ dispatchPrimaryServerRequest(request as never, 'work')+ expect(request.fail).not.toHaveBeenCalled()+ expect(onServerRequest).toHaveBeenCalledTimes(1)+ expect(onServerRequest).toHaveBeenCalledWith(expect.objectContaining({ id: 'srq-1', method: 'clarify', profile: 'work' }))+ })+})