SIGN IN SIGN UP

fix: prevent WarpGrep 400 errors from context overflow

Broad grep patterns on large repos (e.g. minified JS in Discourse)
could return 900K+ chars per grep result, blowing past the model's
163K token limit and causing 400 Bad Request errors on turn 2+.

Three fixes:
- MAX_GREP_CHARS (30K): truncate individual grep results by chars,
  not just line count (minified files have few but huge lines)
- MAX_CONTEXT_CHARS (400K): guard total conversation context before
  API calls, truncating tool results to fit
- Log response body on 400 errors for future debugging

All truncation messages tell the model to use more specific queries.
B
bhaktatejas922 committed
9255a734fae1434e64dd2e758c2d3afa5ec832eb
Parent: 3a15540