v3.3.2: Full paths in plan, minimal Coder tools (write_file only)
Browse files- Dockerfile +1 -1
- chainlit_app.py +2 -2
- codepilot/agents/coder_agent.py +22 -26
- codepilot/agents/orchestrator.py +1 -1
- codepilot/agents/planner_agent.py +6 -1
Dockerfile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
# HuggingFace Spaces Dockerfile for CodePilot
|
| 2 |
-
# BUILD_VERSION:
|
| 3 |
FROM python:3.11-slim
|
| 4 |
|
| 5 |
# Set working directory
|
|
|
|
| 1 |
# HuggingFace Spaces Dockerfile for CodePilot
|
| 2 |
+
# BUILD_VERSION: 11 (v3.3.2 full paths in plan, minimal coder tools)
|
| 3 |
FROM python:3.11-slim
|
| 4 |
|
| 5 |
# Set working directory
|
chainlit_app.py
CHANGED
|
@@ -20,8 +20,8 @@ from concurrent.futures import ThreadPoolExecutor
|
|
| 20 |
# ============================================================
|
| 21 |
# STARTUP VERSION CHECK - Change this to detect if rebuild worked
|
| 22 |
# ============================================================
|
| 23 |
-
APP_VERSION = "3.3.
|
| 24 |
-
BUILD_ID = "2024-12-19-
|
| 25 |
print("=" * 60)
|
| 26 |
print(f"[STARTUP] CodePilot Chainlit App")
|
| 27 |
print(f"[STARTUP] APP_VERSION: {APP_VERSION}")
|
|
|
|
| 20 |
# ============================================================
|
| 21 |
# STARTUP VERSION CHECK - Change this to detect if rebuild worked
|
| 22 |
# ============================================================
|
| 23 |
+
APP_VERSION = "3.3.2-full-paths"
|
| 24 |
+
BUILD_ID = "2024-12-19-v10"
|
| 25 |
print("=" * 60)
|
| 26 |
print(f"[STARTUP] CodePilot Chainlit App")
|
| 27 |
print(f"[STARTUP] APP_VERSION: {APP_VERSION}")
|
codepilot/agents/coder_agent.py
CHANGED
|
@@ -21,34 +21,35 @@ from typing import Dict, Any, Optional
|
|
| 21 |
import json
|
| 22 |
|
| 23 |
|
| 24 |
-
# Coder's specialized system prompt (v3.3 -
|
| 25 |
CODER_SYSTEM_PROMPT = """You are an expert software engineer. Your ONLY job is to WRITE CODE.
|
| 26 |
|
| 27 |
-
===
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
3. DO NOT try to access /tmp/codepilot_repos/ from sandbox - IT WILL FAIL
|
| 31 |
-
4. Use file paths EXACTLY as shown in the exploration results
|
| 32 |
-
5. The sandbox is ISOLATED - it cannot see the cloned repo
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
| 39 |
|
| 40 |
=== TOOLS ===
|
| 41 |
-
- write_file:
|
| 42 |
-
- get_code_chunk: Read
|
| 43 |
-
-
|
| 44 |
-
- run_command_in_sandbox: Run YOUR uploaded code (like "python app.py")
|
| 45 |
|
| 46 |
=== EXAMPLE ===
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
"""
|
| 53 |
|
| 54 |
|
|
@@ -77,16 +78,11 @@ class CoderAgent:
|
|
| 77 |
|
| 78 |
self.conversation = ConversationManager()
|
| 79 |
|
| 80 |
-
# v3.3:
|
| 81 |
-
# Removed sandbox commands that were being misused for exploration
|
| 82 |
self.allowed_tools = [
|
| 83 |
"write_file", # PRIMARY TOOL - create or modify files
|
| 84 |
"get_code_chunk", # Read specific function/class if needed
|
| 85 |
"read_file", # Read entire file (only when rewriting)
|
| 86 |
-
"upload_to_sandbox", # Upload code for testing
|
| 87 |
-
"execute_in_sandbox" # Execute Python snippets for testing
|
| 88 |
-
# REMOVED: run_command_in_sandbox - was being misused for ls/find
|
| 89 |
-
# REMOVED: get_file_outline - Coder should use exploration context
|
| 90 |
]
|
| 91 |
|
| 92 |
def run(
|
|
|
|
| 21 |
import json
|
| 22 |
|
| 23 |
|
| 24 |
+
# Coder's specialized system prompt (v3.3.2 - use full paths from plan)
|
| 25 |
CODER_SYSTEM_PROMPT = """You are an expert software engineer. Your ONLY job is to WRITE CODE.
|
| 26 |
|
| 27 |
+
=== READ THE PLAN CAREFULLY ===
|
| 28 |
+
The plan contains FULL ABSOLUTE PATHS like:
|
| 29 |
+
/tmp/codepilot_repos/flask_abc123/examples/health_check/app.py
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
Use these paths EXACTLY with write_file. Do not modify or verify them.
|
| 32 |
+
|
| 33 |
+
=== YOUR ONLY WORKFLOW ===
|
| 34 |
+
1. Read the PLAN - it has the exact file paths to create
|
| 35 |
+
2. Call write_file with the FULL PATH from the plan
|
| 36 |
+
3. Done!
|
| 37 |
|
| 38 |
=== TOOLS ===
|
| 39 |
+
- write_file(path, content): Create/modify files - USE THE FULL PATH FROM PLAN
|
| 40 |
+
- get_code_chunk(path, name): Read existing code if you need to copy a pattern
|
| 41 |
+
- read_file(path): Read entire file only if rewriting it
|
|
|
|
| 42 |
|
| 43 |
=== EXAMPLE ===
|
| 44 |
+
Plan says: "Create file: /tmp/codepilot_repos/flask_abc123/examples/health_check/app.py"
|
| 45 |
+
You do: write_file(path="/tmp/codepilot_repos/flask_abc123/examples/health_check/app.py", content="from flask import...")
|
| 46 |
+
|
| 47 |
+
=== DO NOT ===
|
| 48 |
+
❌ Do NOT explore or verify paths
|
| 49 |
+
❌ Do NOT use sandbox to run ls/find/pwd
|
| 50 |
+
❌ Do NOT ask questions - just write the code
|
| 51 |
|
| 52 |
+
START WITH write_file IMMEDIATELY.
|
| 53 |
"""
|
| 54 |
|
| 55 |
|
|
|
|
| 78 |
|
| 79 |
self.conversation = ConversationManager()
|
| 80 |
|
| 81 |
+
# v3.3.2: Only file tools - no sandbox (was being misused)
|
|
|
|
| 82 |
self.allowed_tools = [
|
| 83 |
"write_file", # PRIMARY TOOL - create or modify files
|
| 84 |
"get_code_chunk", # Read specific function/class if needed
|
| 85 |
"read_file", # Read entire file (only when rewriting)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
]
|
| 87 |
|
| 88 |
def run(
|
codepilot/agents/orchestrator.py
CHANGED
|
@@ -9,7 +9,7 @@ The orchestrator is the "brain" that:
|
|
| 9 |
"""
|
| 10 |
|
| 11 |
# VERSION CHECK - If you see this, new code is running!
|
| 12 |
-
ORCHESTRATOR_VERSION = "3.3.
|
| 13 |
print(f"[ORCHESTRATOR] ========== LOADING VERSION {ORCHESTRATOR_VERSION} ==========")
|
| 14 |
|
| 15 |
from enum import Enum
|
|
|
|
| 9 |
"""
|
| 10 |
|
| 11 |
# VERSION CHECK - If you see this, new code is running!
|
| 12 |
+
ORCHESTRATOR_VERSION = "3.3.2-full-paths"
|
| 13 |
print(f"[ORCHESTRATOR] ========== LOADING VERSION {ORCHESTRATOR_VERSION} ==========")
|
| 14 |
|
| 15 |
from enum import Enum
|
codepilot/agents/planner_agent.py
CHANGED
|
@@ -56,10 +56,15 @@ Use the EXPLORATION RESULTS to understand the codebase structure and create your
|
|
| 56 |
4. TESTING: How to verify the changes work
|
| 57 |
|
| 58 |
=== PLAN QUALITY REQUIREMENTS ===
|
|
|
|
| 59 |
- Be SPECIFIC: Include exact file names, function names, line numbers
|
| 60 |
- Be ORDERED: Steps should build on each other logically
|
| 61 |
- Be COMPLETE: Cover all aspects of the task
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
You do NOT write code - just create the plan for the Coder agent to follow.
|
| 65 |
"""
|
|
|
|
| 56 |
4. TESTING: How to verify the changes work
|
| 57 |
|
| 58 |
=== PLAN QUALITY REQUIREMENTS ===
|
| 59 |
+
- Use FULL ABSOLUTE PATHS: Always use the complete path from exploration (e.g., /tmp/codepilot_repos/flask_xxx/examples/file.py)
|
| 60 |
- Be SPECIFIC: Include exact file names, function names, line numbers
|
| 61 |
- Be ORDERED: Steps should build on each other logically
|
| 62 |
- Be COMPLETE: Cover all aspects of the task
|
| 63 |
+
|
| 64 |
+
=== CRITICAL FOR CODER ===
|
| 65 |
+
The Coder will use your paths EXACTLY as written. Include the FULL path from the exploration context.
|
| 66 |
+
Example: "Create file: /tmp/codepilot_repos/flask_abc123/examples/health_check/app.py"
|
| 67 |
+
NOT: "Create file: examples/health_check/app.py"
|
| 68 |
|
| 69 |
You do NOT write code - just create the plan for the Coder agent to follow.
|
| 70 |
"""
|