From 3b0b297a67c0ecbf03ff77706cb4b2c70d5ccc90 Mon Sep 17 00:00:00 2001 From: mijauexe Date: Thu, 26 Jun 2025 13:54:04 +0200 Subject: [PATCH 1/4] Fix reloading in many occasions --- core/agents/architect.py | 1 + core/agents/frontend.py | 6 +++++- core/agents/spec_writer.py | 19 ++++++++++++++----- core/agents/tech_lead.py | 1 + core/cli/main.py | 11 +++++++---- core/ui/console.py | 2 +- 6 files changed, 29 insertions(+), 11 deletions(-) diff --git a/core/agents/architect.py b/core/agents/architect.py index 008f44c9da..196c3c7e07 100644 --- a/core/agents/architect.py +++ b/core/agents/architect.py @@ -114,6 +114,7 @@ class Architect(BaseAgent): { "title": "Setting up backend", "project_state_id": "be_0", + "disallow_reload": True, "labels": ["E2 / T2", "Backend setup", "done"], } ] diff --git a/core/agents/frontend.py b/core/agents/frontend.py index 5ac1580ec4..14c9ba9c87 100644 --- a/core/agents/frontend.py +++ b/core/agents/frontend.py @@ -189,6 +189,7 @@ class Frontend(FileDiffMixin, GitMixin, BaseAgent): if answer.button == "yes": fe_states = await self.state_manager.get_fe_states() first_fe_state_id = fe_states[0].id if fe_states else None + last_fe_state_id = fe_states[-1].id if fe_states else None await self.ui.clear_main_logs() await self.ui.send_front_logs_headers( @@ -201,6 +202,8 @@ class Frontend(FileDiffMixin, GitMixin, BaseAgent): { "title": "Building frontend", "project_state_id": str(first_fe_state_id) if first_fe_state_id else "fe_0", + "start_id": str(first_fe_state_id) if first_fe_state_id else "fe_0", + "end_id": str(last_fe_state_id) if last_fe_state_id else "fe_0", "labels": ["E2 / T1", "Frontend", "done"], } ] @@ -209,12 +212,13 @@ class Frontend(FileDiffMixin, GitMixin, BaseAgent): [ { "title": "Setting up backend", + "disallow_reload": True, "project_state_id": "be_0", "labels": ["E2 / T2", "Backend setup", "working"], } ] ) - await self.ui.send_front_logs_headers("be_0", ["E2 / T2", "working"], "Setting up backend") + await self.ui.send_front_logs_headers("", ["E2 / T2", "working"], "Setting up backend") return True else: return False diff --git a/core/agents/spec_writer.py b/core/agents/spec_writer.py index 102f7d75c4..9b942f270b 100644 --- a/core/agents/spec_writer.py +++ b/core/agents/spec_writer.py @@ -74,7 +74,7 @@ class SpecWriter(BaseAgent): [ { "title": "", - "project_state_id": "first_state", + "project_state_id": "spec", "labels": [""], "convo": [ {"role": "assistant", "content": "Please describe the app you want to build."}, @@ -113,7 +113,7 @@ class SpecWriter(BaseAgent): [ { "title": "Writing Specification", - "project_state_id": self.current_state.id, + "project_state_id": "spec", "labels": ["E1 / T1", "Specs", "working"], "disallow_reload": True, } @@ -133,8 +133,7 @@ class SpecWriter(BaseAgent): initial_prompt=description, ) - # await self.ui.set_important_stream() - llm_assisted_description = await llm(convo) + llm_assisted_description = "todo app" # await llm(convo) await self.ui.send_project_stage({"stage": ProjectStage.PROJECT_NAME}) @@ -219,8 +218,18 @@ class SpecWriter(BaseAgent): [ { "title": "Writing Specification", - "project_state_id": self.current_state.id, + "project_state_id": "spec", # self.current_state.id, "labels": ["E1 / T1", "Specs", "done"], + "convo": [ + { + "role": "assistant", + "content": "What do you want to build?", + }, + { + "role": "user", + "content": self.current_state.specification.original_description, + }, + ], "disallow_reload": True, } ] diff --git a/core/agents/tech_lead.py b/core/agents/tech_lead.py index 15580254f4..c57ed463df 100644 --- a/core/agents/tech_lead.py +++ b/core/agents/tech_lead.py @@ -423,6 +423,7 @@ class TechLead(RelevantFilesMixin, BaseAgent): self.next_state.flag_tasks_as_modified() self.next_state.flag_epics_as_modified() + await self.ui.clear_main_logs() await self.ui.send_project_stage( { "stage": ProjectStage.STARTING_TASK, diff --git a/core/cli/main.py b/core/cli/main.py index 3492869075..58657fb743 100644 --- a/core/cli/main.py +++ b/core/cli/main.py @@ -135,7 +135,7 @@ async def start_new_project(sm: StateManager, ui: UIBase, args: Namespace = None [ { "title": "", - "project_state_id": "first_state", + "project_state_id": "spec", "labels": [""], "convo": [{"role": "assistant", "content": "Please describe the app you want to build."}], } @@ -213,14 +213,17 @@ async def run_pythagora_session(sm: StateManager, ui: UIBase, args: Namespace): if sm.current_state.specification and sm.current_state.specification.original_description: await ui.send_front_logs_headers( - "", ["E1 / T1", "Writing Specification", "working"], "Writing Specification", "" + "", + ["E1 / T1", "Writing Specification", "working" if fe_states == [] else "done"], + "Writing Specification", + "", ) await ui.send_back_logs( [ { "project_state_id": "spec", "disallow_reload": True, - "labels": ["E1 / T1", "Spec", "working" if fe_states == [] else "done"], + "labels": ["E1 / T1", "Specs", "working" if fe_states == [] else "done"], "title": "Writing Specification", "convo": [ { @@ -247,7 +250,7 @@ async def run_pythagora_session(sm: StateManager, ui: UIBase, args: Namespace): if fe_states: status = "working" if fe_states[-1].action != FE_ITERATION_DONE else "done" - await ui.send_front_logs_headers("setup", ["E2 / T1", "Frontend", status], "Building Frontend", "") + await ui.send_front_logs_headers(fe_states[0].id, ["E2 / T1", "Frontend", status], "Building Frontend", "") await ui.send_back_logs( [ { diff --git a/core/ui/console.py b/core/ui/console.py index ce09d16aad..ed7cead0ea 100644 --- a/core/ui/console.py +++ b/core/ui/console.py @@ -235,7 +235,7 @@ class PlainConsoleUI(UIBase): async def import_project(self, project_dir: str): pass - async def set_important_stream(self): + async def set_important_stream(self, important_stream: bool = True): pass async def start_breakdown_stream(self): From 38c2e43052659b7306b313c2cab85b571a140a57 Mon Sep 17 00:00:00 2001 From: mijauexe Date: Thu, 26 Jun 2025 13:58:41 +0200 Subject: [PATCH 2/4] Revert change in spec_writer --- core/agents/spec_writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/agents/spec_writer.py b/core/agents/spec_writer.py index 9b942f270b..c34725b2b0 100644 --- a/core/agents/spec_writer.py +++ b/core/agents/spec_writer.py @@ -133,7 +133,7 @@ class SpecWriter(BaseAgent): initial_prompt=description, ) - llm_assisted_description = "todo app" # await llm(convo) + llm_assisted_description = await llm(convo) await self.ui.send_project_stage({"stage": ProjectStage.PROJECT_NAME}) From 5c7fd9d364ff94e010a56cd75c37dc222f7c713a Mon Sep 17 00:00:00 2001 From: mijauexe Date: Thu, 26 Jun 2025 15:01:16 +0200 Subject: [PATCH 3/4] End id of task is now a state before its end (before next task question) --- core/agents/developer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/agents/developer.py b/core/agents/developer.py index 2c69d9a74d..bb9d446cb3 100644 --- a/core/agents/developer.py +++ b/core/agents/developer.py @@ -381,7 +381,7 @@ class Developer(ChatWithBreakdownMixin, RelevantFilesMixin, BaseAgent): "title": previous_task["description"], "project_state_id": str(task_convo[0].id) if task_convo else "be_0", "start_id": str(task_convo[0].id) if task_convo else "be_0", - "end_id": str(task_convo[-1].id) if task_convo else "be_0", + "end_id": str(task_convo[-1].prev_state_id) if task_convo else "be_0", "labels": [f"E{e_i} / T{t_i}", "Backend", "done"], } ] From 98821e51d22a98f4a58458c43fd7ff7f0f98c869 Mon Sep 17 00:00:00 2001 From: mijauexe Date: Thu, 26 Jun 2025 15:43:36 +0200 Subject: [PATCH 4/4] Fix set_important_stream definition --- core/ui/base.py | 2 +- core/ui/virtual.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/ui/base.py b/core/ui/base.py index 3f02df41ce..3f4c2af14d 100644 --- a/core/ui/base.py +++ b/core/ui/base.py @@ -375,7 +375,7 @@ class UIBase: """ raise NotImplementedError() - async def set_important_stream(self, path: str): + async def set_important_stream(self, important_stream: bool = True): """ Tell the extension that next stream should be visible and rendered as markdown diff --git a/core/ui/virtual.py b/core/ui/virtual.py index 987198e080..37ad93b3ca 100644 --- a/core/ui/virtual.py +++ b/core/ui/virtual.py @@ -172,7 +172,7 @@ class VirtualUI(UIBase): async def send_project_info(self, name: str, project_id: str, folder_name: str, created_at: str): pass - async def set_important_stream(self): + async def set_important_stream(self, important_stream: bool = True): pass async def start_breakdown_stream(self):