Skip to content

fix(llminternal): resume confirmed tool calls in request order#1169

Open
DABH wants to merge 1 commit into
google:mainfrom
DABH:fix-confirmation-resume-order
Open

fix(llminternal): resume confirmed tool calls in request order#1169
DABH wants to merge 1 commit into
google:mainfrom
DABH:fix-confirmation-resume-order

Conversation

@DABH

@DABH DABH commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Problem

RequestConfirmationRequestProcessor re-dispatches a batch of confirmed tool calls by ranging toolsToResumeByFunctionCallID (a map). Go randomizes map iteration order, so when a user resumes two or more tool confirmations in one message, the re-queued function calls execute in a different order run-to-run for identical input. This can be a bug for integrations and use cases that are trying to do deterministic replays of agent pipelines with ADK (e.g., durable execution engines).

generateRequestConfirmationEvent already fixed the identical hazard on the emit side (iterating the ordered Content.Parts instead of ranging RequestedToolConfirmations, mirroring adk-python), but the resume path was missed.

Fix

Record insertion order (resumeOrder) while collecting confirmed calls from the ordered calls slice, and then use that order to re-dispatch calls.

Testing plan

  • Added new test that verifies consistent ordering.

RequestConfirmationRequestProcessor built the re-dispatch parts by ranging
toolsToResumeByFunctionCallID (a map), so resuming two or more confirmations
in one message re-queued the tool calls in a randomized order run-to-run.
Record insertion order while collecting the confirmed calls and emit in that
order, mirroring the ordered iteration generateRequestConfirmationEvent
already uses on the emit side.
@DABH
DABH force-pushed the fix-confirmation-resume-order branch from 7ef3bd1 to 2a0617a Compare July 17, 2026 18:12
@DABH DABH changed the title llminternal: resume confirmed tool calls in request order fix(llminternal): resume confirmed tool calls in request order Jul 17, 2026
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.

1 participant