Repository navigation
v1.0.4 - Reliability & Debug Release
Improved token counting accuracy with tiktoken fallback, fixed critical tool_calls merging bug for Codex CLI compatibility, and introduced a new flexible debug logging system.
🐛 Bug Fixes
- Fixed tool_calls loss during message merging (#5) — When multiple assistant messages with tool_calls were sent consecutively (common in Codex CLI), the second and subsequent tool_calls were being lost during merge. This caused Kiro API to return HTTP 400 with
{"message":"Improperly formed request.","reason":null}(in this case: toolResult without corresponding toolUse). Now all tool_calls are properly preserved when merging adjacent assistant messages.
✨ New Features
- New debug logging system with three modes:
DEBUG_MODE=off— Disabled (default)DEBUG_MODE=errors— Save logs only for failed requests (4xx, 5xx). Data is buffered in memory and written to files only when an error occurs. Recommended for troubleshooting.DEBUG_MODE=all— Save logs for every request (overwrites on each request)
⚡ Improvements
-
Tiktoken fallback for prompt_tokens — When Kiro API doesn't return
context_usagepercentage, the gateway now uses tiktoken to calculate prompt_tokens from the original request messages and tools. This ensures accurate token usage reporting even when the API response is incomplete. -
Improved token counting accuracy — The correction coefficient for Claude models is now applied more precisely: only to completion_tokens (output), not to prompt_tokens calculated via fallback.
🗑️ Deprecated
DEBUG_LAST_REQUEST— This environment variable is deprecated and will be removed in future releases. UseDEBUG_MODE=errorsorDEBUG_MODE=allinstead. A warning will be shown at startup if you're still using the old option.
⚙️ Configuration
| Variable | Values | Default | Description |
|---|---|---|---|
DEBUG_MODE |
off, errors, all |
off |
Debug logging mode |
🔄 Upgrade
After downloading and extracting the new release, no additional steps are required. The new debug logging system is disabled by default.
If you were using DEBUG_LAST_REQUEST=true, consider switching to DEBUG_MODE=errors for more efficient debugging (logs only failed requests).
Full Changelog: v1.0.3...v1.0.4