The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tui): clear runtime capabilities on reconnect
unsupportedpastels9172b629b0c1
diff --git a/ui-tui/src/__tests__/gatewayClient.test.ts b/ui-tui/src/__tests__/gatewayClient.test.tsindex dcff496aec4..5ec715f2915 100644--- a/ui-tui/src/__tests__/gatewayClient.test.ts+++ b/ui-tui/src/__tests__/gatewayClient.test.ts@@ -234,11 +234,15 @@ describe('GatewayClient websocket attach mode', () => {delete process.env.HERMES_TUI_SIDECAR_URLconst gw = new GatewayClient(async () => ({ url: 'ws://gateway.test/api/ws', protocols: [], instance_id: 'owner', profile_id: 'fixture' }))- const describe = async (capabilities?: string[]) => {+ const open = async () => {const socket = FakeWebSocket.instances.at(-1)!socket.open()await vi.advanceTimersByTimeAsync(0)+ return socket+ }++ const describe = async (socket: FakeWebSocket, capabilities?: string[]) => {const request = socket.sent.map(text => JSON.parse(text) as { id: number; method: string }).find(frame => frame.method === 'runtime.describe')!@@ -252,13 +256,16 @@ describe('GatewayClient websocket attach mode', () => {try {gw.start(); gw.drain()await vi.advanceTimersByTimeAsync(0)- const first = await describe(['clarify-batch-v1'])+ const first = await describe(await open(), ['clarify-batch-v1'])expect(gw.clarifyBatch).toBe(true)first.close()await vi.advanceTimersByTimeAsync(RECONNECT_MAX_MS)expect(FakeWebSocket.instances.at(-1)).not.toBe(first)- await describe()+ const second = await open()+ // The previous owner's list must not outlive it while the new owner is still describing.+ expect(gw.clarifyBatch).toBe(false)+ await describe(second)expect(gw.clarifyBatch).toBe(false)} finally { gw.kill(); vi.useRealTimers() }})diff --git a/ui-tui/src/gatewayClient.ts b/ui-tui/src/gatewayClient.tsindex 8ed08eaadad..d90e90f89c9 100644--- a/ui-tui/src/gatewayClient.ts+++ b/ui-tui/src/gatewayClient.ts@@ -238,6 +238,7 @@ export class GatewayClient extends EventEmitter {* failure (B2-21): drop the socket onto the backoff path, which redials and re-describes. */private describeThenReady(ws: WebSocket | null, payload: Record<string, unknown>) {this.describeFlight = undefined+ this.runtimeCapabilities = []void this.describeRuntime().then(() => {// The owner's resolved profile skin (`runtime.describe.skin`, main's `gateway.ready.skin`)// unless the listener's own ready already carried one.