Skip to content

Fix plain text response logs - #1729

Open
TriTechAI wants to merge 2 commits into
agent0ai:mainfrom
TriTechAI:fix/plain-text-response-logs
Open

Fix plain text response logs#1729
TriTechAI wants to merge 2 commits into
agent0ai:mainfrom
TriTechAI:fix/plain-text-response-logs

Conversation

@TriTechAI

Copy link
Copy Markdown

Summary

Fixes #1708.

  • Add a monologue_end fallback extension that creates a type=response log entry when the final AI response was saved to history but no live response log was produced.
  • Preserve existing live-response behavior by skipping the fallback when log_item_response already exists.
  • Avoid logging ordinary non-response tool-call JSON as user-visible response text.

Context

Some models return final answers as plain text instead of the expected {"tool_name":"response","tool_args":{"text":"..."}} response-tool JSON. In that path, the answer is saved to history, but the WebUI never receives a type=response log entry, so users can be left seeing only the last “Calling LLM...” entry.

This change keeps the streaming parser path unchanged and adds a narrow fallback after streaming has ended, using the latest AI history message as the source of truth.

Testing

  • python3 -m py_compile extensions/python/monologue_end/_85_ensure_response_log.py tests/test_response_log_fallback.py
  • Ran the new async regression cases through a lightweight local import harness:
    • plain-text AI response creates a response log
    • existing live response log is not duplicated
    • non-response tool-call JSON is not logged as response text

Blocked locally:

  • python3 -m pytest tests/test_response_log_fallback.py
  • Result: local Python environment does not have pytest installed (No module named pytest)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebUI doesn't display agent response when LLM outputs plain text instead of JSON tool call

1 participant