Skip to content

fix: resolve prompt length overflow in Addie AI#748

Merged
bokelley merged 1 commit into
mainfrom
bokelley/fix-prompt-length
Jan 13, 2026
Merged

fix: resolve prompt length overflow in Addie AI#748
bokelley merged 1 commit into
mainfrom
bokelley/fix-prompt-length

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

  • Fix prompt length overflow (211K tokens > 200K maximum) affecting admin users
  • Increase tool definition buffer from 15K to 45K tokens and add dynamic calculation based on actual tool count
  • Remove 3 deprecated tools and trim verbose descriptions across admin/member tools
  • Add test coverage for new token estimation functions

Test plan

  • TypeScript compiles successfully
  • All 242 tests pass
  • Docker build succeeds and migrations run
  • Code review completed

🤖 Generated with Claude Code

The Anthropic API was rejecting requests with "prompt is too long"
(211,303 tokens > 200,000 maximum) for admin users with many tools.

Root causes:
- Static tool buffer (15K) was far below actual usage (~33K for admins)
- Conversation history trimming happened before tools were combined
- Verbose tool descriptions consuming unnecessary tokens

Changes:
- Increase tool definition buffer from 15K to 45K tokens
- Add dynamic token calculation based on actual tool count (~300/tool)
- Move tool combination before message trimming for accurate budgets
- Remove 3 deprecated tools (lookup_organization, get_organization_details,
  find_prospect) that were replaced by unified organization tools
- Trim verbose property descriptions across admin and member tools
- Add test coverage for new token estimation functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit a675c52 into main Jan 13, 2026
6 checks passed
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