fix: polish WebUI assistant replies - #3138
1 commit merged into
Conversation
SummaryRead the diff on PR #3138 plus Code reference
_WEBUI_PROGRESS_PROMPT = """
WebUI progress guidance:
- ...
- 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()And the new sync-path injection at from api.streaming import (
_WEBUI_PROGRESS_PROMPT,
...
)
workspace_system_msg = (
f"Active workspace at session start: {s.workspace}\n"
... existing workspace tag instructions ...
"Never fall back to a hardcoded path when this tag is present.\n\n"
f"{_WEBUI_PROGRESS_PROMPT}"
)DiagnosisTwo observations worth raising before merge — neither is a blocker. 1. Streaming vs sync path use different injection mechanisms. In the streaming path the progress prompt is set on 2. The guard is purely a prompt-level instruction. The PR description acknowledges this and that's correct — there's no output sanitizer. Models that ignore the instruction will still emit "Need inspect email" as visible text. The PR is the right first fix (cheapest place to enforce), but expect to need a small bounded sanitizer (regex-match a leading "Need " or "maybe " fragment at the start of a visible delta and either drop it or treat it as scratchpad). Worth filing as a follow-up issue rather than expanding this PR. Test coverage
assert "Do not include terse planning fragments" in prompt
assert "Need inspect email" in prompt
assert "clear user-facing progress" in promptThat confirms the prompt builder includes the new bullet, but it doesn't exercise the sync path's CI green across 3.11/3.12/3.13. The risk profile is genuinely low. LGTM with the caching-semantics note above as a follow-up. |
1ebd160
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
Thinking Path
What Changed
/api/chatpath so both WebUI chat paths get the same final-answer polish instruction.Why It Matters
Users should see clear, readable final answers and progress updates, not internal shorthand such as "Need inspect email" or "maybe invite" at the start of assistant replies.
Verification
python -m py_compile api/routes.py api/streaming.pypython -m pytest tests/test_webui_surface_context.py -qgit diff --checkRisks / Follow-ups