Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions assistant/src/calls/call-controller.ts
Comment thread
noanflaherty marked this conversation as resolved.
Comment thread
noanflaherty marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@ export class CallController {
const runVersion = ++this.llmRunVersion;
const runSignal = this.abortController.signal;

// Clear silence timer while actively processing. The caller said
// something (or a turn was triggered), so silence detection should
// pause until we finish responding and return to idle.
if (this.silenceTimer) {
clearTimeout(this.silenceTimer);
this.silenceTimer = null;
}
Comment thread
noanflaherty marked this conversation as resolved.

try {
this.state = 'speaking';

Expand Down Expand Up @@ -536,10 +544,11 @@ export class CallController {
return;
}

// Normal turn complete — flush any instructions that arrived while
// the LLM was active.
// Normal turn complete — restart silence detection and flush any
// instructions that arrived while the LLM was active.
this.state = 'idle';
this.currentTurnHandle = null;
this.resetSilenceTimer();
this.flushPendingInstructions();
} catch (err: unknown) {
this.currentTurnHandle = null;
Expand All @@ -555,6 +564,7 @@ export class CallController {
);
if (this.isCurrentRun(runVersion)) {
this.state = 'idle';
this.resetSilenceTimer();
}
return;
}
Expand All @@ -568,6 +578,7 @@ export class CallController {
log.error({ err, callSessionId: this.callSessionId }, 'Voice turn error');
this.relay.sendTextToken('I\'m sorry, I encountered a technical issue. Could you repeat that?', true);
this.state = 'idle';
this.resetSilenceTimer();
this.flushPendingInstructions();
}
}
Expand Down