test: align e2e clients with enqueue acknowledgements

This commit is contained in:
_Kerman
2026-07-30 18:11:20 +08:00
parent 7ba60845d6
commit a31331cb0e
5 changed files with 29 additions and 21 deletions

View File

@@ -161,14 +161,14 @@ describe.skipIf(!existsSync(cliBin))('dsh-cli-demo BUILT bin', () => {
const json = await runBuiltBin(consumer, ['--config', './cordis.yml', '--output-format', 'json', 'json task'])
expect(JSON.parse(json.stdout)).toMatchObject({
type: 'result', success: true, result: 'BUILT: json task', reason: { kind: 'completed' },
type: 'result', output: 'BUILT: json task',
usage: { inputTokens: 4, outputTokens: 2 },
})
const stream = await runBuiltBin(consumer, ['--config', './cordis.yml', '--output-format', 'stream-json', 'stream task'])
const lines = stream.stdout.trimEnd().split('\n').map(line => JSON.parse(line) as Record<string, unknown>)
expect(lines[0]).toMatchObject({ type: 'session_event', event: { type: 'turn/start' } })
expect(lines.at(-1)).toMatchObject({ type: 'result', success: true, result: 'BUILT: stream task' })
expect(lines.at(-1)).toMatchObject({ type: 'result', output: 'BUILT: stream task' })
const sessionsRoot = join(consumer, '.sessions')
const files = await readdir(sessionsRoot, { recursive: true })
const logs = files.filter(file => file.endsWith('.jsonl.zstd'))
@@ -205,7 +205,7 @@ describe.skipIf(!existsSync(cliBin))('dsh-cli-demo BUILT bin', () => {
)
expect(result, JSON.stringify(result)).toMatchObject({ code, signal: null })
expect(result.stdout).toContain('"kind":"aborted"')
expect(result.stderr).toContain('turn 1 was aborted')
expect(result.stderr).toBe(`dsh-cli-demo: received ${signal}\n`)
}, 30_000)
})
})

View File

@@ -44,10 +44,9 @@ describe('goal domain through a real cordis.yml and headless process', () => {
const result = JSON.parse(stdout) as Record<string, unknown>
expect(result).toMatchObject({
type: 'result',
success: true,
})
expect(result['result']).toBeTypeOf('string')
expect(result['result']).toContain('CLI tool round trip complete')
expect(result['output']).toBeTypeOf('string')
expect(result['output']).toContain('CLI tool round trip complete')
expect(events.filter(event => event.type === 'turn/end')).toHaveLength(1)
const contexts = events.filter(event => event.type === 'user/message'

View File

@@ -85,6 +85,7 @@ describe.skipIf(process.platform === 'win32')('semantic checkpoint hard-crash re
expect(crashed.markerText).toBe('request-dispatched')
const events = await load(crashed.root)
expect(events.map(event => event.type)).toEqual([
'agent/inbox/spliced', 'agent/inbox/spliced',
'turn/start', 'user/message', 'step/start', 'request/header', 'step/end', 'turn/end',
])
expect(events.at(-1)).toMatchObject({