fix(core): ensure subagent tool updates apply configuration overrides immediately#23161
fix(core): ensure subagent tool updates apply configuration overrides immediately#23161abhipatel12 merged 4 commits intomainfrom
Conversation
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 addresses a critical bug where disabling subagents during an active session did not lead to their corresponding tools being unregistered. The changes ensure that when agent configurations are reloaded, any subagents that have been disabled are properly removed from the system's tool registry, preventing stale or unauthorized tools from remaining active. This improves the dynamic configuration management of agents and maintains system integrity. 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
|
|
Size Change: +531 B (0%) Total Size: 26.1 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the issue of subagents not being unregistered when disabled during a session. The addition of an explicit unregistration step in registerSubAgentTools ensures that the ToolRegistry accurately reflects the enabled state of agents. The new unit test provides good coverage for this scenario, simulating a live reload and verifying the correct unregistration behavior. The documentation updates are minor clarifications.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the issues of subagent unregistration and immediate application of configuration overrides. However, it introduces a potential Denial of Service (DoS) vulnerability where the new logic for unregistering disabled agents can incorrectly remove built-in tools if agent names collide, leading to a loss of core functionality. Additionally, the new unit test in packages/core/src/config/config.test.ts deviates from repository testing conventions by manipulating environment variables and private class properties, which should be addressed for improved reliability and maintainability.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses two issues related to subagent configuration reloading. The changes ensure that subagents are properly unregistered when disabled and that any configuration updates for enabled subagents are applied immediately without requiring a session restart. This is achieved by adding an explicit unregistration step and re-running the registration logic with the latest merged configurations during a settings reload. A new unit test has been added to validate the unregistration behavior, which is a good addition. The implementation is sound and effectively resolves the described problems.
NTaylorMullen
left a comment
There was a problem hiding this comment.
Approving to unblock, would suggest applying the comments though
9b54a6c to
ee11965
Compare
Summary
Fixes two related issues with subagent configuration during a running session:
agents.overrides(like insettings.jsonor via/agents).When a session reloads settings, the
Config.registerSubAgentToolsmethod was correctly skipping the addition of disabled subagents, but failed to explicitly remove them from theToolRegistry. Furthermore, it was using base, unmerged definitions to constructSubagentToolinstances, ignoring any user-specified overrides.Details
registerSubAgentToolsinpackages/core/src/config/config.tsto usegetAllDiscoveredAgentNames()to explicitly unregister any subagents that are now disabled.registerSubAgentToolsto usegetRegisteredAgents()(which returns merged definitions) when constructingSubagentToolinstances, ensuring all configuration overrides are applied immediately.packages/core/src/config/config.test.tsto simulate a "live reload" scenario and guarantee this behavior.Related Issues
N/A
How to Validate
codebase_investigator) insettings.json.settings.jsonor via/agents)./agentsconfig.Pre-Merge Checklist