Skip to content

Conversation

@adamfweidman
Copy link
Collaborator

Summary

This PR fixes an issue where sub-agent schema updates (triggered by /agents refresh) were not propagating to the active chat session. It also improves resource lifecycle management and refines the CLI Help Agent's guidance.

Details

  • Live Updates: Propagates AgentsRefreshed events to the active GeminiClient, ensuring updated tool schemas and system instructions are applied without a restart.
  • CliHelp Refinement: Conditionally inserts remote and local subagent config help and clarifies the distinction between Remote Agents (A2A) and MCP Servers.

Related Issues

Fixes: #16408

How to Validate

Walk through Demo Doc on this branch

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@adamfweidman adamfweidman requested a review from a team as a code owner January 12, 2026 10:22
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @adamfweidman, 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 addresses a critical bug where sub-agent schema and prompt updates were not being reflected in active chat sessions after a refresh operation. It introduces an event-driven mechanism to ensure these updates are applied dynamically to the GeminiClient and refines the CliHelpAgent's system prompt to provide clearer, context-aware guidance on sub-agents, improving the overall responsiveness and accuracy of the agent system.

Highlights

  • Sub-agent Schema Refresh Fix: Resolves an issue where sub-agent schema updates, triggered by the /agents refresh command, were not being propagated to the active chat session, leading to outdated tool definitions and system instructions.
  • Live Updates for Active Sessions: Introduces a mechanism to propagate AgentsRefreshed events to the active GeminiClient, ensuring that updated tool schemas and system instructions are applied dynamically without requiring a restart of the chat session.
  • CLI Help Agent Refinement: Enhances the CliHelpAgent by conditionally inserting detailed guidance on local and remote sub-agent configurations, and clarifies the distinction between 'Remote Agents (A2A)' and 'MCP Servers' within the system prompt.
  • Improved Resource Lifecycle Management: Adds an event listener for CoreEvent.AgentsRefreshed in the Config class and implements a dispose method to properly remove this listener and stop the mcpClientManager when resources are no longer needed.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses the issue of sub-agent schemas not refreshing at runtime. The implementation correctly uses an event-driven approach to propagate AgentsRefreshed events, ensuring that the GeminiClient's tool schemas and system instructions are updated in the active session. The code is well-structured, with a good refactoring of the tool registration logic into a separate method and the responsible addition of a dispose method for resource cleanup. The related tests have been updated appropriately to reflect these changes. Overall, this is a solid fix that improves the dynamic capabilities of the agent system.

@github-actions
Copy link

github-actions bot commented Jan 12, 2026

Size Change: +2.25 kB (+0.01%)

Total Size: 22.3 MB

Filename Size Change
./bundle/gemini.js 22.3 MB +2.25 kB (+0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

@gemini-cli gemini-cli bot added priority/p2 Important but can be addressed in a future release. area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality labels Jan 12, 2026
@sehoon38 sehoon38 enabled auto-merge January 12, 2026 17:00
@sehoon38 sehoon38 added this pull request to the merge queue Jan 12, 2026
Merged via the queue into main with commit 465ec97 Jan 12, 2026
26 checks passed
@sehoon38 sehoon38 deleted the fix-agent-refresh branch January 12, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix agents refresh and add inject guidance into cli_help agent

3 participants