refactor: move retry and recovery paths to structured output helpers
This commit is contained in:
@@ -44,6 +44,19 @@ describe('shouldResetSessionOnAgentFailure', () => {
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('matches structured public output text too', () => {
|
||||
expect(
|
||||
shouldResetSessionOnAgentFailure({
|
||||
result: null,
|
||||
output: {
|
||||
visibility: 'public',
|
||||
text: 'API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.11.content.0: Invalid `signature` in `thinking` block"}}',
|
||||
},
|
||||
error: undefined,
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('shouldRetryFreshSessionOnAgentFailure', () => {
|
||||
@@ -75,4 +88,14 @@ describe('shouldRetryFreshSessionOnAgentFailure', () => {
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('does not treat structured silent output as a retryable session failure', () => {
|
||||
expect(
|
||||
shouldRetryFreshSessionOnAgentFailure({
|
||||
result: null,
|
||||
output: { visibility: 'silent' },
|
||||
error: undefined,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user