feat: retry malformed JSON with minimal context#24
Merged
Conversation
…turn When the LLM returns unparseable JSON, retry with just the current page state + correction hint (~7K tokens) instead of accepting wait(1000) and re-sending full history (~25K tokens) on the next turn. If retry succeeds: use the corrected response, no turn wasted. If retry fails: fall back to existing wait(1000) behavior.
drewstone
added a commit
that referenced
this pull request
Mar 19, 2026
Unpublished since 0.10.0: - feat: screenX/screenY CDP fix for Cloudflare Turnstile (#29) - fix: boost output tokens near max turns (#28) - feat: canvas fingerprint noise + stealth patches (#27) - fix: headless UA override — platform-agnostic Akamai bypass (#26) - fix: nightly CI — Xvfb headed stealth + system Chrome (#25) - feat: retry malformed JSON with minimal context (#24) - feat: three-tier history compression -22% cost (#23) - feat: headless passthrough + Docker benchmark runner (#22) - feat: WebVoyager + WebArena benchmark adapters (#20) - fix: graceful recovery from execute wall-clock timeouts (#21) - feat: showcase command for marketing asset capture (#18) - feat: research pipeline + speed-v1 experiment results (#19) - feat: design rip, compare, and extract-tokens overhaul (#17) - feat: CDP connection, browser profiles, and asset downloader (#16)
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
wait(1000)behavior — zero regression riskContext
SportingNews benchmark case lost 2 turns (~50K tokens) to malformed JSON responses.
Each wasted turn re-sends the full conversation history at 25K+ tokens for no progress.
This retry catches the failure inline with a cheap minimal-context call.
Test plan
pnpm lint— cleanpnpm test— 629/629 passing🤖 Generated with Claude Code