fix(agent): repair broken Anthropic goal execution and missing result output - #59
Merged
Merged
Conversation
saikrishna321
approved these changes
Aug 24, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 24, 2026
## [2.4.1](v2.4.0...v2.4.1) (2026-08-24) ### Bug Fixes * **agent:** repair broken Anthropic goal execution and missing result output ([#59](#59)) ([282441a](282441a))
|
🎉 This PR is included in version 2.4.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a set of related bugs that made Anthropic goal execution effectively unusable, plus two smaller bugs uncovered while verifying the fix (a missing result in the terminal summary, and the same result missing from the session log/JSON stream).
What was broken
Anthropic reasoning calls failed on every request. The agent loop always forces
tool_choice: 'required', but Anthropic rejectsthinking:{type:'enabled'}whenever tool use is forced ("Thinking may not be enabled when tool_choice forces tool use"). Every Anthropic call hit this 400.The failure was invisible, then retried for the full step budget. The streaming code discarded the API's actual error and let the AI SDK throw a generic
AI_NoOutputGeneratedError: No output generated. That error wasn't classified as fatal, so the loop retried the same unrecoverable 400 up to 30 times per run before giving up.A sleeping Android display produced a bare, unexplained timeout. UiAutomator2 can't read the screen while it's off, so page-source calls hung for the full 120s MCP timeout and reported only
Request timed out.The agent's final answer was computed but never shown. When a sub-goal completes — e.g. "find the Wi-Fi name" — the LLM's answer text is threaded through the whole pipeline into
sg.result, but the Ink terminal summary only ever rendered the sub-goal name and pass/fail, dropping the answer.That same answer never reached the session log either, for a different reason: two code paths in
runAgentreturn on completion (the LLM callingdoneexplicitly, and a separatescreenEvaluatorfast-path that can conclude a goal is already satisfied from a screen diff) — both returned before the loop'sonStepcallback fired, so the completing step never reachedlogs/*.json, the SDK'sonStepconsumers, or the JSON event stream.