fix(core): ensure AgentLoopContext getters are preserved in updatePolicy#22175
fix(core): ensure AgentLoopContext getters are preserved in updatePolicy#22175aishaneeshah wants to merge 1 commit into
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 resolves a critical regression that prevented subagents from properly functioning with policy-protected tools due to incorrect inheritance of Highlights
Changelog
Activity
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. 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
|
|
Size Change: +55 B (0%) Total Size: 26.1 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a regression that caused subagents to crash when using policy-protected tools. The fix in agent-scheduler.ts properly threads the messageBus to the subagent configuration by using Object.defineProperty, which aligns with the existing pattern for toolRegistry. Additionally, the new guard clause in local-executor.ts provides a robust defensive check to ensure the messageBus is present, improving the overall stability of agent creation. The changes are sound and effectively resolve the issue.
7da5934 to
d8dd0ab
Compare
d8dd0ab to
9b0eb0e
Compare
|
Thanks for the fix @aishaneeshah - verified working at my end locally. |
Summary
This PR fixes a regression where selecting "Always Allow" on a tool confirmation would cause a crash with
"Cannot read properties of undefined (reading 'publish')".Details
The bug was in
packages/core/src/scheduler/policy.ts. The code was using the spread operator{ ...context }on an object implementingAgentLoopContext(typically aConfiginstance). In JavaScript, the spread operator only copies own enumerable properties and does not copy prototype getters. SincemessageBusandconfigare defined as getters on the class prototype, they were missing from the resultingdepsobject, leading toundefinedaccess.Fix:
configandmessageBusfrom the context instead of using the spread operator.Related Issues
Closes #21982
How to Validate
shell).npm test -w @google/gemini-cli-core -- src/scheduler/policy.test.ts.