fix(agents): strictly distinguish Coder subagent prompts from Lead notification events
This commit is contained in:
@@ -276,20 +276,29 @@ class RealtimeRPGHandler(http.server.SimpleHTTPRequestHandler):
|
||||
except:
|
||||
pass
|
||||
|
||||
# Determine true session role by inspecting the actual initial user prompt
|
||||
user_prompts = []
|
||||
for l in lines:
|
||||
try:
|
||||
p = json.loads(l)
|
||||
if p.get('payload', {}).get('type') == 'message' and p.get('payload', {}).get('role') == 'user':
|
||||
txt = p.get('payload', {}).get('content', [{}])[0].get('text', '')
|
||||
if not txt.startswith("<recommended_plugins>"):
|
||||
session_prompt = txt
|
||||
if "coder für issue" in txt.lower() or "du bist der coder" in txt.lower() or "openclaw-coder" in txt.lower():
|
||||
session_role = "coder"
|
||||
elif "review" in txt.lower() and ("du bist der" in txt.lower() or "qa" in txt.lower()):
|
||||
session_role = "reviewer"
|
||||
if not txt.startswith("<recommended_plugins>") and not txt.startswith("OpenClaw assembled context"):
|
||||
user_prompts.append(txt)
|
||||
except:
|
||||
pass
|
||||
|
||||
first_prompt = user_prompts[0] if user_prompts else ""
|
||||
if first_prompt.startswith("Du bist der Coder") or "Du bist der Coder für" in first_prompt:
|
||||
session_role = "coder"
|
||||
session_prompt = first_prompt
|
||||
elif "review" in first_prompt.lower() and ("du bist der reviewer" in first_prompt.lower() or "qa" in first_prompt.lower()):
|
||||
session_role = "reviewer"
|
||||
session_prompt = first_prompt
|
||||
else:
|
||||
session_role = "lead"
|
||||
session_prompt = first_prompt or "Heartbeat / Backlog Monitoring"
|
||||
|
||||
# Map to specific agent
|
||||
if session_role == "coder" and not coder_session_active:
|
||||
if not is_completed and age_seconds < 60:
|
||||
|
||||
Reference in New Issue
Block a user