From 791fe314830c160b0d1fc8bea34a57d36845ae9b Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 11 Jan 2026 08:19:40 +0000 Subject: [PATCH] Fix double-encoded JSON in Plan JSON display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parse nested plan_json field before displaying to avoid escaped newlines. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- server.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 866a6cf..e50b841 100644 --- a/server.py +++ b/server.py @@ -1589,7 +1589,14 @@ async def run_plan_visualization(run_id: str, request: Request): ''' # Add collapsible Plan JSON section - plan_json_str = json.dumps(plan_data, indent=2) + # Parse nested plan_json if present (it's double-encoded as a string) + display_plan = plan_data.copy() + if "plan_json" in display_plan and isinstance(display_plan["plan_json"], str): + try: + display_plan["plan_json"] = json.loads(display_plan["plan_json"]) + except json.JSONDecodeError: + pass + plan_json_str = json.dumps(display_plan, indent=2) # Escape HTML entities in JSON plan_json_str = plan_json_str.replace("&", "&").replace("<", "<").replace(">", ">") content += f'''