Repository navigation
Refact: sandbox quickstart.md & add tutorial for code exec component - #14786
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughPropagates Python numerical-library thread env vars to local sandbox child processes, adds commented thread-limiting options to docker/.env, expands the sandbox quickstart with provider and executor-manager instructions, and adds a quickstart link in the Code operator UI. ChangesSandbox Configuration & Documentation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agent/sandbox/providers/local.py`:
- Around line 245-249: Add debug-level logging that reports which thread
environment variables were forwarded in the new env propagation loop: inside the
block iterating LOCAL_PYTHON_THREAD_ENV_VARS (the loop that sets env[name] =
value) emit a logger.debug call just before returning env that summarizes the
forwarded variable names (and optionally their values or masked values) so local
execution limits can be traced; use the module logger (or
logging.getLogger(__name__)) and reference LOCAL_PYTHON_THREAD_ENV_VARS and env,
placing the log immediately before the existing return env.
In `@docs/guides/agent/agent_quickstarts/sandbox_quickstart.md`:
- Line 43: The doc mixes two working-directory assumptions for rebuilding the
executor manager ("./sandbox/executor_manager" vs "./executor_manager");
standardize to a single path (or explicitly state "run these commands from the
repository root" vs "run from the sandbox directory") and update every instance
(the rebuild instruction and the build steps around lines 65–69) so they
consistently reference the chosen location; also add a one-line note clarifying
where to run the commands if you prefer to keep both path examples.
In `@web/src/pages/agent/form-sheet/next.tsx`:
- Around line 106-121: The quickstart icon-only Button (the Button wrapping
ArrowUpRight with onClick that opens SandboxQuickstartUrl) lacks an accessible
name; add an explicit accessible label—e.g., set aria-label="Open quickstart in
new tab" or include visually-hidden text inside the Button—to provide screen
readers a meaningful name while keeping the existing onClick behavior and target
attributes; ensure the label clearly conveys the action and that nothing else in
the Button (e.g., className or type) is changed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 914e2da8-8ca6-410d-9cc3-f67616c1623f
📒 Files selected for processing (4)
agent/sandbox/providers/local.pydocker/.envdocs/guides/agent/agent_quickstarts/sandbox_quickstart.mdweb/src/pages/agent/form-sheet/next.tsx
| for name in LOCAL_PYTHON_THREAD_ENV_VARS: | ||
| value = os.environ.get(name) | ||
| if value is not None: | ||
| env[name] = value | ||
| return env |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Add debug logging for forwarded thread env vars in the new env-propagation flow.
Line 245-Line 249 introduces new runtime behavior but stays silent, which makes debugging local execution limits harder.
Proposed patch
+import logging
@@
LOCAL_PYTHON_THREAD_ENV_VARS = (
@@
)
+
+logger = logging.getLogger(__name__)
@@
for name in LOCAL_PYTHON_THREAD_ENV_VARS:
value = os.environ.get(name)
if value is not None:
env[name] = value
+ logger.debug("Forwarding local sandbox thread env var: %s", name)
return envAs per coding guidelines, **/*.py: Add logging for new flows.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| for name in LOCAL_PYTHON_THREAD_ENV_VARS: | |
| value = os.environ.get(name) | |
| if value is not None: | |
| env[name] = value | |
| return env | |
| for name in LOCAL_PYTHON_THREAD_ENV_VARS: | |
| value = os.environ.get(name) | |
| if value is not None: | |
| env[name] = value | |
| logger.debug("Forwarding local sandbox thread env var: %s", name) | |
| return env |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@agent/sandbox/providers/local.py` around lines 245 - 249, Add debug-level
logging that reports which thread environment variables were forwarded in the
new env propagation loop: inside the block iterating
LOCAL_PYTHON_THREAD_ENV_VARS (the loop that sets env[name] = value) emit a
logger.debug call just before returning env that summarizes the forwarded
variable names (and optionally their values or masked values) so local execution
limits can be traced; use the module logger (or logging.getLogger(__name__)) and
reference LOCAL_PYTHON_THREAD_ENV_VARS and env, placing the log immediately
before the existing return env.
| <Button | ||
| variant="ghost" | ||
| size="icon" | ||
| className="ml-1 inline-flex size-5 !p-0 align-middle bg-transparent" | ||
| type="button" | ||
| onClick={(e) => { | ||
| e.stopPropagation(); | ||
| window.open( | ||
| SandboxQuickstartUrl, | ||
| '_blank', | ||
| 'noopener,noreferrer', | ||
| ); | ||
| }} | ||
| > | ||
| <ArrowUpRight className="size-4 cursor-pointer text-text-secondary" /> | ||
| </Button> |
There was a problem hiding this comment.
Add an accessible name to the icon-only quickstart button.
At Line 106-Line 121, screen readers won’t get a meaningful label for this control.
Proposed patch
{operatorName === Operator.Code && (
<Button
variant="ghost"
size="icon"
className="ml-1 inline-flex size-5 !p-0 align-middle bg-transparent"
type="button"
+ aria-label="Open sandbox quickstart guide"
+ title="Open sandbox quickstart guide"
onClick={(e) => {
e.stopPropagation();
window.open(
SandboxQuickstartUrl,
'_blank',
'noopener,noreferrer',
);
}}
>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <Button | |
| variant="ghost" | |
| size="icon" | |
| className="ml-1 inline-flex size-5 !p-0 align-middle bg-transparent" | |
| type="button" | |
| onClick={(e) => { | |
| e.stopPropagation(); | |
| window.open( | |
| SandboxQuickstartUrl, | |
| '_blank', | |
| 'noopener,noreferrer', | |
| ); | |
| }} | |
| > | |
| <ArrowUpRight className="size-4 cursor-pointer text-text-secondary" /> | |
| </Button> | |
| <Button | |
| variant="ghost" | |
| size="icon" | |
| className="ml-1 inline-flex size-5 !p-0 align-middle bg-transparent" | |
| type="button" | |
| aria-label="Open sandbox quickstart guide" | |
| title="Open sandbox quickstart guide" | |
| onClick={(e) => { | |
| e.stopPropagation(); | |
| window.open( | |
| SandboxQuickstartUrl, | |
| '_blank', | |
| 'noopener,noreferrer', | |
| ); | |
| }} | |
| > | |
| <ArrowUpRight className="size-4 cursor-pointer text-text-secondary" /> | |
| </Button> |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/pages/agent/form-sheet/next.tsx` around lines 106 - 121, The
quickstart icon-only Button (the Button wrapping ArrowUpRight with onClick that
opens SandboxQuickstartUrl) lacks an accessible name; add an explicit accessible
label—e.g., set aria-label="Open quickstart in new tab" or include
visually-hidden text inside the Button—to provide screen readers a meaningful
name while keeping the existing onClick behavior and target attributes; ensure
the label clearly conveys the action and that nothing else in the Button (e.g.,
className or type) is changed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14786 +/- ##
=======================================
Coverage 94.16% 94.16%
=======================================
Files 10 10
Lines 703 703
Branches 112 112
=======================================
Hits 662 662
Misses 25 25
Partials 16 16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
writinwaters
left a comment
There was a problem hiding this comment.
Minor nitpicking changes.
|
|
||
| ## Environment variables | ||
|
|
||
| The variables in `docker/.env` are grouped by scope. |
There was a problem hiding this comment.
I suggest remoing this line because it is a bit off the topic.
|
|
||
| :::tip NOTE | ||
| The error message `client version 1.43 is too old. Minimum supported API version is 1.44` indicates that your executor manager image's built-in Docker CLI version is lower than `29.1.0` required by the Docker daemon in use. To solve this issue, pull the latest `infiniflow/sandbox-executor-manager:latest` from Docker Hub or rebuild it in `./sandbox/executor_manager`. | ||
| The error message `client version 1.43 is too old. Minimum supported API version is 1.44` indicates that your executor manager image's built-in Docker CLI version is lower than `29.1.0` required by the Docker daemon in use. Rebuild the executor manager in `./sandbox/executor_manager` if you encounter this error in standalone mode. |
There was a problem hiding this comment.
Remove "in standalone mode" and then move this note to under Option1: Build from source.
| ::: | ||
|
|
||
| ## Build Docker base images | ||
| ## Prepare Docker images |
There was a problem hiding this comment.
I think removing "sandbox base images" from the section title could be confusing. How do you think?
| - Set `SANDBOX_ENABLED=1`. | ||
| - Set `SANDBOX_PROVIDER_TYPE=self_managed` or `SANDBOX_PROVIDER_TYPE=local`. | ||
| - For `self_managed`, include `sandbox` in `COMPOSE_PROFILES`. | ||
| - For `local`, uncomment and adjust the `SANDBOX_LOCAL_*` variables. |
There was a problem hiding this comment.
Shall we use numbered list here, say 2.1, 2.2, 2.3?
There was a problem hiding this comment.
not very necessary
Co-authored-by: writinwaters <[email protected]>
Co-authored-by: writinwaters <[email protected]>
Co-authored-by: writinwaters <[email protected]>
Clarified error message guidance for Docker CLI version.
Updated section title from 'Prepare Docker images' to 'Build Docker base images' for clarity.
…nfiniflow#14786) ### What problem does this PR solve? Refact: sandbox quickstart.md && add tutorial for code exec component ### Type of change - [x] Refactoring <img width="700" alt="img_v3_0211j_dcff835b-e3bb-4c77-9bc5-3b31a983229g" src="https://github.com/user-attachments/assets/7842fc0f-639a-458f-b164-bc81a99ce4a5" /> --------- Co-authored-by: writinwaters <[email protected]>
What problem does this PR solve?
Refact: sandbox quickstart.md && add tutorial for code exec component
Type of change