fix: truncate large tool outputs to prevent Crof incomplete responses

Crof models (mimo, deepseek-v4-pro) return status=incomplete when
tool results contain too much text (e.g. full HTML pages at 8500+ tokens).
Auto-truncate tool outputs exceeding 8000 chars with truncation notice.
Combined with the 30-item conversation trim from previous commit.
This commit is contained in:
admin
2026-05-19 21:37:34 +04:00
Unverified
parent aa377024d9
commit c90912ed07
3 changed files with 21 additions and 6 deletions

View File

@@ -9,6 +9,9 @@
- Keeps system/developer messages, original user query, and most recent items
- Drops oldest tool call/outputs from the middle when conversation grows too long
- Prevents `status=incomplete` errors on providers with smaller context windows
- **Truncates large tool outputs (>8000 chars)** to prevent model output token exhaustion
- Crof's models return `incomplete` when tool results contain too much text (e.g., full HTML pages)
- Truncated outputs include `[truncated N chars]` suffix so the model knows data was cut
- Added request/response logging to `~/.cache/codex-proxy/requests.log` for debugging
- Proxy stderr no longer discarded by launcher (visible in terminal for debugging)