fix: Chat logs and errors handle tail tool calls correctly (#22460)

Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
This commit is contained in:
Steven Robertson
2026-03-25 15:17:30 -07:00
committed by GitHub
parent 8595b07f6d
commit 20fd405f9c
9 changed files with 181 additions and 8 deletions
@@ -44,6 +44,8 @@ describe('SchedulerStateManager', () => {
const mockInvocation = {
shouldConfirmExecute: vi.fn(),
execute: vi.fn(),
getDescription: vi.fn(),
} as unknown as AnyToolInvocation;
const createValidatingCall = (
@@ -610,6 +612,19 @@ describe('SchedulerStateManager', () => {
expect(onUpdate).toHaveBeenCalledTimes(1);
});
it('should use originalRequestName when cancelling queued calls', () => {
const call = createValidatingCall('tail-1');
call.request.originalRequestName = 'original-tool';
stateManager.enqueue([call]);
stateManager.cancelAllQueued('Batch cancel');
const completed = stateManager.completedBatch[0] as CancelledToolCall;
expect(completed.response.responseParts[0]?.functionResponse?.name).toBe(
'original-tool',
);
});
it('should not notify if cancelAllQueued is called on an empty queue', () => {
vi.mocked(onUpdate).mockClear();
stateManager.cancelAllQueued('Batch cancel');