* Fire-and-forget wrapper around `presentAssistantMessage` that swallows the * expected cancellation rejection (the presenter throws when `this.abort` is set) * and logs any other failure. Keeping it non-blocking preserves the streaming * presenter's self-locking semantics while preventing unh
()
| 364 | * from crashing the extension host. |
| 365 | */ |
| 366 | private presentAssistantMessageSafe(): void { |
| 367 | void presentAssistantMessage(this).catch((error) => { |
| 368 | // Discriminate on the error message rather than `this.abort` state, |
| 369 | // which can flip between the throw and the catch microtask running: |
| 370 | // a real failure followed by an abort flip would otherwise be |
| 371 | // silently swallowed, and a stale abort error logged as a failure. |
| 372 | // The abort throw site in presentAssistantMessage emits a message |
| 373 | // ending in "aborted" (matching the other abort-throw contracts in |
| 374 | // this file), so we suppress exactly that. |
| 375 | if (error instanceof Error && error.message.endsWith("aborted")) { |
| 376 | return |
| 377 | } |
| 378 | console.error(`[Task#presentAssistantMessage] task ${this.taskId}.${this.instanceId} failed:`, error) |
| 379 | }) |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Push a tool_result block to userMessageContent, preventing duplicates. |
no test coverage detected