Skip to content

fix(creation-helper): stabilize Gemini tool turns#55

Open
rppavan wants to merge 1 commit into
LettuceAI:mainfrom
rppavan:main
Open

fix(creation-helper): stabilize Gemini tool turns#55
rppavan wants to merge 1 commit into
LettuceAI:mainfrom
rppavan:main

Conversation

@rppavan
Copy link
Copy Markdown

@rppavan rppavan commented May 25, 2026

Preserve raw Gemini function-call parts so thought signatures survive tool-response turns.

Map raw Gemini function calls back to tool result names, guard against repeated successful tool calls in the Smart Creator loop, and treat tool-only assistant turns as valid UI output instead of showing a false failure banner.

Verified with npm run build, cargo test preserves_raw_function_call_parts_with_thought_signatures --lib --release, codesign verification, hdiutil verify, and mounted-DMG app signature verification.

Preserve raw Gemini function-call parts so thought signatures survive tool-response turns.

Map raw Gemini function calls back to tool result names, guard against repeated successful tool calls in the Smart Creator loop, and treat tool-only assistant turns as valid UI output instead of showing a false failure banner.

Verified with npm run build, cargo test preserves_raw_function_call_parts_with_thought_signatures --lib --release, codesign verification, hdiutil verify, and mounted-DMG app signature verification.
@MegalithOfficial
Copy link
Copy Markdown
Contributor

MegalithOfficial commented May 25, 2026

I think the gemini_content replay fix is directionally correct, but I see a regression in the new duplicate-tool suppression.

In src-tauri/src/creation_helper/agent/run.rs, the completed_tool_signatures guard stops the turn on a repeated successful (name, args) signature before we append any CreationToolResult for the current tool call. That means if Gemini re-emits the same function call on the next iteration, we now continue past dispatch, set terminal_hit = true, and then break the loop without ever answering the model’s tool call with a tool result. That breaks the tool-calling handshake in the exact retry case this PR is trying to stabilize.

I also think the dedupe is too broad for the fix scope. The replay issue is Gemini-specific, but this changes behavior for every provider and for all tools. Some creation-helper tools are intentionally idempotent or flow-oriented (show_preview, request_confirmation, set_*), so repeating the same call in one turn should be harmless; turning that into an early stop looks like a behavioral regression.

I'd keep the raw gemini_content preservation, but either remove the duplicate-call suppression or narrow it to a safer Gemini-specific path that still returns a valid tool result for repeated calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants