Feather request context to shell tool env#1548
Feather request context to shell tool env#1548mautops wants to merge 5 commits intoagentscope-ai:mainfrom
Conversation
- 新增 _wrap_shell_tool 包装器,自动注入 COPAW_前缀环境变量 - 实现三层安全防护:命令过滤、readonly 声明、进程隔离 - 支持 session_id、user_id、channel 等上下文传递 - 精简代码至 43 行,保留核心功能和安全注释
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 introduces a significant enhancement to the agent's ability to interact with shell tools by providing a secure and controlled way to pass contextual information. By injecting request context as read-only environment variables and implementing safeguards against environment manipulation, the change improves both the functionality and security of shell command execution within the agent's ecosystem. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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 introduces a feature to pass request context to the shell tool as environment variables. The implementation includes security measures like blocking environment manipulation commands and making the injected variables read-only. My review focuses on improving cross-platform compatibility, code style, and maintainability. I've identified a high-severity issue where the new feature would fail on Windows, and a couple of medium-severity issues related to code style and duplication.
nice suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
nice suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- 修复 readonly 声明的嵌套 f-string 语法 - 添加 sys 模块导入以支持平台检查 - Windows 平台跳过 bash 包装(使用 PowerShell)
|
😔 |
|
@mautops hello, is there anything I can help with? |
一直没合并,代码现在冲突了,暂时先不合并了,我先自用; 这个 feather 绝大多数人可能都用不到; |
Description
[Describe what this PR does and why]
Related Issue: Fixes #(issue_number) or Relates to #(issue_number)
Security Considerations: [If applicable, e.g. channel auth, env/config handling]
Type of Change
Component(s) Affected
Checklist
pre-commit run --all-fileslocally and it passespytestor as relevant) and they passTesting
[How to test these changes]
Local Verification Evidence
Additional Notes
[Optional: any other context]