Skip to content

Commit ad6962f

Browse files
committed
fix: save display_text instead of full_response to conversation logs
Fixes bug where only user input was being logged in session saves. The issue was that we were displaying 'display_text' (harmony-formatted response) to the user, but saving 'full_response' (raw text) to logs. With harmony responses, if token extraction doesn't work but display does, full_response could be empty while display_text has content. Changes: - Save display_text to conversation_history (line 1485) - Update self.last_response to use display_text (line 1366) - Ensures logs match what user sees on screen This makes the behavior consistent: what you see is what gets saved.
1 parent d36b54b commit ad6962f

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/basic_agent_chat_loop/chat_loop.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,6 @@ async def _stream_agent_response(self, query: str) -> dict[str, Any]:
13331333

13341334
# Render collected response
13351335
full_response = "".join(response_text)
1336-
self.last_response = full_response
13371336

13381337
# Process through Harmony if available
13391338
display_text = full_response
@@ -1363,6 +1362,9 @@ async def _stream_agent_response(self, query: str) -> dict[str, Any]:
13631362
if processed.get("has_tools"):
13641363
logger.debug("Harmony response contains tool calls")
13651364

1365+
# Store last response for copy commands (what user sees)
1366+
self.last_response = display_text
1367+
13661368
if self.use_rich and display_text.strip() and self.console:
13671369
# Use rich markdown rendering
13681370
print() # New line after agent name
@@ -1482,7 +1484,7 @@ async def _stream_agent_response(self, query: str) -> dict[str, Any]:
14821484
{
14831485
"timestamp": time.time(),
14841486
"query": query,
1485-
"response": full_response,
1487+
"response": display_text, # Save what user sees (includes harmony formatting)
14861488
"duration": duration,
14871489
"usage": usage_info,
14881490
}

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)