Skip to content

Conversation

@Yunnglin
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings December 15, 2025 07:37
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Yunnglin, 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 primarily focuses on significantly enhancing the documentation for sandbox management, making it easier for users to understand and utilize advanced features. It introduces a new SandboxManagerFactory for streamlined manager selection and provides detailed guidance on leveraging 'Pooled Sandboxes' to optimize performance by reusing pre-warmed environments. Additionally, it includes a minor code adjustment to the default timeout for pooled sandbox execution and an update to a related test case, ensuring more robust testing of the pooling functionality.

Highlights

  • Sandbox Manager Factory Documentation: Introduced comprehensive documentation for the SandboxManagerFactory, providing a unified entry point for automatically selecting between local and HTTP sandbox managers based on configuration, complete with usage examples.
  • Sandbox Pooling Documentation: Added detailed documentation for 'Pooled Sandboxes,' explaining the concept of pre-warmed sandboxes to amortize container startup costs and improve performance. This includes examples for both local and HTTP manager usage, along with notes on timeouts, FIFO behavior, and error handling.
  • Manager Configuration Updates: Updated the SandboxManagerConfig documentation to explicitly include base_url and cleanup_interval parameters, clarifying configuration options for sandbox managers.
  • Pooled Execution Timeout Adjustment: Modified the execute_tool_in_pool method in LocalSandboxManager to set a default timeout of 60 minutes if no other timeout is explicitly provided, enhancing robustness for long-running tasks.
  • Increased Test Concurrency: Increased the number of concurrent tasks in the test_concurrent_pool_execution_via_http test case from 3 to 5, providing more thorough testing of the sandbox pooling mechanism under load.
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 introduces documentation for the new SandboxManagerFactory and Sandbox Pool features, which is a valuable addition. The examples provided are clear and helpful. I've identified a few areas for improvement in the code and tests to enhance correctness and maintainability. Specifically, there's an incorrect docstring, a hardcoded magic number that should be a constant, and a bug in a test assertion. Addressing these points will strengthen the implementation.

@@ -372,7 +372,6 @@ async def execute_tool_in_pool(
Args:
tool_name: Tool name to execute
parameters: Tool parameters
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The timeout parameter was removed from the docstring, but it is still part of the function signature and is used within the method. To maintain documentation accuracy and prevent confusion, the timeout parameter should be documented in the docstring.

Suggested change
parameters: Tool parameters
parameters: Tool parameters
timeout: Optional timeout for waiting for available sandbox

raise RuntimeError('Sandbox manager not started')

timeout = timeout or self.config.timeout
timeout = timeout or self.config.timeout or 60 * 60 # Default 60 minutes
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The default timeout of 60 * 60 is a magic number. For better readability and maintainability, consider defining this as a named constant at the module level, for example:

DEFAULT_POOL_EXECUTION_TIMEOUT = 3600  # 1 hour

Then you could use it here:

timeout = timeout or self.config.timeout or DEFAULT_POOL_EXECUTION_TIMEOUT

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the sandbox pool documentation by adding comprehensive Chinese and English documentation for the SandboxManagerFactory and sandbox pool features. The changes also include a minor test update and a code improvement to the timeout handling.

Key changes:

  • Added documentation for SandboxManagerFactory (automatic manager type selection)
  • Added detailed sandbox pool usage examples in both English and Chinese READMEs
  • Updated concurrent pool test to use 5 tasks instead of 3
  • Improved timeout default handling with a 60-minute fallback
  • Removed outdated timeout parameter from docstring

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
README.md Added section 0 for SandboxManagerFactory and section 4 for sandbox pool with local/HTTP examples and configuration notes
README_zh.md Added Chinese translations of the same SandboxManagerFactory and sandbox pool documentation
ms_enclave/sandbox/manager/local_manager.py Removed timeout parameter from docstring and added 60-minute default timeout fallback
tests/test_manage_pool.py Increased concurrent test tasks from 3 to 5 to better test pool queuing behavior

Comment on lines 372 to 374
Args:
tool_name: Tool name to execute
parameters: Tool parameters
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

The timeout parameter was removed from the docstring but it still exists in the function signature at line 364. The docstring should document this parameter. It represents the maximum time to wait for an available sandbox from the pool before raising a TimeoutError.

Copilot uses AI. Check for mistakes.
@Yunnglin Yunnglin merged commit 19bc2a4 into main Dec 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants