mirror of
https://github.com/Quorinex/Kiro-Go.git
synced 2026-04-25 07:15:50 +03:00
[PR #20] [MERGED] fix: stabilize thinking streams, multimodal parsing, and token accounting #15
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Kiro-Go#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Quorinex/Kiro-Go/pull/20
Author: @edxeth
Created: 2/21/2026
Status: ✅ Merged
Merged: 2/23/2026
Merged by: @Quorinex
Base:
main← Head:fix/thinking-multimodal-token-accounting📝 Commits (5)
95845dcfix: stabilize multimodal image compatibility across OpenCode flowsc969f34fix: deduplicate thinking streams and trim injected prompt noise7c0737ffix: align /v1/messages thinking blocks and message_start usage1b25869fix: reduce repetitive thinking across tool turns07e08adfix: unify token counting on existing API endpoints📊 Changes
7 files changed (+1413 additions, -326 deletions)
View changed files
📝
proxy/handler.go(+390 -178)➕
proxy/handler_test.go(+50 -0)📝
proxy/kiro.go(+162 -31)➕
proxy/kiro_test.go(+37 -0)➕
proxy/token_estimator.go(+196 -0)📝
proxy/translator.go(+380 -117)➕
proxy/translator_test.go(+198 -0)📄 Description
Summary
This branch hardens proxy behavior for long-running tool workflows and mixed text+image prompts in Anthropic and OpenAI-compatible clients. The focus is stream correctness, multimodal translation resilience, and consistent token usage reporting across existing API endpoints.
Key changes
1) Multimodal compatibility and model capability signaling
/v1/modelsmetadata to expose vision support consistently (supports_image, modality/capability fields).image_url,input_image,file,input_file, nestedsource/file, data URLs/base64 payloads).[Image N]and ensured image-only follow-up turns still send non-empty user content.2) Thinking stream stability and event alignment
reasoningContentEventor<thinking>tags, not both)./v1/messagesstream lifecycle coherent (message_start-> content blocks ->message_delta->message_stop) while preserving tool-use transitions.3) Tool-loop continuity and replay prevention
4) Unified deterministic token accounting
proxy/token_estimator.goand wired shared estimation into:POST /v1/messagesPOST /v1/chat/completionsPOST /v1/messages/count_tokensproxy/kiro.gowithout relying on sparse upstream metering fields as the only source.Commit walkthrough
95845dc— stabilize multimodal image compatibility and model capability signaling.c969f34— deduplicate thinking streams and trim injected prompt noise.7c0737f— align/v1/messagesthinking blocks andmessage_startusage behavior.1b25869— reduce repetitive thinking across tool turns; add tests for stream source gating and chunk replay handling.07e08ad— unify token counting on existing endpoints with shared estimator logic.Validation
go test ./...(pass)go build ./...(pass)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.