feat(agent): formalize first-class tool lifecycle states and status mapping#26529
feat(agent): formalize first-class tool lifecycle states and status mapping#26529mbleigh wants to merge 31 commits into
Conversation
…tadata overwrite This addresses PR feedback by: - Creating a `renderDisplayDiff` utility to render `DisplayDiff` objects. - Creating a `displayContentToString` utility to safely extract text from any `DisplayContent`. - Updating non-interactive CLI to use `displayContentToString` to avoid data loss on non-text output. - Updating `useAgentStream` to use `displayContentToString` to avoid stale UI state for non-text output. - Shallow merging the `display` object in `useAgentStream` rather than replacing it, preventing loss of display metadata.
This change completes the transition of the interactive agent session (`useAgentStream`) to a declarative-first tool rendering system. Key changes: - Reverted experimental `ToolDisplay` logic from legacy UI components (`DenseToolMessage`, etc.) to establish a clean baseline. - Introduced `HistoryItemToolDisplayGroup` and `ToolGroupDisplay` component in CLI. - Added `display` property to `ToolCallRequestInfo` to carry declarative UI info natively. - Populated tool request display information at the source (`Turn.ts` and `Scheduler.ts`) using dynamic descriptions from tool invocations. - Updated `useAgentStream` to emit the new history item type, providing a standalone rendering path for interactive sessions. - Ensured tool descriptions are updated when arguments are modified during confirmation.
Key enhancements: - Updated `UpdateTopicTool` to provide declarative 'notice' display info, using dynamic descriptions for high-fidelity output. - Refined `ToolGroupDisplay` to 'hoist' notice-format tools to the top of the group. - Implemented conditional boxing in `ToolGroupDisplay`: borders are now suppressed in compact mode, matching the standard CLI view. - Added support for `resultSummary` rendering at the bottom of text results in boxed mode. - Improved `useAgentStream` to wait for turn completion before pushing tools to history, ensuring all notices for a turn are correctly grouped and hoisted together. - Fixed margin and border logic to handle seamless transitions between notices and tool boxes.
…fix populateToolDisplay merge logic
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 formalizes the tool lifecycle states within the AgentProtocol. By introducing a standard set of status types and propagating them through the event translation layer and UI hooks, the system is now decoupled from legacy state management. This change ensures more reliable tracking of tool execution progress and simplifies the handling of tool-related events across the codebase. 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 the 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 counterproductive. 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 improves tool call status management by introducing a ToolEventStatus type and updating event interfaces to include execution status. Key changes include enhanced status mapping in the UI, a new message bus subscription in LegacyAgentProtocol for real-time updates, and a fix to the build script for cleaner documentation deployment. Reviewer feedback focused on improving type safety by replacing magic strings with the CoreToolCallStatus enum and addressing a potential bug where tool updates could leak across different agent sessions.
|
Size Change: +3.22 kB (+0.01%) Total Size: 33.8 MB
ℹ️ View Unchanged
|
|
✅ 69 tests passed successfully on gemini-3-flash-preview. 🧠 Model Steering GuidanceThis PR modifies files that affect the model's behavior (prompts, tools, or instructions).
This is an automated guidance message triggered by steering logic signatures. |
|
…ni-cli into mb/atui/02-tool-state

Summary
This PR formalizes first-class tool lifecycle states in the
AgentProtocolevent types and refactors the terminal UI rendering pipeline to consume these top-level status properties, fully decoupling it from legacy metadata objects.Details
1. Protocol Ingestion & Type Formalization
ToolEventStatusunion type ('pending' | 'pending_input' | 'executing' | 'succeeded' | 'errored' | 'aborted') in types.ts.status: ToolEventStatusfield toToolRequest,ToolUpdate, andToolResponseevent types.2. Granular State Transition Listening
translateEventin event-translator.ts to inject correct status flags.LegacyAgentProtocolin legacy-agent-session.ts to subscribe toTOOL_CALLS_UPDATEfrom the scheduler message bus, emitting a typedtool_updateevent on every single state transition.3. Dumb Terminal UI Decoupling
event.statusinstead of digging into_meta.legacyState.status.Related Issues
Closes #24993
How to Validate
Pre-Merge Checklist