Skip to content

serve: split Anthropic thinking response blocks - #568

Merged
JustVugg merged 1 commit into
JustVugg:devfrom
winklemad:fix/anthropic-thinking-blocks-c2
Jul 23, 2026
Merged

JustVugg merged 1 commit into
JustVugg:devfrom
winklemad:fix/anthropic-thinking-blocks-c2

Conversation

@winklemad

Copy link
Copy Markdown
Contributor

Summary

When Anthropic thinking was enabled, /v1/messages opened a GLM reasoning block but returned the raw reasoning</think>answer output as one text block. Streaming also forwarded the marker and reasoning as text, including when </think> crossed engine chunks.

Split reasoning from answer content at the adapter boundary, emit Anthropic thinking/text blocks and typed stream deltas, preserve prior assistant thinking for multi-turn requests, and keep the default thinking-disabled path unchanged. The colibri-local signature is stable opaque local compatibility metadata; it is not an Anthropic cryptographic signature.

Validation

No CUDA paths or performance claims are involved.

  • make -C c check
  • CUDA changes were tested with make -C c cuda-test (if applicable)
  • Performance claims include hardware, commands, and repeatable measurements

Compatibility

  • The default CPU build remains dependency-free
  • No model files, generated binaries, or benchmark artifacts are included

@JustVugg
JustVugg merged commit 75a7374 into JustVugg:dev Jul 23, 2026
10 checks passed
NeuralNotwerk pushed a commit to NeuralNotwerk/colibri that referenced this pull request Jul 25, 2026
…gg#597)

Two self-contained gaps from mkelcb's serving report (JustVugg#597), both in the
Python gateway, both behind explicit opt-ins:

- JustVugg#597 item 2 — the DNS-rebinding Host guard accepted only loopback names and
  the bind address, so a legitimate reverse proxy / Tailscale MagicDNS host in
  front of the loopback bind was rejected with 403 and had no supported way to
  be trusted. Add `--allowed-host` (repeatable) and `COLI_ALLOWED_HOSTS`
  (comma-separated) that extend the allowlist. Default is unchanged
  (loopback + bind address only); no wildcard, each trusted Host is explicit,
  and this is orthogonal to CORS and API-key auth.

- JustVugg#597 item 5 — the cold-prefill keepalive streamed a visible `reasoning_content: "."`
  every 10s, painting hundreds of dots in the client's reasoning panel over a
  minutes-long prefill. Default to an empty delta (still a valid SSE data event,
  still resets the client idle timer); COLI_VISIBLE_KEEPALIVE=1 restores the old
  visible dot for diagnosing keepalive delivery.

Items 1 and 4 (non-streaming) of the same report are already fixed on dev by
JustVugg#535 and JustVugg#568; items 3, 4-streaming and 6 are tracked separately.

Tests: 4 new AllowedHostsTest cases (normalisation, trusted host accepted with
port/case, untrusted rejected by default and with an allowlist). Full server
suite 68/68.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
ErikTromp pushed a commit to SensAI-PT/aviary that referenced this pull request Aug 9, 2026
…-blocks-c2

serve: split Anthropic thinking response blocks
ErikTromp pushed a commit to SensAI-PT/aviary that referenced this pull request Aug 9, 2026
…gg#597)

Two self-contained gaps from mkelcb's serving report (JustVugg#597), both in the
Python gateway, both behind explicit opt-ins:

- JustVugg#597 item 2 — the DNS-rebinding Host guard accepted only loopback names and
  the bind address, so a legitimate reverse proxy / Tailscale MagicDNS host in
  front of the loopback bind was rejected with 403 and had no supported way to
  be trusted. Add `--allowed-host` (repeatable) and `COLI_ALLOWED_HOSTS`
  (comma-separated) that extend the allowlist. Default is unchanged
  (loopback + bind address only); no wildcard, each trusted Host is explicit,
  and this is orthogonal to CORS and API-key auth.

- JustVugg#597 item 5 — the cold-prefill keepalive streamed a visible `reasoning_content: "."`
  every 10s, painting hundreds of dots in the client's reasoning panel over a
  minutes-long prefill. Default to an empty delta (still a valid SSE data event,
  still resets the client idle timer); COLI_VISIBLE_KEEPALIVE=1 restores the old
  visible dot for diagnosing keepalive delivery.

Items 1 and 4 (non-streaming) of the same report are already fixed on dev by
JustVugg#535 and JustVugg#568; items 3, 4-streaming and 6 are tracked separately.

Tests: 4 new AllowedHostsTest cases (normalisation, trusted host accepted with
port/case, untrusted rejected by default and with an allowlist). Full server
suite 68/68.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.

2 participants