fix(opencode): improve tool robustness and session loop stability#8134
fix(opencode): improve tool robustness and session loop stability#8134ostapus wants to merge 6 commits intoanomalyco:devfrom
Conversation
- Make 'description' optional in BashTool and TaskTool with smart fallbacks to prevent validation errors. - Provide explicit feedback for empty outputs in BashTool and ListTool (e.g., '(No files found)') to prevent model confusion. - Refine session loop exit condition: only stop if the model provides text or makes no tool calls, preventing premature exits on 'stop' finish reasons during tool-only turns. - Add enhanced logging for session lifecycle and tool execution debugging.
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: PR #1333: fix: make description parameter optional in bash tool This PR is relevant because it addresses the same issue mentioned in the current PR (PR #8134) - making the description field optional in the bash tool. However, PR #1333 appears to be older and may be a partial fix for one of the three issues addressed in the current PR. The current PR #8134 is a more comprehensive fix that builds upon this by also handling:
Conclusion: PR #1333 is related but not a duplicate—it's addressing one component that the current PR (8134) handles more comprehensively as part of a larger robustness improvement initiative. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
d6bdebe to
a3b3de6
Compare
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
This PR significantly improves the reliability and robustness of the AI agent execution loop by addressing three common failure modes where the agent appears to get "stuck" or "idle" without completing its task:
that halted execution. Added smart fallbacks (using the command string or "Task") and improved error formatting for tool validation.
prevents models from interpreting silence as an environment failure or a signal to stop.
made in the turn. Previously, the loop would exit purely based on the provider's finishReason: "stop", which often occurs after tool-only turns before the model has a chance to summarize or reply.
How did you verify your code works?
(tool-only turns).
Fixes #6244
Fixes #6838