Merge pull request #197 from Pythagora-io/ENG-813

send task_id with front logs headers
This commit is contained in:
LeonOstrez
2025-06-09 15:30:28 +01:00
committed by GitHub
7 changed files with 25 additions and 16 deletions

View File

@@ -340,7 +340,10 @@ class Developer(ChatWithBreakdownMixin, RelevantFilesMixin, BaseAgent):
)
await self.ui.clear_main_logs()
await self.ui.send_front_logs_headers(
f"be_{task_index}_{task_index + 1}", [f"E{task_index} / T{task_index + 1}", "working"], description
f"be_{task_index}_{task_index + 1}",
[f"E{task_index} / T{task_index + 1}", "working"],
description,
self.current_state.current_task.get("id"),
)
await self.ui.send_back_logs(
[

View File

@@ -253,17 +253,15 @@ async def run_pythagora_session(sm: StateManager, ui: UIBase, args: Namespace):
)
if first_working_task:
await ui.send_front_logs_headers(
f"{sm.current_state.id}", first_working_task["labels"], first_working_task["title"]
first_working_task["start_id"],
first_working_task["labels"],
first_working_task["title"],
first_working_task["task_id"],
)
if be_back_logs:
await ui.send_back_logs(be_back_logs)
if any(label.lower() == "working" for label in first_working_task["labels"]):
await ui.send_front_logs_headers(
str(states_for_history[-1].id), first_working_task["labels"], first_working_task["title"]
)
if states_for_history:
convo = await load_convo(sm, args.project, args.branch, states_for_history)
await print_convo(ui, convo)

View File

@@ -907,17 +907,19 @@ class ProjectState(Base):
if task_id not in task_histories:
task_histories[task_id] = {}
task_histories[task_id]["taskId"] = task_id
task_histories[task_id]["task_id"] = task_id
task_histories[task_id]["title"] = task.get("description")
task_histories[task_id]["labels"] = []
task_histories[task_id]["status"] = task["status"]
task_histories[task_id]["start_id"] = state.id
task_histories[task_id]["end_id"] = state.id
if task.get("status") == TaskStatus.TODO:
task_histories[task_id]["status"] = TaskStatus.TODO
task_histories[task_id]["startId"] = state.id
task_histories[task_id]["endId"] = state.id
task_histories[task_id]["start_id"] = state.id
task_histories[task_id]["end_id"] = state.id
elif task.get("status") != task_histories[task_id]["status"]:
task_histories[task_id]["endId"] = state.id
task_histories[task_id]["end_id"] = state.id
task_histories[task_id]["status"] = task.get("status")
epic_num = task.get("sub_epic_id", "1")
@@ -935,15 +937,15 @@ class ProjectState(Base):
states_for_print = []
first_working_task = {}
# separate all elements from task_histories that have same startId and endId
# separate all elements from task_histories that have same start_id and end_id
for th in task_histories:
if task_histories[th].get("startId") == task_histories[th].get("endId"):
if task_histories[th].get("start_id") == task_histories[th].get("end_id"):
states_for_print = await ProjectState.get_task_conversation_project_states(
session, branch_id, UUID(task_histories[th]["taskId"]), True
session, branch_id, UUID(task_histories[th]["task_id"]), True
)
first_working_task = task_histories[th]
break
task_histories = {k: v for k, v in task_histories.items() if v.get("startId") != v.get("endId")}
task_histories = {k: v for k, v in task_histories.items() if v.get("start_id") != v.get("end_id")}
return task_histories, first_working_task, states_for_print
return list(task_histories.values()), first_working_task, states_for_print

View File

@@ -521,6 +521,7 @@ class UIBase:
project_state_id: str,
labels: list[str],
title: str,
task_id: Optional[str] = None,
):
"""
Send front conversation data to the UI.
@@ -528,6 +529,7 @@ class UIBase:
:param project_state_id: Project state ID.
:param labels: Array of label strings.
:param title: Conversation title.
:param task_id: Task ID.
"""
raise NotImplementedError()

View File

@@ -245,6 +245,7 @@ class PlainConsoleUI(UIBase):
project_state_id: str,
labels: list[str],
title: str,
task_id: Optional[str] = None,
):
pass

View File

@@ -626,6 +626,7 @@ class IPCClientUI(UIBase):
project_state_id: str,
labels: list[str],
title: str,
task_id: Optional[str] = None,
):
await self._send(
MessageType.FRONT_LOGS_HEADERS,
@@ -633,6 +634,7 @@ class IPCClientUI(UIBase):
"project_state_id": project_state_id,
"labels": labels,
"title": title,
"task_id": task_id,
},
)

View File

@@ -233,6 +233,7 @@ class VirtualUI(UIBase):
project_state_id: str,
labels: list[str],
title: str,
task_id: Optional[str] = None,
):
pass