Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdded a post-loop guard log in the agent loop that emits an error when the iteration count reached or exceeded Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
main/agent/agent_loop.c (1)
308-312: LGTM! Clear improvement to error messaging.The condition
iteration >= MIMI_AGENT_MAX_TOOL_ITERcorrectly identifies when the loop exited due to hitting the max iterations limit vs. other errors (LLM failure). The logic is consistent with the loop conditionwhile (iteration < MIMI_AGENT_MAX_TOOL_ITER)at line 218.Optional: Consider adding an
ESP_LOGWwhen max iterations is reached for server-side observability/debugging:💡 Optional logging enhancement
if (iteration >= MIMI_AGENT_MAX_TOOL_ITER) { + ESP_LOGW(TAG, "Reached max tool iterations (%d) without final response for %s:%s", + MIMI_AGENT_MAX_TOOL_ITER, msg.channel, msg.chat_id); out.content = strdup("Sorry, I reached the maximum number of tool iterations without completing the response."); } else {,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@main/agent/agent_loop.c` around lines 308 - 312, Add a warning log when the loop exits due to hitting the max tool iterations: inside the existing branch that checks iteration >= MIMI_AGENT_MAX_TOOL_ITER (the same block that sets out.content to the "maximum number of tool iterations" message), call ESP_LOGW (or the project's logging macro) with context including the current iteration and MIMI_AGENT_MAX_TOOL_ITER to aid server-side observability; keep the existing out.content behavior unchanged and place the log next to that strdup to ensure it's executed in the same failure path (refer to variables iteration, MIMI_AGENT_MAX_TOOL_ITER, and out.content and the while (iteration < MIMI_AGENT_MAX_TOOL_ITER) loop in agent_loop.c).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@main/agent/agent_loop.c`:
- Around line 308-312: Add a warning log when the loop exits due to hitting the
max tool iterations: inside the existing branch that checks iteration >=
MIMI_AGENT_MAX_TOOL_ITER (the same block that sets out.content to the "maximum
number of tool iterations" message), call ESP_LOGW (or the project's logging
macro) with context including the current iteration and MIMI_AGENT_MAX_TOOL_ITER
to aid server-side observability; keep the existing out.content behavior
unchanged and place the log next to that strdup to ensure it's executed in the
same failure path (refer to variables iteration, MIMI_AGENT_MAX_TOOL_ITER, and
out.content and the while (iteration < MIMI_AGENT_MAX_TOOL_ITER) loop in
agent_loop.c).
|
What's your use case to hit this limits bro |
@crispyberry I let mimiclaw write and run micropython to do some simulation. It tried, failed and re-tried repeatively. Finally it hit this limit |
Fix: Add Reach Max Tool Iter Debug Info
Summary by CodeRabbit