mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
fix(session): add semantic crash checkpoints
This commit is contained in:
@@ -440,6 +440,10 @@ export function apply(ctx: Context, config: Config = {}): void {
|
||||
})
|
||||
return [{ type: 'text', text: `started background task ${id}` }]
|
||||
}
|
||||
// A durability or policy wrapper may yield before dispatch. Normalize a
|
||||
// cancellation that arrived during that boundary before the executor can
|
||||
// expose its backend-specific pre-spawn error.
|
||||
if (exec.signal?.aborted) throw new Error('command aborted')
|
||||
const result = await ctx.bash.run(ctx.bash.resolve({
|
||||
...request,
|
||||
...exec.signal ? { signal: exec.signal } : {},
|
||||
|
||||
@@ -286,6 +286,20 @@ describe('bash tool', () => {
|
||||
expect(text(result)).toMatch(/aborted/)
|
||||
})
|
||||
|
||||
it('normalizes foreground cancellation that arrives before spawn', async () => {
|
||||
const ctx = await setup()
|
||||
const controller = new AbortController()
|
||||
controller.abort('session/cancel')
|
||||
const result = await ctx.tools.execute({
|
||||
callId: CallId('call-pre-spawn-abort'),
|
||||
name: 'bash',
|
||||
arguments: { command: 'printf should-not-run', description: 'test command' },
|
||||
signal: controller.signal,
|
||||
})
|
||||
expect(result.isError).toBe(true)
|
||||
expect(text(result)).toBe('Error: command aborted')
|
||||
})
|
||||
|
||||
// Type and required-key violations are rejected by the harness
|
||||
// (defineTool validates against the SchemaSpec — the arg-validation Agent Note) before execute.
|
||||
it.each([
|
||||
|
||||
Reference in New Issue
Block a user