Skip to content

fix(agent): repair broken Anthropic goal execution and missing result output - #59

Merged
saikrishna321 merged 1 commit into
appclawhq:mainfrom
Delta456:bug_fixes
Aug 24, 2026
Merged

fix(agent): repair broken Anthropic goal execution and missing result output#59
saikrishna321 merged 1 commit into
appclawhq:mainfrom
Delta456:bug_fixes

Conversation

@Delta456

Copy link
Copy Markdown
Contributor

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 rejects thinking:{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 runAgent return on completion (the LLM calling done explicitly, and a separate screenEvaluator fast-path that can conclude a goal is already satisfied from a screen diff) — both returned before the loop's onStep callback fired, so the completing step never reached logs/*.json, the SDK's onStep consumers, or the JSON event stream.

@saikrishna321
saikrishna321 merged commit 282441a into appclawhq:main Aug 24, 2026
7 checks passed
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))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Delta456
Delta456 deleted the bug_fixes branch August 24, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants