fix(ci): stabilize flaky terminal and SFTP tests

This commit is contained in:
Brennan Benson
2026-07-27 17:31:14 -07:00
parent 0edc95fa35
commit 0720b6db12
2 changed files with 8 additions and 5 deletions
@@ -278,14 +278,16 @@ describe('incremental terminal history restore', () => {
const firstReplay = reader.detectColdRestore(SESSION_ID)
const secondReplay = reader.detectColdRestore(secondSessionId)
try {
// Drain by yield because awaiting the session that loses the replay-slot race deadlocks.
await vi.waitFor(() => expect(pendingYields).toHaveLength(1))
pendingYields.shift()!()
expect((await firstReplay)?.scrollbackAnsi).toContain('😀second')
await vi.waitFor(() => expect(pendingYields).toHaveLength(1))
pendingYields.shift()!()
expect((await secondReplay)?.scrollbackAnsi).toContain('😀second')
for (const restore of await Promise.all([firstReplay, secondReplay])) {
expect(restore?.scrollbackAnsi).toContain('😀second')
}
expect(pendingYields).toHaveLength(0)
} finally {
for (const resume of pendingYields.splice(0)) {
@@ -160,7 +160,8 @@ function installSftpHandlers(sftp: SFTPWrapper, backingRoot: string, operations:
async function startSftpWireServer(backingRoot: string): Promise<SftpWireServer> {
const operations: string[] = []
const connections = new Set<Connection>()
const hostKey = utils.generateKeyPairSync('ed25519').private
// Ed25519 keygen can produce an invalid 31-byte key; ECDSA points always start with 0x04.
const hostKey = utils.generateKeyPairSync('ecdsa', { bits: 256 }).private
const server = new Ssh2Server({ hostKeys: [hostKey] }, (connection) => {
connections.add(connection)
connection.on('error', () => {})