From 9c50de521e59e48742726c5f6ea72457e4da99a9 Mon Sep 17 00:00:00 2001 From: mesalogo Date: Tue, 25 Aug 2026 21:21:58 +0800 Subject: [PATCH] fix: stabilize Linux release validation Ubuntu validation exposed a missing Unix socket test import, a platform-dependent cancellation-message assertion, and a maximum-frame test that could exceed the default timeout under shared-runner load. The tests now exercise the intended behavior consistently without changing product code. --- src/agent-daemon/private-endpoint.test.ts | 6 ++- src/agent-daemon/workspace-registry.test.ts | 5 ++- .../agent-attach-transport.test.ts | 38 +++++++++++-------- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/agent-daemon/private-endpoint.test.ts b/src/agent-daemon/private-endpoint.test.ts index ae17d12b..114dc939 100644 --- a/src/agent-daemon/private-endpoint.test.ts +++ b/src/agent-daemon/private-endpoint.test.ts @@ -4,7 +4,11 @@ import { rmSync, unlinkSync } from 'node:fs' -import { createConnection, type Socket } from 'node:net' +import { + createConnection, + createServer, + type Socket +} from 'node:net' import { tmpdir } from 'node:os' import { join, resolve } from 'node:path' import { PassThrough } from 'node:stream' diff --git a/src/agent-daemon/workspace-registry.test.ts b/src/agent-daemon/workspace-registry.test.ts index b1147d6c..15aa07d4 100644 --- a/src/agent-daemon/workspace-registry.test.ts +++ b/src/agent-daemon/workspace-registry.test.ts @@ -243,7 +243,10 @@ describe('WorkspaceRegistry', () => { abort.abort(new Error('cancelled')) releaseInspection?.('not-a-repository') - await expect(pending).rejects.toThrow('cancelled') + await expect(pending).rejects.toMatchObject({ + code: 'aborted', + message: 'Workspace operation was aborted' + }) expect(registry.activeHandleCount()).toBe(0) expect(existsSync(storagePath)).toBe(false) }) diff --git a/src/main/remote-agent/agent-attach-transport.test.ts b/src/main/remote-agent/agent-attach-transport.test.ts index dc4a9682..9d6cbab7 100644 --- a/src/main/remote-agent/agent-attach-transport.test.ts +++ b/src/main/remote-agent/agent-attach-transport.test.ts @@ -344,25 +344,31 @@ describe('AgentAttachTransport', () => { expect(transport.closed).toBe(true) }) - it('writes one maximum-sized blob frame in one SSH write', async () => { - const channel = new FakeChannel() - channel.onWrite = () => { - if (channel.writes.length === 1) { - queueMicrotask(() => channel.remote(packet(welcome))) + it( + 'writes one maximum-sized blob frame in one SSH write', + async () => { + const channel = new FakeChannel() + channel.onWrite = () => { + if (channel.writes.length === 1) { + queueMicrotask(() => channel.remote(packet(welcome))) + } } - } - const transport = await connect(channel) - const blob = frame( - { direction: 'main-to-agent', kind: 'blob' }, - Buffer.alloc(AGENT_PROTOCOL_LIMITS.maximumBlobFrameBytes) - ) + const transport = await connect(channel) + const blob = frame( + { direction: 'main-to-agent', kind: 'blob' }, + Buffer.alloc(AGENT_PROTOCOL_LIMITS.maximumBlobFrameBytes) + ) - await transport.send(blob) + await transport.send(blob) - expect(channel.writes).toHaveLength(2) - expect(channel.writes[1]).toEqual(Buffer.from(encodeAgentFrame(blob))) - transport.dispose() - }) + expect(channel.writes).toHaveLength(2) + expect(channel.writes[1]).toEqual( + Buffer.from(encodeAgentFrame(blob)) + ) + transport.dispose() + }, + 15_000 + ) it('rejects an oversized blob before writing to SSH', async () => { const channel = new FakeChannel()