From 8c30c57dff80745da1868432e88d4d0ad1feeae1 Mon Sep 17 00:00:00 2001 From: Amolith Date: Wed, 3 Jun 2026 22:08:06 -0600 Subject: [PATCH] Fix tool call guard lint Use optional chaining in tool call guards to satisfy the updated Biome rule while preserving the existing failure path for missing tool calls. --- packages/answer/src/extract.ts | 2 +- packages/handoff/src/handoff-extraction.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/answer/src/extract.ts b/packages/answer/src/extract.ts index ec24e0ed3e44f84db8a96541f60ec0726e4a7826..36fb45ca3ede9f527b0d876d24b113a89c917f44 100644 --- a/packages/answer/src/extract.ts +++ b/packages/answer/src/extract.ts @@ -27,7 +27,7 @@ export function resolveExtractionModel(ctx: ExtensionContext, fallback: NonNulla export function parseToolCallResult(response: Awaited>): ExtractionResult | null { const toolCall = response.content.find((c) => c.type === "toolCall" && c.name === "extract_questions"); - if (!toolCall || toolCall.type !== "toolCall") { + if (toolCall?.type !== "toolCall") { console.error("Model did not call extract_questions:", response.content); return null; } diff --git a/packages/handoff/src/handoff-extraction.ts b/packages/handoff/src/handoff-extraction.ts index 1a45d7d77a801d82bf21f84e4c3aaf5ba729a779..24659ae75921008771e0a9755af66d4c6b51dcee 100644 --- a/packages/handoff/src/handoff-extraction.ts +++ b/packages/handoff/src/handoff-extraction.ts @@ -105,7 +105,7 @@ export async function extractHandoffContext( const toolCall = response.content.find((c) => c.type === "toolCall" && c.name === "extract_handoff_context"); - if (!toolCall || toolCall.type !== "toolCall") { + if (toolCall?.type !== "toolCall") { console.error("Model did not call extract_handoff_context:", response.content); return null; }