Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion agents/src/llm/fallback_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class FallbackLLMStream extends LLMStream {
}

// Handle timeout errors
if (error instanceof Error && error.name === 'AbortError') {
if ((error as { name?: string })?.name === 'AbortError') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Incomplete transformation — several locations still use the old pattern

The PR changes 8 locations but leaves several others untouched that have the same instanceof Error && ... === 'AbortError' pattern:

  • agents/src/inference/tts.ts:883 and :895
  • agents/src/stream/deferred_stream.ts:34
  • plugins/elevenlabs/src/tts.ts:920
  • plugins/inworld/src/tts.ts:455

These remaining locations could hit the same DOMException-not-instanceof-Error issue. The deferred_stream.ts:34 case has a valid reason to keep instanceof Error since it accesses e.message afterward, but the others (inference/tts.ts, elevenlabs/tts.ts:920, inworld/tts.ts) appear to just return/ignore the error and would benefit from the same fix.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

if (checkRecovery) {
this._log.warn({ llm: llm.label() }, 'recovery timed out');
} else {
Expand Down
2 changes: 1 addition & 1 deletion agents/src/voice/agent_activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ export class AgentActivity implements RecognitionHooks {
const onAbort = () => waitInactiveTask.cancel();
signal.addEventListener('abort', onAbort, { once: true });
const waitInactiveResult = waitInactiveTask.result.catch((error) => {
if (error instanceof Error && error.name === 'AbortError') {
if ((error as { name?: string })?.name === 'AbortError') {
return;
}
throw error;
Expand Down
8 changes: 4 additions & 4 deletions agents/src/voice/audio_recognition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1729,8 +1729,8 @@ export class AudioRecognition {
this.logger.debug('EOU detection task completed');
})
.catch((err: unknown) => {
if (err instanceof Error && err.name === 'AbortError') {
// ignore aborted errors
if ((err as { name?: string })?.name === 'AbortError') {
// ignore aborted errors (DOMException from AbortSignal is not instanceof Error)
return;
}
this.logger.error(err, 'Error in EOU detection task:');
Expand All @@ -1745,7 +1745,7 @@ export class AudioRecognition {
try {
await this.bounceEOUTask.result;
} catch (error) {
if (error instanceof Error && error.name === 'AbortError') {
if ((error as { name?: string })?.name === 'AbortError') {
return;
}
throw error;
Expand Down Expand Up @@ -2264,7 +2264,7 @@ export class AudioRecognition {
this.logger.debug('User turn committed');
})
.catch((err: unknown) => {
if (err instanceof Error && err.name === 'AbortError') {
if ((err as { name?: string })?.name === 'AbortError') {
this.logger.debug('User turn commit task cancelled');
return;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/elevenlabs/src/stt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export class STT extends stt.STT {
if (error instanceof APIStatusError) {
throw new APIConnectionError({ message: error.message });
}
if (error instanceof Error && error.name === 'AbortError') {
if ((error as { name?: string })?.name === 'AbortError') {
throw new APITimeoutError({});
}
throw new APIConnectionError({});
Expand Down
2 changes: 1 addition & 1 deletion plugins/google/src/beta/gemini_tts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class ChunkedStream extends tts.ChunkedStream {

sendLastFrame(true);
} catch (error: unknown) {
if (error instanceof Error && error.name === 'AbortError') {
if ((error as { name?: string })?.name === 'AbortError') {
return;
}
if (isAPIError(error)) throw error;
Expand Down
2 changes: 1 addition & 1 deletion plugins/openai/src/tts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class ChunkedStream extends tts.ChunkedStream {

this.queue.close();
} catch (error) {
if (error instanceof Error && error.name === 'AbortError') {
if ((error as { name?: string })?.name === 'AbortError') {
return;
}
throw error;
Expand Down