God Agent CI commited on
Commit
1da73ff
·
1 Parent(s): d78bb58

fix: Python 3.11 SyntaxError in debug_agent.py - backslash in f-string expression

Browse files

- Fixed analyze_error() and self_heal_loop() - removed backslash from f-string expressions
- Used string concatenation instead for Python 3.11 compatibility
- Updated Dockerfile to clear pycache on build
- Synced latest agents from main repo

Root cause: f-strings with backslash in expression part not allowed in Python < 3.12
Fix: Changed f-string with backslash to string concatenation

Files changed (3) hide show
  1. Dockerfile +3 -0
  2. README.md +13 -0
  3. agents/debug_agent.py +21 -16
Dockerfile CHANGED
@@ -14,6 +14,9 @@ RUN pip install --no-cache-dir -r requirements.txt
14
  # Copy backend source
15
  COPY . .
16
 
 
 
 
17
  # Workspace dir
18
  RUN mkdir -p /tmp/god_workspace
19
 
 
14
  # Copy backend source
15
  COPY . .
16
 
17
+ # Remove pycache to avoid stale bytecode
18
+ RUN find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
19
+
20
  # Workspace dir
21
  RUN mkdir -p /tmp/god_workspace
22
 
README.md CHANGED
@@ -14,3 +14,16 @@ short_description: Autonomous Engineering OS — Manus + Genspark + Devin
14
  **Autonomous Engineering Platform — Manus + Genspark + Devin (OneHand)**
15
 
16
  16-agent system for autonomous software engineering.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  **Autonomous Engineering Platform — Manus + Genspark + Devin (OneHand)**
15
 
16
  16-agent system for autonomous software engineering.
17
+
18
+ ## Features
19
+ - 16 specialized AI agents
20
+ - Multi-model AI routing (OpenAI → Groq → Anthropic)
21
+ - Real-time WebSocket streaming
22
+ - Autonomous code generation, debugging, and deployment
23
+ - File system management and Git operations
24
+
25
+ ## API Endpoints
26
+ - `GET /` — Status
27
+ - `GET /api/docs` — Swagger UI
28
+ - `POST /api/v1/tasks/` — Create task
29
+ - `WS /ws/chat/{session_id}` — Chat WebSocket
agents/debug_agent.py CHANGED
@@ -44,12 +44,12 @@ class DebugAgent(BaseAgent):
44
  messages = [
45
  {"role": "system", "content": DEBUG_SYSTEM},
46
  {"role": "user", "content": (
47
- f"Debug and fix this issue (attempt {attempt}):\n\n"
48
- f"{task}\n\n"
49
- f"Provide:\n"
50
- f"1. Root cause analysis\n"
51
- f"2. Exact fix (code/config)\n"
52
- f"3. Prevention strategy"
53
  )},
54
  ]
55
 
@@ -71,14 +71,19 @@ class DebugAgent(BaseAgent):
71
 
72
  async def analyze_error(self, error_output: str, source_code: str = "", task_id: str = "", session_id: str = "") -> Dict:
73
  """Deep error analysis with structured output."""
 
 
 
 
 
74
  messages = [
75
  {"role": "system", "content": DEBUG_SYSTEM},
76
  {"role": "user", "content": (
77
- f"Analyze this error and provide structured diagnosis:\n\n"
78
- f"Error:\n{error_output[:2000]}\n\n"
79
- f"{'Source Code:\\n```\\n' + source_code[:1000] + '\\n```' if source_code else ''}\n\n"
80
- f"Respond with JSON:\n"
81
- f'{{"error_type": "...", "root_cause": "...", "fix": "...", "prevention": "...", "severity": "low|medium|high|critical"}}'
82
  )},
83
  ]
84
  raw = await self.llm(messages, task_id=task_id, session_id=session_id, temperature=0.1, max_tokens=1000)
@@ -111,10 +116,10 @@ class DebugAgent(BaseAgent):
111
  messages = [
112
  {"role": "system", "content": DEBUG_SYSTEM},
113
  {"role": "user", "content": (
114
- f"Fix attempt {attempt}/{max_retries}:\n\n"
115
- f"Error: {current_error}\n\n"
116
- f"Code:\n```\n{current_code[:3000]}\n```\n\n"
117
- f"Return ONLY the fixed code."
118
  )},
119
  ]
120
 
@@ -143,7 +148,7 @@ class DebugAgent(BaseAgent):
143
  compile(code, "<string>", "exec")
144
  return {"valid": True, "error": ""}
145
  except SyntaxError as e:
146
- return {"valid": False, "error": f"SyntaxError: {e}"}
147
  except Exception as e:
148
  return {"valid": False, "error": str(e)}
149
 
 
44
  messages = [
45
  {"role": "system", "content": DEBUG_SYSTEM},
46
  {"role": "user", "content": (
47
+ "Debug and fix this issue (attempt " + str(attempt) + "):\n\n"
48
+ + task + "\n\n"
49
+ "Provide:\n"
50
+ "1. Root cause analysis\n"
51
+ "2. Exact fix (code/config)\n"
52
+ "3. Prevention strategy"
53
  )},
54
  ]
55
 
 
71
 
72
  async def analyze_error(self, error_output: str, source_code: str = "", task_id: str = "", session_id: str = "") -> Dict:
73
  """Deep error analysis with structured output."""
74
+ if source_code:
75
+ source_section = "Source Code:\n```\n" + source_code[:1000] + "\n```"
76
+ else:
77
+ source_section = ""
78
+
79
  messages = [
80
  {"role": "system", "content": DEBUG_SYSTEM},
81
  {"role": "user", "content": (
82
+ "Analyze this error and provide structured diagnosis:\n\n"
83
+ "Error:\n" + error_output[:2000] + "\n\n"
84
+ + source_section + "\n\n"
85
+ "Respond with JSON:\n"
86
+ '{"error_type": "...", "root_cause": "...", "fix": "...", "prevention": "...", "severity": "low|medium|high|critical"}'
87
  )},
88
  ]
89
  raw = await self.llm(messages, task_id=task_id, session_id=session_id, temperature=0.1, max_tokens=1000)
 
116
  messages = [
117
  {"role": "system", "content": DEBUG_SYSTEM},
118
  {"role": "user", "content": (
119
+ "Fix attempt " + str(attempt) + "/" + str(max_retries) + ":\n\n"
120
+ "Error: " + current_error + "\n\n"
121
+ "Code:\n```\n" + current_code[:3000] + "\n```\n\n"
122
+ "Return ONLY the fixed code."
123
  )},
124
  ]
125
 
 
148
  compile(code, "<string>", "exec")
149
  return {"valid": True, "error": ""}
150
  except SyntaxError as e:
151
+ return {"valid": False, "error": "SyntaxError: " + str(e)}
152
  except Exception as e:
153
  return {"valid": False, "error": str(e)}
154