Skip to content

fix: boost output tokens near max turns for completion#28

Merged
drewstone merged 1 commit intomainfrom
fix/completion-token-budget
Mar 19, 2026
Merged

fix: boost output tokens near max turns for completion#28
drewstone merged 1 commit intomainfrom
fix/completion-token-budget

Conversation

@drewstone
Copy link
Copy Markdown
Contributor

Summary

  • When the agent is within 4 turns of max, bump maxOutputTokens from 600 to 1200
  • Data-heavy completion responses (multi-record extractions) truncate at 600 tokens, causing malformed JSON that wastes remaining turns on retry loops
  • Most turns use 200-350 output tokens regardless of limit — the higher cap only costs more when the LLM actually needs it
  • Fixes webbench-108 (Apple store locator) where agent successfully extracted all data by turn 16 but then crashed turns 17-20 on truncated completion JSON

Test plan

  • pnpm build passes
  • Run webbench-108 (Apple store locator) to verify completion succeeds
  • Verify token cost doesn't increase significantly on typical cases (most output is well under 600)

When approaching max turns (last 4), bump maxOutputTokens from 600 to
1200. Data-heavy completion responses (e.g., multi-record extractions)
truncate at 600 tokens, causing malformed JSON that wastes remaining
turns on retry loops.

Most turns use 200-350 output tokens regardless of limit. The higher
cap only matters when the LLM packs extracted data into a complete
action near the end of a run.

Fixes webbench-108 (Apple store locator) where 4 consecutive turns
produced truncated JSON during completion assembly.
@drewstone drewstone merged commit 002e5d7 into main Mar 19, 2026
5 checks passed
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant