From 468dcf04095792555bbaf8d136b79c02ff3fc1a3 Mon Sep 17 00:00:00 2001 From: Col0ring <1561999073@qq.com> Date: Thu, 29 Oct 2026 11:59:11 +0800 Subject: [PATCH] fix(webui): drop the inherited plan when a fork copied none - point a forked message at the branch plan only when that file exists --- webui/backend/app/backends/ms_agent/sessions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webui/backend/app/backends/ms_agent/sessions.py b/webui/backend/app/backends/ms_agent/sessions.py index 30f5f1ad7..cd41b2b91 100644 --- a/webui/backend/app/backends/ms_agent/sessions.py +++ b/webui/backend/app/backends/ms_agent/sessions.py @@ -390,7 +390,12 @@ def list_messages(sid: str) -> list[SessionMessage]: title=source.name if source else origin["title"], assistant_seq=origin["assistant_seq"], available=source is not None) if origin and message.plan_file and message.log_seq is not None and message.log_seq <= origin["assistant_seq"]: - message.plan_file = str(sm.sessions_dir / session.id / "plan.md") + # The branch only has a plan when the forked prefix carried a + # todo_write snapshot (ms_agent.project.fork._copy_plan); a + # render-only turn leaves none, and pointing at a missing file + # would show an empty plan chip. + inherited = sm.sessions_dir / session.id / "plan.md" + message.plan_file = str(inherited) if inherited.exists() else None # A turn in flight has its finished rounds on disk AND replayed on the live # stream. Flag the trailing message so an attached viewer drops this copy # and renders the turn once, not twice.