mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-05 16:07:33 +00:00
The Vertex renderer commit let a non-thought part that carries only a
thoughtSignature (an empty text part, or a part with no text key) reach
the text path. On the Vertex path the text-part signature is dropped
since then, so the change has no effect there. On the antigravity
platform it added an empty thinking block for such a part: a stream whose
signature arrives in an empty final part ended [text, thinking("")], and
Claude Code reports an empty result for a turn that ends with a thinking
block. main renders [text].
Failure modes this commit guards against:
- Antigravity (zero options): "Hello world" followed by an empty final
part with a signature, or a part with only a signature, renders an
extra empty thinking block (stream with the signature in its own chunk,
and non-stream).
- Vertex options (marker prefix, text signatures dropped): the output
changes. A scratch probe over 8 part shapes (signature-only part before
text, after text, after thinking, between text and a call, after a
call; signed text; signed image), stream and non-stream, gives the same
bytes before and after this commit. With zero options the same probe
gives the bytes of main.
Changes:
- StreamingProcessor and NonStreamingProcessor: the text branch runs
again only for a part with text or a thought part, as on main.
Tests:
- New TestSignatureOnlyTextPartAddsNoBlock: [text] for both tail shapes,
stream (two chunks) and non-stream, with zero options and with the
Vertex options. The zero-option cases fail on the parent commit.
- TestProcessorsKeepSignatureOnlyPartsAndEmptyToolInput loses its two
signature-only cases and becomes
TestProcessorsKeepEmptyToolInputAndImageSignature.
- TestDropTextSignatures: with the drop off, a trailing empty signed part
now gives [text].
- TestThinkingSignaturePrefixMarksOnlyThinkingBlocks: the carried text
signature now comes from a signed non-empty text part, so the test still
checks that the carrier thinking block gets the prefix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>