fix(core): propagate subagent context to policy engine#22086
fix(core): propagate subagent context to policy engine#22086NTaylorMullen merged 1 commit intomainfrom
Conversation
- Pass subagent name from Scheduler to checkPolicy and then to PolicyEngine. - Ensure subagent-specific session approvals are correctly matched. - Update agent scheduling to correctly populate subagent identity.
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 regression in the core logic where subagent-specific tool approvals were not being correctly remembered. The changes ensure that the 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
|
There was a problem hiding this comment.
Code Review
This pull request addresses a regression by correctly propagating the subagent name to the policy engine. The changes are implemented by passing the subagent context through AgentSchedulingOptions and the Scheduler to the checkPolicy function. The logic appears sound, and a new unit test has been added to verify the fix. The implementation is clean and directly solves the described issue.
|
Size Change: +207 B (0%) Total Size: 26.5 MB ℹ️ View Unchanged
|
Summary
This PR fixes a regression where subagent-specific tool approvals (including "Allow for this session") were not correctly remembered.
Details
The event-driven
Schedulerwas not passing thesubagentname to thePolicyEngineduring the initialcheckPolicycall. This caused subagent-specific rules (including those created dynamically during a session) to be ignored during the first check, leading to redundant confirmation prompts.Changes:
Schedulerto accept and storesubagentname.checkPolicyandPolicyEngine.checkcalls to propagate this name.AgentSchedulingOptionsandLocalAgentExecutorto provide the subagent's name.Related Issues
Part of the "Allow for session" regression fix.
How to Validate
npm test -w @google/gemini-cli-core -- src/scheduler/scheduler.test.ts src/scheduler/policy.test.tsPre-Merge Checklist