From 3c2f98eb23d39368a84d7d6549ead577b30b532e Mon Sep 17 00:00:00 2001 From: AJV20 <24819659+AJV20@users.noreply.github.com> Date: Fri, 29 May 2026 13:01:14 -0400 Subject: [PATCH] fix: polish WebUI assistant replies --- CHANGELOG.md | 4 ++++ api/routes.py | 4 +++- api/streaming.py | 1 + tests/test_webui_surface_context.py | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93da0a58..50daeaca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ ## [Unreleased] +### Changed + +- WebUI chat instructions now explicitly prevent terse scratchpad/planning fragments from appearing in visible assistant replies, while still allowing clear user-facing progress updates during tool-heavy work. + ## [v0.51.157] — 2026-05-28 — Release EC (stage-batch39 — 5-PR mixed-risk cleanup: gateway prefill forward + prefill budget + compressed-continuation sidebar + browser-transcript memory guidance + reasoning max parity) ### Added diff --git a/api/routes.py b/api/routes.py index 768b499b..7d428dde 100644 --- a/api/routes.py +++ b/api/routes.py @@ -9628,6 +9628,7 @@ def _handle_chat_sync(handler, body): session_id=s.session_id, ) from api.streaming import ( + _WEBUI_PROGRESS_PROMPT, _dedupe_replayed_context_messages, _merge_display_messages_after_agent_result, _restore_display_reasoning_metadata, @@ -9646,7 +9647,8 @@ def _handle_chat_sync(handler, body): "prompt, memory, or conversation history. Always use the value from the most recent " "[Workspace::v1: ...] tag as your default working directory for ALL file operations: " "write_file, read_file, search_files, terminal workdir, and patch. " - "Never fall back to a hardcoded path when this tag is present." + "Never fall back to a hardcoded path when this tag is present.\n\n" + f"{_WEBUI_PROGRESS_PROMPT}" ) _previous_messages = list(s.messages or []) diff --git a/api/streaming.py b/api/streaming.py index 70087bd5..980d1455 100644 --- a/api/streaming.py +++ b/api/streaming.py @@ -203,6 +203,7 @@ WebUI progress guidance: - Each update should say what you are about to check, what you just confirmed, or why the next tool call is needed. - Keep updates concise, factual, and in the user's language. One or two short sentences are enough. - Do not reveal hidden reasoning, chain-of-thought, private scratchpads, secrets, raw logs, or long tool output. +- Do not include terse planning fragments or scratchpad shorthand in visible assistant text. Avoid fragments like "Need check logs", "Need inspect email", or "maybe invite"; either omit them or rewrite them as clear user-facing progress. - For direct answers or very short tasks, skip progress updates and answer normally. """.strip() diff --git a/tests/test_webui_surface_context.py b/tests/test_webui_surface_context.py index 562347c5..89f65040 100644 --- a/tests/test_webui_surface_context.py +++ b/tests/test_webui_surface_context.py @@ -22,6 +22,9 @@ def test_webui_ephemeral_prompt_includes_browser_surface_context(): assert "Do not copy or dump this browser transcript" in prompt assert "explicit captures" in prompt assert "durable user preferences" in prompt + assert "Do not include terse planning fragments" in prompt + assert "Need inspect email" in prompt + assert "clear user-facing progress" in prompt def test_webui_ephemeral_prompt_skips_empty_surface_fields():