Fix Gemma 4 tool handoff and native call parsing #558

Merged
toasterson merged 1 commit from fix/electra-gemma-handoff into main 2026-10-06 13:02:06 +00:00
Owner

Gemma 4 emits <|tool_response> to yield to a tool, but Candle currently continues generation beyond it. A recorded GPU qualification selected read_file correctly, then fabricated a file result before the runtime rejected its markup.

Stop generation at that handoff token and recognize Gemma native call envelopes and typed argument syntax. Validate the complete response before dispatch, preserve argument text, reject malformed calls, duplicate keys, excessive nesting and generated tool observations, and keep calls inside reasoning non-executable. Generic JSON and Qwen XML paths remain supported.

Added regression tests for the observed read_file output, native and JSON arguments, malformed second calls, invented observations, reasoning-only calls and argument strings containing reasoning markup. Targeted Vulkan-feature library tests are running on Hephaistos; no feature-branch daemon has been deployed.

Gemma 4 emits `<|tool_response>` to yield to a tool, but Candle currently continues generation beyond it. A recorded GPU qualification selected read_file correctly, then fabricated a file result before the runtime rejected its markup. Stop generation at that handoff token and recognize Gemma native call envelopes and typed argument syntax. Validate the complete response before dispatch, preserve argument text, reject malformed calls, duplicate keys, excessive nesting and generated tool observations, and keep calls inside reasoning non-executable. Generic JSON and Qwen XML paths remain supported. Added regression tests for the observed read_file output, native and JSON arguments, malformed second calls, invented observations, reasoning-only calls and argument strings containing reasoning markup. Targeted Vulkan-feature library tests are running on Hephaistos; no feature-branch daemon has been deployed.
Stop Gemma at tool handoff and parse native tool calls strictly
All checks were successful
CI / check-akh-medu (pull_request) Successful in 7m46s
CI / docker-seshd (pull_request) Successful in 6m45s
CI / test-sokar (pull_request) Successful in 15m31s
CI / docker-akh-transcripts (pull_request) Successful in 13m16s
CI / check-seshat (pull_request) Successful in 22m21s
CI / publish-chart (pull_request) Successful in 16m35s
CI / docker-sokard (pull_request) Successful in 33m41s
CI / test-akh-medu (pull_request) Successful in 46m12s
CI / test-session-platform (pull_request) Successful in 53m23s
CI / platform-images-core (pull_request) Successful in 27m25s
CI / platform-images-daemons (pull_request) Successful in 31m27s
CI / platform-images-home (pull_request) Successful in 44m20s
CI / platform-images-fleet (pull_request) Successful in 17m32s
CI / platform-images-collect (pull_request) Successful in 2h50m21s
0fd81afeb0
Author
Owner

Hephaistos validation on exact head 0fd81afeb019adf66a633de7c6f026dacd304c41: cargo test --locked --release -p akh-session-services --features vulkan --lib internal::native passed 22 tests, 0 failures, 1 existing ignored test. This includes both native Gemma argument encodings, rejection of generated observations and malformed subsequent calls, and non-execution of calls inside reasoning. Broader Candle backend tests are running separately. Shared PR CI has started. No feature-branch daemon was deployed; the currently served qualification artifacts still come from clean main fcb8c6f7.

Hephaistos validation on exact head `0fd81afeb019adf66a633de7c6f026dacd304c41`: `cargo test --locked --release -p akh-session-services --features vulkan --lib internal::native` passed 22 tests, 0 failures, 1 existing ignored test. This includes both native Gemma argument encodings, rejection of generated observations and malformed subsequent calls, and non-execution of calls inside reasoning. Broader Candle backend tests are running separately. Shared PR CI has started. No feature-branch daemon was deployed; the currently served qualification artifacts still come from clean main `fcb8c6f7`.
Sign in to join this conversation.
No reviewers
No labels
follow-up
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
toasterson/akh-medu!558
No description provided.