diff --git a/assistant/src/calls/call-controller.ts b/assistant/src/calls/call-controller.ts index fe687c2c3fd..1e1e59bdff9 100644 --- a/assistant/src/calls/call-controller.ts +++ b/assistant/src/calls/call-controller.ts @@ -574,7 +574,9 @@ export class CallController { private isExpectedAbortError(err: unknown): boolean { if (!(err instanceof Error)) return false; - return err.name === 'AbortError' || err.name === 'APIUserAbortError'; + return err.name === 'AbortError' + || err.name === 'APIUserAbortError' + || err.message === 'Session is already processing a message'; } private isCurrentRun(runVersion: number): boolean { diff --git a/assistant/src/calls/voice-session-bridge.ts b/assistant/src/calls/voice-session-bridge.ts index e4967a875f1..31c550c21aa 100644 --- a/assistant/src/calls/voice-session-bridge.ts +++ b/assistant/src/calls/voice-session-bridge.ts @@ -89,6 +89,7 @@ export interface VoiceTurnHandle { function buildVoiceCallControlPrompt(opts: { isInbound: boolean; task?: string | null; + isCallerGuardian?: boolean; }): string { const config = getConfig(); const disclosureEnabled = config.calls?.disclosure?.enabled === true; @@ -134,8 +135,16 @@ function buildVoiceCallControlPrompt(opts: { ); if (opts.isInbound) { + if (opts.isCallerGuardian) { + lines.push( + '10. If the latest user turn is [CALL_OPENING], this is your user calling you. Answer casually and briefly, like picking up a call from someone you know well. For example: "Hey!" or "What\'s up?" Do NOT introduce yourself, do NOT say you are calling on behalf of anyone, and do NOT ask how you can help in a formal way. Keep it short and natural.', + ); + } else { + lines.push( + '10. If the latest user turn is [CALL_OPENING], greet the caller warmly and ask how you can help. Vary the wording; do not use a fixed template.', + ); + } lines.push( - '10. If the latest user turn is [CALL_OPENING], greet the caller warmly and ask how you can help. Vary the wording; do not use a fixed template.', '11. If the latest user turn includes [CALL_OPENING_ACK], treat it as the caller acknowledging your greeting and continue the conversation naturally.', ); } else { @@ -201,9 +210,12 @@ export async function startVoiceTurn(opts: VoiceTurnOptions): Promise setTimeout(resolve, pollIntervalMs)); + waited += pollIntervalMs; + } + if (session.isProcessing()) { + throw new Error('Session is already processing a message'); + } } // Determine the correct strictSideEffects value for this run: