Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(human): cover lipsync and chat runtime streaming paths

Steven Enamakel6a8dfb33370c
diff --git a/app/src/features/human/useHumanMascot.lipsync.test.ts b/app/src/features/human/useHumanMascot.lipsync.test.ts
index 9f3cdfbef0..72d2ca9c8a 100644
--- a/app/src/features/human/useHumanMascot.lipsync.test.ts
+++ b/app/src/features/human/useHumanMascot.lipsync.test.ts
@@ -186,7 +186,6 @@ function fakeDone(text: string) {
thread_id: 't',
request_id: 'r',
full_response: text,
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
};
diff --git a/app/src/features/human/useHumanMascot.test.ts b/app/src/features/human/useHumanMascot.test.ts
index 0d4346b969..55c2e3328f 100644
--- a/app/src/features/human/useHumanMascot.test.ts
+++ b/app/src/features/human/useHumanMascot.test.ts
@@ -369,7 +369,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'sure thing',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -388,7 +387,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'Sorry, that failed because the provider is unavailable.',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -427,7 +425,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'hi',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -466,7 +463,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'Here is the result.',
- rounds_used: 2,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -486,7 +482,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'Here is the result.',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -511,7 +506,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'Research complete.',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -555,7 +549,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'Sorry, the researcher failed.',
- rounds_used: 2,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -575,7 +568,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'Done.',
- rounds_used: 2,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -591,7 +583,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'Here you go.',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -623,7 +614,6 @@ describe('useHumanMascot state machine', () => {
capturedListeners?.onDone?.(
fakeEvent({
full_response: 'Here you go.',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
})
@@ -664,7 +654,6 @@ describe('useHumanMascot TTS playback', () => {
thread_id: 't',
request_id: 'r',
full_response: text,
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
};
@@ -1071,7 +1060,6 @@ describe('useHumanMascot streaming TTS (#5358)', () => {
thread_id: 't',
request_id: 'r',
full_response: text,
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
};
diff --git a/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx b/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx
index 35c2044347..fd631a97e1 100644
--- a/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx
+++ b/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx
@@ -136,7 +136,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 'unmounted-snapshot',
request_id: 'unmounted-request',
full_response: 'Delivered reply',
- rounds_used: 1,
total_input_tokens: 0,
total_output_tokens: 0,
});
@@ -460,7 +459,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-par',
request_id: 'branch',
full_response: 'branch done',
- rounds_used: 1,
total_input_tokens: 0,
total_output_tokens: 0,
segment_total: 0,
@@ -588,7 +586,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-done',
request_id: 'r-done',
full_response: 'hello',
- rounds_used: 1,
total_input_tokens: 5,
total_output_tokens: 7,
segment_total: 1,
@@ -618,7 +615,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
request_id: 'bgdeliver-1',
client_id: 'system',
full_response: 'Same two issues as before',
- rounds_used: 1,
});
});
@@ -740,7 +736,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-user',
request_id: 'r-user',
full_response: 'hi',
- rounds_used: 1,
});
});
@@ -768,7 +763,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-gone',
request_id: 'r-gone',
full_response: 'an answer nobody stored',
- rounds_used: 1,
});
});
@@ -790,7 +784,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
request_id: 'r-seg',
full_response: 'one two',
segment_total: 2,
- rounds_used: 1,
});
});
@@ -824,7 +817,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-lost',
request_id: 'r-lost',
full_response: 'the answer the core stored',
- rounds_used: 1,
});
});
@@ -876,7 +868,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-plan',
request_id: 'r-plan',
full_response: 'done',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
segment_total: 1,
@@ -925,7 +916,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-upload',
request_id: 'r-upload',
full_response: 'done',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
});
@@ -966,7 +956,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-fup',
request_id: 'r-fup',
full_response: 'assistant reply',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
});
@@ -991,7 +980,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-rid',
request_id: 'req-abc',
full_response: 'the answer',
- rounds_used: 1,
total_input_tokens: 1,
total_output_tokens: 1,
});
@@ -1546,7 +1534,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-segmented',
request_id: 'r-segmented',
full_response: 'Part one.\n\nPart two.',
- rounds_used: 1,
total_input_tokens: 10,
total_output_tokens: 20,
segment_total: 2,
@@ -1589,7 +1576,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-complete',
request_id: 'r-complete',
full_response: 'Part one.\n\nPart two.',
- rounds_used: 1,
total_input_tokens: 10,
total_output_tokens: 20,
segment_total: 2,
@@ -1635,7 +1621,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
// segments.join('') === 'Hello.World.' !== full_response, but
// delivery is still complete.
full_response: '\nHello.\n\nWorld.\n',
- rounds_used: 1,
total_input_tokens: 10,
total_output_tokens: 20,
segment_total: 2,
@@ -1667,7 +1652,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-missing',
request_id: 'r-missing',
full_response: 'Part one.\n\nPart two.',
- rounds_used: 1,
total_input_tokens: 10,
total_output_tokens: 20,
segment_total: 2,
@@ -1706,7 +1690,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-stale',
request_id: 'r-stale',
full_response: 'Stale segment.',
- rounds_used: 1,
total_input_tokens: 10,
total_output_tokens: 20,
segment_total: 1,
@@ -1865,7 +1848,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-inv',
request_id: 'r1',
full_response: '',
- rounds_used: 1,
total_input_tokens: 0,
total_output_tokens: 0,
});
@@ -1901,7 +1883,6 @@ describe('ChatRuntimeProvider — dedupe, proactive resolution, mid-turn invaria
thread_id: 't-inv',
request_id: 'r1',
full_response: '',
- rounds_used: 1,
total_input_tokens: 0,
total_output_tokens: 0,
});
@@ -2947,7 +2928,6 @@ describe('ChatRuntimeProvider — skill tool-chain latency (#4273 AC3)', () => {
thread_id: thread,
request_id: 'r1',
full_response: '',
- rounds_used: 1,
total_input_tokens: 0,
total_output_tokens: 0,
}) as chatService.ChatDoneEvent;
@@ -3089,7 +3069,6 @@ describe('ChatRuntimeProvider — detached sub-agent approvals', () => {
thread_id: threadId,
request_id: 'parent-turn',
full_response: 'I asked the image agent to make it.',
- rounds_used: 1,
total_input_tokens: 0,
total_output_tokens: 0,
segment_total: 0,
diff --git a/app/src/services/chatService.ts b/app/src/services/chatService.ts
index 2e9e2ed053..86930801bf 100644
--- a/app/src/services/chatService.ts
+++ b/app/src/services/chatService.ts
@@ -46,7 +46,9 @@ import type {
ProactiveMessageEvent,
QueueItemEvent,
QueueItemPayload,
+ WireEvent,
} from './chatWire';
+import { decodeApprovalDecided, decodeRunModeChanged, externalTransferProvider } from './chatWire';
import { callCoreRpc } from './coreRpcClient';
import { socketService } from './socketService';
diff --git a/app/src/test/fixtures/streamedTurn.ts b/app/src/test/fixtures/streamedTurn.ts
index 1dd318f2ad..c5b2743335 100644
--- a/app/src/test/fixtures/streamedTurn.ts
+++ b/app/src/test/fixtures/streamedTurn.ts
@@ -150,7 +150,6 @@ export const LIVE_TURN_STEPS: SocketStep[] = [
export const DONE_EVENT = {
...base,
full_response: FINAL_ANSWER,
- rounds_used: 3,
total_input_tokens: 10,
total_output_tokens: 10,
};