Fix orchestrator not resetting between tasks
Browse files- Create fresh orchestrator for each new task (not clarification answers)
- Prevents stale context from previous tasks being reused
- Each new message gets a clean slate
- Dockerfile +1 -1
- chainlit_app.py +8 -2
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: 15 (v3.3.6 reset-fix - reset orchestrator for new tasks)
|
| 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}")
|
|
@@ -122,6 +122,12 @@ async def main(message: cl.Message):
|
|
| 122 |
orchestrator: Orchestrator = cl.user_session.get("orchestrator")
|
| 123 |
|
| 124 |
# Check if we're waiting for clarification answers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
if cl.user_session.get("waiting_for_clarification"):
|
| 126 |
cl.user_session.set("waiting_for_clarification", False)
|
| 127 |
user_answers = message.content
|
|
|
|
| 20 |
# ============================================================
|
| 21 |
# STARTUP VERSION CHECK - Change this to detect if rebuild worked
|
| 22 |
# ============================================================
|
| 23 |
+
APP_VERSION = "3.3.6-reset-fix"
|
| 24 |
+
BUILD_ID = "2024-12-19-v14"
|
| 25 |
print("=" * 60)
|
| 26 |
print(f"[STARTUP] CodePilot Chainlit App")
|
| 27 |
print(f"[STARTUP] APP_VERSION: {APP_VERSION}")
|
|
|
|
| 122 |
orchestrator: Orchestrator = cl.user_session.get("orchestrator")
|
| 123 |
|
| 124 |
# Check if we're waiting for clarification answers
|
| 125 |
+
# If NOT waiting for clarification, this is a NEW task - reset orchestrator
|
| 126 |
+
if not cl.user_session.get("waiting_for_clarification"):
|
| 127 |
+
# Create fresh orchestrator for new tasks
|
| 128 |
+
orchestrator = Orchestrator(max_iterations=10)
|
| 129 |
+
cl.user_session.set("orchestrator", orchestrator)
|
| 130 |
+
print("[CHAINLIT] Created fresh orchestrator for new task")
|
| 131 |
if cl.user_session.get("waiting_for_clarification"):
|
| 132 |
cl.user_session.set("waiting_for_clarification", False)
|
| 133 |
user_answers = message.content
|