Codex/merge pr 388#394
Conversation
Add 13 design documents covering agent board architecture, sandbox lifecycle, multi-agent orchestration, DAG execution, session persistence, E2E repair loop, and codex tool-use iteration policy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cture - Add ExecutorAgent, PlannerAgent, KnowledgeManager sub-agents that operate directly inside the E2B VM filesystem - Add SharedSandbox and PersistentSandboxManager for per-user sandbox reuse with lease tracking and reconnect support - Add SandboxRuntime for install detection, package resolution, and verification policy (pytest/script) - Add SandboxToolExecutor with file snapshot capture on every write - Add CodexDispatcher tool-use loop with streaming callbacks - Add TaskDAG topological sort, Verification retry policy, E2E execution with auto-repair loop, and paper_slug generation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ndbox lifecycle - Implement 6-stage pipeline: sandbox init → file replay → plan → batch execute → E2E verify → knowledge extract - Add RunControl with run_id to prevent sandbox race condition on restart - Add pause/resume/cancel endpoints with SSE event emission - Add continue_run mode that replays file snapshots from completed tasks - Auto-release sandbox in try/finally, guarded by run_id match - Refactor E2B executor with keep_alive, attach_sandbox, reconnect support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace flat task list with ReactFlow DAG: Commander → Task → E2E → Open in VS Code nodes, all centered and non-draggable - Add SSE event loop with idle timeout (resets per event) - Add pipeline controls: pause/resume/cancel/continue/restart - Add AgentBoardSidebar with sandbox file tree, timer, progress bar - Add TaskDetailPanel with execution log blocks (Diff/Tool/Think/Result) - Remove human review approve/reject UI, treat human_review as done - Persist tasks and pipeline state to localStorage via Zustand - Show all edges immediately on refresh, stagger only during live planning - Add dedicated agent-board/[paperId] route and studio page navigation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 18 test files covering ExecutorAgent, PlannerAgent, KnowledgeManager, SandboxToolExecutor, SharedSandbox, SandboxRuntime, CodexDispatcher tool loop, E2E execution, TaskDAG, Verification, E2B executor, agent board routes, paper slug, install detection, and output compression. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add e2b.Dockerfile with pre-installed ML stack (torch, transformers, numpy, scipy, pandas, scikit-learn) and dev tooling (pytest, jupyter) - Add e2b.toml template config (paperbot-repro, 2 CPU, 512MB) - Add README with step-by-step onboarding and troubleshooting guide Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add E2B sandbox and CODEX_MAX_ITERATIONS vars to env.example - Update scholar_subscriptions last_seen_at timestamp - Wrap python-jose, email-validator, rapidfuzz imports in try/except with stdlib fallbacks for minimal install environments - Add localhost:3001/:3002 to default CORS origins Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename ToolExecutor → LocalToolExecutor for clarity - Narrow except Exception to except ImportError on optional imports - Remove leaked prompt references from analysis doc - Bump E2B sandbox memory from 512MB to 2048MB - Fix race condition in PersistentSandboxManager with double-checked locking - Add legacy migration comment in studio-store - Add DockerExecutor workspace_read_only unit tests Signed-off-by: boyu <oor2020@163.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Vercel Preview
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (81)
📝 WalkthroughWalkthroughThis pull request implements a comprehensive agent board refactor introducing a Flow DAG visualization replacing the previous Kanban board, a sandbox-as-workspace architecture with persistent user sandboxes, tool-enabled agent execution (PlannerAgent, ExecutorAgent, KnowledgeManager), automated verification and repair loops, and extensive supporting infrastructure for multi-phase system evolution. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client<br/>(Studio UI)
participant Backend as Backend<br/>(Agent Board API)
participant Planner as PlannerAgent
participant Executor as ExecutorAgent
participant Sandbox as SharedSandbox<br/>(VM)
participant Codex as CodexDispatcher<br/>(LLM)
participant Verify as Verification<br/>& Repair
participant Knowledge as KnowledgeManager
participant Download as Download
Client->>Backend: POST /sessions (create board session)
Backend->>Backend: Initialize session state
Client->>Backend: POST /sessions/{id}/plan (SSE stream)
Backend->>Planner: plan(sandbox, context_pack)
Planner->>Sandbox: read existing files
Planner->>Codex: decompose tasks
Codex-->>Planner: task list
Planner->>Sandbox: write .plan/ (roadmap, tasks, context)
Sandbox-->>Planner: success
Planner-->>Backend: tasks + on_step callbacks
Backend-->>Client: SSE: planning_complete
Client->>Backend: POST /tasks/{id}/dispatch (SSE stream)
Backend->>Sandbox: ensure sandbox active
Backend->>Executor: execute(task, sandbox)
Executor->>Sandbox: read .plan/ files
Executor->>Codex: dispatch_with_sandbox_tools (tool loop)
rect rgba(100, 150, 200, 0.5)
loop Tool Loop Iterations
Codex->>Executor: tool_call (via SandboxToolExecutor)
Executor->>Sandbox: execute tool (read/write/run)
Sandbox-->>Executor: result
Executor-->>Codex: observation
Codex->>Codex: process tool result
end
end
Codex-->>Executor: CodexResult (success/failure)
Executor->>Sandbox: write .status/{task_id}.json
Executor-->>Backend: result + generated files
Backend-->>Client: SSE: execution_complete
Backend->>Verify: run_verification(sandbox)
rect rgba(200, 100, 100, 0.5)
alt Verification Passes
Verify-->>Backend: success
else Verification Fails
Verify->>Codex: dispatch repair prompt
Codex-->>Verify: repair result
Verify->>Sandbox: retry verification
Verify-->>Backend: success/failure
end
end
Backend->>Knowledge: curate(sandbox, completed_tasks)
Knowledge->>Sandbox: aggregate outputs
Knowledge->>Sandbox: write .knowledge/ (summary, conventions, learnings)
Knowledge-->>Backend: completed
Backend-->>Client: SSE: knowledge_complete
Backend->>Download: download_paper(sandbox, local)
Download->>Sandbox: read final artifacts
Sandbox-->>Download: files
Download-->>Backend: local_path
Backend-->>Client: SSE: download_complete
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
|
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 delivers a foundational overhaul of the DeepCode Studio's agent system, transitioning to a sophisticated multi-agent paradigm centered around a persistent virtual machine workspace. The user interface for managing these agents has been completely reimagined, offering an intuitive, interactive flow that visualizes the entire reproduction pipeline. This extensive set of changes significantly enhances the system's autonomy, observability, and reliability, laying the groundwork for more complex agent behaviors and improved user experience. 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.
Pull request overview
This PR merges a large set of Agent Board / “swarm” features across the backend and Studio UI, including sandbox-as-workspace execution, verification/E2E repair loops, and richer task log rendering in the frontend.
Changes:
- Adds sandbox-as-workspace infrastructure (shared sandbox FS wrapper, sandbox tool executor, persistent sandbox manager) plus verification and E2E execution/repair utilities.
- Expands Studio UI for Agent Board (focus page layout, sidebar with sandbox file tree + time estimate, typed log blocks).
- Adds extensive unit test coverage for the new swarm/sandbox/dispatcher behaviors and some executor updates (Docker mount mode, optional deps fallbacks).
Reviewed changes
Copilot reviewed 80 out of 81 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| web/src/lib/store/studio-store.test.ts | Adds tests for new store actions/state reset behaviors; clears localStorage between tests. |
| web/src/components/studio/blocks/index.ts | Barrel export for new Studio log “block” components. |
| web/src/components/studio/blocks/ToolBlock.tsx | New log block UI for tool commands and expandable observation previews. |
| web/src/components/studio/blocks/ThinkBlock.tsx | New log block UI for “thinking” messages. |
| web/src/components/studio/blocks/ResultBlock.tsx | New log block UI for success/warning/failure events with optional summaries. |
| web/src/components/studio/blocks/InfoBlock.tsx | New log block UI for informational/system messages. |
| web/src/components/studio/blocks/DiffBlock.tsx | New log block UI for file-change previews and file click-through. |
| web/src/components/studio/ContextPackPanel.tsx | Comment tweak describing session creation behavior. |
| web/src/components/studio/ContextDialogPanel.tsx | Reconstructs synthetic progress/observations timeline from a restored context pack. |
| web/src/components/studio/AgentBoardSidebar.tsx | Adds sidebar sections: sandbox file tree + file viewer dialog, and a running time estimate/progress bar. |
| web/src/components/studio/AgentBoardEdges.tsx | Adds animated edge type + injected CSS for edge animations. |
| web/src/components/layout/LayoutShell.tsx | Hides sidebar for /studio/agent-board/* focus pages and adjusts main padding accordingly. |
| web/src/app/studio/page.tsx | Adds automatic context-pack restore/fetch by contextPackId and “latest session” lookup for selected paper. |
| web/src/app/studio/agent-board/[paperId]/page.tsx | Adds Agent Board “focus mode” page that loads papers, selects the paper, and provides a back action. |
| tests/unit/test_verification.py | New tests for verification policy, command detection, and repair loop error handling. |
| tests/unit/test_tool_executor.py | New tests for LocalToolExecutor tool behaviors and guardrails (path safety, allowlist, timeouts). |
| tests/unit/test_task_dag.py | New tests for TaskDAG batching (linear, diamond, cycles, missing deps). |
| tests/unit/test_swarm_timeouts.py | Adds test ensuring Codex tool dispatch timeout returns a failure result. |
| tests/unit/test_shared_sandbox.py | New tests for SharedSandbox filesystem/command behaviors, download filtering, and slug shell escaping. |
| tests/unit/test_sandbox_tool_executor.py | New tests for SandboxToolExecutor VM-native tool behavior and safety checks. |
| tests/unit/test_sandbox_runtime.py | New tests for SandboxRuntime policy parsing and missing-package detection logic. |
| tests/unit/test_planner_agent.py | New tests for PlannerAgent writing plan files into VM and on_step callback. |
| tests/unit/test_paper_slug.py | New tests for filesystem-safe, deterministic paper_slug generation. |
| tests/unit/test_knowledge_manager.py | New tests for KnowledgeManager writing curated outputs and preserving .status. |
| tests/unit/test_install_output_compression.py | Tests install output compression logic for signal lines. |
| tests/unit/test_install_command_detection.py | Tests install command detection helper. |
| tests/unit/test_executor_agent.py | New tests for ExecutorAgent prompt construction, VM status writes, and failure handling. |
| tests/unit/test_e2b_executor.py | New tests for E2B executor env config, keep-alive reuse, recovery, and upload behavior. |
| tests/unit/test_codex_tool_loop.py | New tests covering tool loop behavior including stagnation/auto-budget/timeout/malformed args handling. |
| tests/unit/test_cache_metrics.py | New tests for cache hit rate tracking. |
| tests/unit/repro/test_docker_executor.py | New tests for DockerExecutor workspace mount mode and runtime_meta. |
| src/paperbot/repro/docker_executor.py | Adds workspace_read_only flag and records it in runtime_meta; mount mode is now configurable. |
| src/paperbot/memory/extractor.py | Narrows exception handling to ImportError for optional json_repair dependency. |
| src/paperbot/infrastructure/swarm/verification.py | Adds verification policy, command detection, run_verification, and verify+repair loop. |
| src/paperbot/infrastructure/swarm/task_dag.py | Adds DAG-based batching scheduler for parallel task execution. |
| src/paperbot/infrastructure/swarm/shared_sandbox.py | Adds SharedSandbox VM abstraction for file ops and command execution; supports download filtering and sandbox expiry recovery. |
| src/paperbot/infrastructure/swarm/sandbox_tool_executor.py | Adds VM-native tool executor with path safety, allowlist checks, output truncation/compression, and tool logging. |
| src/paperbot/infrastructure/swarm/sandbox_runtime.py | Adds sandbox runtime command runner + verification policy parsing + missing-package detection helpers. |
| src/paperbot/infrastructure/swarm/persistent_sandbox.py | Adds PersistentSandboxManager for per-user reusable sandbox executors and lease tracking. |
| src/paperbot/infrastructure/swarm/paper_slug.py | Adds filesystem-safe paper slug generator for sandbox directory namespacing. |
| src/paperbot/infrastructure/swarm/e2e_execution.py | Adds entrypoint detection, run command construction, E2E execution, and repair loop with diagnosis prompts. |
| src/paperbot/infrastructure/swarm/claude_commander.py | Adds Anthropic cache_control on system prompts, includes subtasks in codex prompt, and adds a repair prompt builder. |
| src/paperbot/infrastructure/swarm/agents/planner.py | Adds PlannerAgent that decomposes tasks and writes .plan/ artifacts into VM. |
| src/paperbot/infrastructure/swarm/agents/knowledge_manager.py | Adds KnowledgeManager that writes .knowledge/ summaries and updates commander wisdom. |
| src/paperbot/infrastructure/swarm/agents/executor.py | Adds ExecutorAgent that runs Codex tool loop in VM and writes .status/{task_id}.json. |
| src/paperbot/infrastructure/swarm/agents/init.py | Exports new swarm agents. |
| src/paperbot/infrastructure/swarm/init.py | Re-exports new swarm primitives (sandbox runtime, tools, verification, DAG, etc.). |
| src/paperbot/application/services/paper_dedup.py | Adds fallback implementation when rapidfuzz isn’t installed. |
| src/paperbot/api/routes/jobs.py | Narrows exception handling to ImportError for optional arq dependency. |
| src/paperbot/api/routes/auth.py | Makes EmailStr optional via email_validator fallback for minimal envs. |
| src/paperbot/api/middleware/auth.py | Expands default CORS origins for additional localhost ports. |
| src/paperbot/api/auth/jwt.py | Makes python-jose optional and raises clear runtime errors when missing. |
| src/paperbot/api/auth/dependencies.py | Makes jose.JWTError optional and broadens token decode failure handling. |
| env.example | Documents E2B sandbox env vars and CODEX_MAX_ITERATIONS. |
| e2b-template/e2b.toml | Adds E2B template config (id, resources). |
| e2b-template/e2b.Dockerfile | Adds E2B sandbox image definition with common ML/science/dev tooling. |
| e2b-template/README.md | Documentation for building/publishing E2B template and configuring env vars. |
| docs/proposals/task-detail-enrichment-plan.md | Design proposal for typed content blocks and richer task detail views. |
| docs/proposals/session-state-persistence-plan.md | Plan for persisting/restoring session state across refresh. |
| docs/proposals/persistent-user-sandbox-implementation-plan.md | Plan for persistent per-user sandboxes and hardening roadmap. |
| docs/proposals/e2e-bugfix-repair-plan.md | Plan documenting E2E execution bugfixes and test expectations. |
| docs/proposals/codex-loop-iteration-policy-plan-zh.md | Chinese design proposal for tool-loop iteration policy and diagnostics. |
| config/scholar_subscriptions.yaml | Updates last_seen_at timestamp for a subscription. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| ) : ( | ||
| <Terminal className="h-3.5 w-3.5 text-zinc-400 shrink-0" /> | ||
| )} | ||
| <Terminal className="h-3.5 w-3.5 text-zinc-400 shrink-0" /> | ||
| <code className="text-xs font-mono text-zinc-300 truncate">{command}</code> |
| ) : ( | ||
| <FileCode className="h-3.5 w-3.5 text-zinc-400 shrink-0" /> | ||
| )} | ||
| <FileCode className="h-3.5 w-3.5 text-amber-500 shrink-0" /> | ||
| <span className="text-xs font-mono text-zinc-600 truncate group-hover:text-indigo-600 transition-colors"> |
| def __init__(self, tasks: List["AgentTask"]): | ||
| self._tasks = {t.title: t for t in tasks} | ||
| self._dependents: Dict[str, Set[str]] = defaultdict(set) |
There was a problem hiding this comment.
Code Review
This is a substantial and impressive pull request that refactors the agent execution model to a sophisticated "Sandbox-as-Workspace" architecture, inspired by systems like Manus. The changes are well-documented in the numerous proposal files and introduce a more robust, secure, and feature-rich system. Key improvements include the move to a DAG-based UI using ReactFlow, full frontend state persistence for session restoration, and a sophisticated agent loop with policies for stagnation and budget extension. The code quality is high, with good attention to security practices like path sanitization and command quoting. I have one high-severity suggestion to improve the robustness of file writing within the sandbox, but overall, this is an excellent and well-executed architectural upgrade.
| def _ensure_dir(self, fs: Any, path: str) -> None: | ||
| """Create a directory in the VM, ignoring 'already exists' errors.""" | ||
| try: | ||
| fs.make_dir(path) | ||
| except Exception: | ||
| pass |
There was a problem hiding this comment.
The _ensure_dir method is not recursive. It calls fs.make_dir(path), which likely only creates a single directory and will fail if parent directories do not exist. This could cause the write_file tool to fail unexpectedly if an agent attempts to write a file into a new, nested directory structure (e.g., src/utils/helpers.py when src/utils does not exist).
To make this more robust, I suggest implementing a recursive directory creation, similar to mkdir -p. A simple way to achieve this would be to use the existing run_command method.
def _ensure_dir(self, fs: Any, path: str) -> None:
"""Create a directory in the VM, ignoring 'already exists' errors."""
self.run_command(f"mkdir -p {shlex.quote(path)}")
Summary by CodeRabbit
New Features
Documentation