fix(a2a-server): resolve tool approval race condition and improve status reporting#26479
fix(a2a-server): resolve tool approval race condition and improve status reporting#26479
Conversation
…eporting - Enhanced Tool Call Tracking: Added pendingOutcomes to track tool call outcomes alongside statuses, ensuring more reliable change detection. - Improved Waiting Logic: Refined _isWaitingForToolExecutionOrApproval to better handle 'validating' states and tools already confirmed by the agent. - Client-Side Consistency: Mapped the internal 'validating' tool call status to 'scheduled' when serializing for clients, ensuring external state reporting is consistent. - Test Updates: Adjusted E2E tests to align with the new 'scheduled' status reporting.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the reliability of the A2A server's task management by addressing a race condition that caused premature state transitions. It introduces more robust state tracking for tool calls, enhances event handling security, and standardizes status reporting for external clients. These changes ensure a more predictable and consistent task execution flow. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses race conditions in tool call scheduling by implementing scheduler ID validation for event-driven updates and refining task state transitions. Key changes include tracking tool call outcomes, mapping the internal 'validating' status to 'scheduled' for client communication, and updating tests to reflect these logic changes. The reviewer recommends enhancing type safety and consistency by replacing hardcoded string literals with the ToolConfirmationOutcome and CoreToolCallStatus enums.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Size Change: -4 B (0%) Total Size: 34 MB
ℹ️ View Unchanged
|
|
/patch |
|
🚀 [Step 1/4] Patch workflow(s) waiting for approval! 📋 Details:
⏳ Status: The patch creation workflow has been triggered and is waiting for deployment approval. Please visit the specific workflow links below and approve the runs. 🔗 Track Progress: |
|
🚀 [Step 2/4] Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |
|
🚀 [Step 2/4] Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |
|
🚀 [Step 3/4] Patch Release Waiting for Approval! 📋 Release Details:
⏳ Status: The patch release has been triggered and is waiting for deployment approval. Please visit the specific workflow run link below and approve the deployment. You'll receive another update when it completes. 🔗 Track Progress: |
|
✅ [Step 4/4] Patch Release Complete! 📦 Release Details:
🎉 Status: Your patch has been successfully released and published to npm! 📝 What's Available:
🔗 Links: |
…tus reporting (google-gemini#26479) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
This PR addresses a race condition in the A2A server's task management where tasks could prematurely transition to an
input-requiredstate while tool calls were still being validated or processed.Details
Key Changes:
checkInputRequiredStatelogic in theTaskclass to accurately account for tools invalidatingandscheduledstates, as well as tools already confirmed by the policy engine.schedulerIdvalidation for event-driven tool call updates, ensuring that tasks only process events intended for them.validatingstatus toscheduledfor client-facing status updates to provide a more consistent and understandable experience for external clients.Taskclass now tracks tool call outcomes (e.g.,accepted,rejected) and uses this data to more accurately detect and report meaningful state changes.How to Validate
To validate end to end use
yarn linkin packages/src/a2a-server and then useyarn link "@google/gemini-cli-a2a-server"in the consumer. Then run a prompt that requires multiple tool calls in a single step. For example "Describe the purpose of each python file in this project" in a project with multiple python files.Pre-Merge Checklist