feat(rpg): dynamically display parallel coder instance count (x2, x3) on active dev desk
This commit is contained in:
@@ -232,9 +232,8 @@ class RealtimeRPGHandler(http.server.SimpleHTTPRequestHandler):
|
||||
lead_last_pulse_seconds = 999
|
||||
lead_recent_logs = []
|
||||
|
||||
coder_session_active = False
|
||||
coder_task_desc = ""
|
||||
coder_recent_logs = []
|
||||
coder_sessions = []
|
||||
active_coder_count = 0
|
||||
|
||||
try:
|
||||
search_patterns = [
|
||||
@@ -248,7 +247,7 @@ class RealtimeRPGHandler(http.server.SimpleHTTPRequestHandler):
|
||||
|
||||
rollout_files = sorted(all_rollout_files, key=os.path.getmtime, reverse=True)
|
||||
|
||||
for rf in rollout_files[:10]:
|
||||
for rf in rollout_files[:15]:
|
||||
age_seconds = round(time.time() - os.path.getmtime(rf), 1)
|
||||
with open(rf, 'r') as fp:
|
||||
lines = fp.readlines()
|
||||
@@ -300,11 +299,14 @@ class RealtimeRPGHandler(http.server.SimpleHTTPRequestHandler):
|
||||
session_prompt = first_prompt or "Heartbeat / Backlog Monitoring"
|
||||
|
||||
# Map to specific agent
|
||||
if session_role == "coder" and not coder_session_active:
|
||||
if session_role == "coder":
|
||||
if not is_completed and age_seconds < 60:
|
||||
coder_session_active = True
|
||||
coder_task_desc = session_prompt[:120]
|
||||
coder_recent_logs = recent_logs
|
||||
active_coder_count += 1
|
||||
coder_sessions.append({
|
||||
"task": session_prompt[:120],
|
||||
"logs": recent_logs,
|
||||
"age": age_seconds
|
||||
})
|
||||
elif session_role == "lead" and not lead_heartbeat_active:
|
||||
lead_last_pulse_seconds = age_seconds
|
||||
if not is_completed and age_seconds < 60:
|
||||
@@ -321,23 +323,27 @@ class RealtimeRPGHandler(http.server.SimpleHTTPRequestHandler):
|
||||
status["lead_heartbeat"] = {"error": str(e), "is_beating": False, "last_pulse_seconds_ago": 999}
|
||||
|
||||
# 4. Derive Agent RPG States STRICTLY for target_project
|
||||
# Coder 1
|
||||
# Coder 1 (supports multi-instance count x2, x3)
|
||||
if "coder-tasks" in latest_active_tasks:
|
||||
task = latest_active_tasks["coder-tasks"]
|
||||
status["agents"]["coder1"]["state"] = "WORKING"
|
||||
status["agents"]["coder1"]["currentTask"] = f"Task #{task.get('issueNumber', '')}: {task.get('title', 'Coding')}"
|
||||
status["agents"]["coder1"]["lastAction"] = "BullMQ: Active Code Session"
|
||||
status["agents"]["coder1"]["liveLog"] = ["git checkout feature-branch", "npm run test", "git commit -m 'feat: implementation'"]
|
||||
elif coder_session_active:
|
||||
status["agents"]["coder1"]["parallelCount"] = max(1, active_coder_count)
|
||||
elif active_coder_count > 0:
|
||||
status["agents"]["coder1"]["state"] = "WORKING"
|
||||
status["agents"]["coder1"]["currentTask"] = f"Aktiv: {coder_task_desc or 'Coding Session'}"
|
||||
status["agents"]["coder1"]["lastAction"] = "OpenClaw Coder Turn Active"
|
||||
status["agents"]["coder1"]["liveLog"] = coder_recent_logs or ["Implementing feature / bugfix..."]
|
||||
primary_coder = coder_sessions[0]
|
||||
status["agents"]["coder1"]["currentTask"] = f"Aktiv ({active_coder_count}x): {primary_coder['task'] or 'Coding Session'}"
|
||||
status["agents"]["coder1"]["lastAction"] = f"OpenClaw Coder Turn ({active_coder_count} parallel)"
|
||||
status["agents"]["coder1"]["liveLog"] = primary_coder["logs"] or ["Implementing feature / bugfix..."]
|
||||
status["agents"]["coder1"]["parallelCount"] = active_coder_count
|
||||
else:
|
||||
status["agents"]["coder1"]["state"] = "IDLE"
|
||||
status["agents"]["coder1"]["currentTask"] = f"Keine offenen Tasks in {target_project}"
|
||||
status["agents"]["coder1"]["lastAction"] = "Idle / Bereit"
|
||||
status["agents"]["coder1"]["liveLog"] = ["Wartet auf neue Queue-Aufgaben..."]
|
||||
status["agents"]["coder1"]["parallelCount"] = 0
|
||||
|
||||
# Coder 2 (Tester / Staging)
|
||||
if "tester-tasks" in latest_active_tasks or "deployments" in latest_active_tasks:
|
||||
|
||||
Reference in New Issue
Block a user