From b533a989b4ce2dacf3a4eba2f7f79c0602c02333 Mon Sep 17 00:00:00 2001 From: Daniel Smolsky Date: Sun, 7 Dec 2025 02:55:46 -0500 Subject: [PATCH] Fix Gemini tool name resolution and session restore --- lib/fetch-wrapper/formats/gemini.ts | 3 ++- lib/fetch-wrapper/handler.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/fetch-wrapper/formats/gemini.ts b/lib/fetch-wrapper/formats/gemini.ts index c1c0feb7..65102902 100644 --- a/lib/fetch-wrapper/formats/gemini.ts +++ b/lib/fetch-wrapper/formats/gemini.ts @@ -87,9 +87,10 @@ export const geminiFormat: FormatDescriptor = { const toolCallId = positionMapping.get(positionKey) if (toolCallId) { + const metadata = state.toolParameters.get(toolCallId.toLowerCase()) outputs.push({ id: toolCallId.toLowerCase(), - toolName: funcName + toolName: metadata?.tool }) } } diff --git a/lib/fetch-wrapper/handler.ts b/lib/fetch-wrapper/handler.ts index ce7a4765..db188838 100644 --- a/lib/fetch-wrapper/handler.ts +++ b/lib/fetch-wrapper/handler.ts @@ -71,6 +71,7 @@ export async function handleFormat( const sessionId = ctx.state.lastSeenSessionId const protectedSet = new Set(ctx.config.protectedTools) if (sessionId) { + await ensureSessionRestored(ctx.state, sessionId, ctx.logger) await syncToolCache(ctx.client, sessionId, ctx.state, ctx.toolTracker, protectedSet, ctx.logger) }