Skip to content

fix: complete thinking streams and canonicalize model IDs - #133

Merged
samueltuyizere merged 3 commits into
routatic:mainfrom
goodnightzsj:fix/thinking-stream-model-casing
Aug 20, 2026
Merged

fix: complete thinking streams and canonicalize model IDs#133
samueltuyizere merged 3 commits into
routatic:mainfrom
goodnightzsj:fix/thinking-stream-model-casing

Conversation

@goodnightzsj

Copy link
Copy Markdown
Contributor

Summary

  • emit a non-empty signature_delta before every thinking block stop and preserve real signatures in reconstructed message responses
  • merge OpenAI-compatible finish reasons and trailing usage into one terminal Anthropic message_delta
  • canonicalize uniquely matched built-in model IDs case-insensitively while preserving exact custom IDs and ambiguity errors
  • keep Kimi request thinking parameters capability-gated, with a regression covering thinking history

Validation

  • go test ./... -count=1
  • go vet ./...
  • test -z "$(gofmt -l cmd internal pkg)"
  • node --check internal/gui/assets/app.js

Fork scope

The source fork also has SQLite request history, provider usage reconciliation, expanded usage dashboards, themed controls, and public deployment work. Those fork-specific changes are deliberately excluded; this PR contains one upstream-based commit with only the generally applicable protocol and model-resolution fixes.

Fixes #51
Fixes #131

…pstream failure

Review follow-ups on the thinking-stream and model-canonicalization work:

- stream: open thinking content_block_start unsigned. The signature_delta
  emitted before content_block_stop accumulates onto the start block, so
  pre-seeding the placeholder made clients see it twice concatenated.
- stream: flush the terminal message_delta and message_stop when the upstream
  read fails after finish_reason arrived. Deferring the merged message_delta to
  the end of the loop meant a stall or read error after a complete answer
  dropped both terminal events and made the handler retry the turn on the next
  model. An error before finish_reason still fails so fallback keeps working.
- response: sign the thinking block on the non-streaming path. Clients running
  the extended-thinking beta discard unsigned thinking blocks, which emptied
  non-streamed replies the same way the streaming bug did.
- stream: extract closeOpenBlock for the four copies of the
  close-thinking-or-text cascade, and rename writeThinkingBlockStop to
  closeThinkingBlock since it emits a signature_delta before the stop.
- catalog: collapse ResolveShort's three near-identical match passes into one
  exact-then-case-insensitive loop and correct its stale doc comment.
- config: simplify CanonicalModelID to a lowercase lookup. The ambiguity guard
  was unreachable because every registry key is lowercase; a test now enforces
  that invariant.
@samueltuyizere
samueltuyizere merged commit 0b723b2 into routatic:main Aug 20, 2026
2 of 3 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.

Model DeepSeek-V4-Pro is not supported kimi-k2.6: empty response in Claude Code — thinking blocks require signature_delta + merged message_delta

3 participants