fix: render markdown in assistant panels and speed up reasoning-only recovery
Assistant message panels now use Markdown() instead of raw strings, so bold/italic/lists render properly. Also nudge the model immediately after tool errors instead of wasting 2 retry iterations in reasoning-only mode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -153,7 +153,14 @@ class AgentLoop:
|
||||
reasoning_only_streak += 1
|
||||
self._ctx.pop_last_message()
|
||||
|
||||
if reasoning_only_streak >= _MAX_REASONING_RETRIES:
|
||||
# If the last context messages are tool errors, nudge immediately
|
||||
# rather than wasting retries — the model is likely confused by the error.
|
||||
has_recent_tool_error = any(
|
||||
m.role == "tool" and m.content and m.content.startswith("Unknown ")
|
||||
for m in self._ctx.get_history()[-3:]
|
||||
)
|
||||
|
||||
if has_recent_tool_error or reasoning_only_streak >= _MAX_REASONING_RETRIES:
|
||||
# Nudge the model by injecting a user hint
|
||||
if self._display:
|
||||
self._display.write_warning(
|
||||
@@ -162,7 +169,7 @@ class AgentLoop:
|
||||
)
|
||||
self._ctx.add_message(
|
||||
"user",
|
||||
"Please respond with your answer. Do not just think — provide your actual response.",
|
||||
"Please respond with your answer. If a tool call failed, briefly explain what happened and continue.",
|
||||
)
|
||||
reasoning_only_streak = 0
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user