Skip to content

WARE-88: fix(signature): strip foreign Claude compat blobs - #227

Open
warelik wants to merge 2 commits into
kaitranntt:mainfrom
warelik:warelik/WARE-88-signature-sanitize
Open

WARE-88: fix(signature): strip foreign Claude compat blobs#227
warelik wants to merge 2 commits into
kaitranntt:mainfrom
warelik:warelik/WARE-88-signature-sanitize

Conversation

@warelik

@warelik warelik commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Narrow signature-boundary kernel cut from kaitranntt/CLIProxyAPIPlus:main (f5570ed6). Supersedes the stacked integration PR #209 (181 commits / 131 files).

PreserveEmptyThinkingBlocks used to keep thinking-block shape by forwarding the raw signature, including foreign gemini#, Grok-like E/R opaque blobs, short EgI=, and client-supplied _cliproxy_replay_provenance. Compat mode now asks DecideSignatureCompatibilityForModel (the only authority). On incompatibility the block stays and signature=""; a valid Claude signature is preserved.

Client _cliproxy_replay_provenance is stripped before the compatibility check so an untrusted marker cannot skip validation.

gemini-cli ConvertGeminiCLIResponseToClaude (issue #199 point 3) no longer drops thoughtSignature. Routing stays on the thought flag: visible text with a signature is still text, not a thinking block. Sanitizer, not the translator, decides what Anthropic may see on fallback. This unblocks merging #190.

Files

  • internal/signature/claude_messages_sanitize.go
  • internal/signature/claude_messages_sanitize_compat_test.go
  • internal/translator/gemini-cli/claude/gemini-cli_claude_response.go
  • internal/translator/gemini-cli/claude/gemini-cli_claude_response_test.go

4 files, +319 / −13, 1 commit on warelik/WARE-88-signature-sanitize.

Not in this PR (already owned elsewhere)

Test plan

  • go test ./internal/signature/ ./internal/translator/gemini-cli/claude/
  • Compat cases: gemini#, mislabeled claude#, nested prefix, unknown vendor, whitespace-padded EgI=, Grok-like E/R, opaque blob, client provenance strip, valid Claude signature preserved
  • gemini-cli: thoughtSignature kept on thought:true; visible text with signature stays text_delta
  • go build -o cli-proxy-api ./cmd/server

Stock counterpart

Sanitizer kernel is the Plus slice of router-for-me/CLIProxyAPI#5150 (internal/signature/** only; no cache/executor in this PR). Translator tail is Plus-only (stock CI rejects standalone internal/translator/**).

Retention

Behavior already lives in warelik/CLIProxyAPIPlus branch warelik/mission-integration. Ancestor commits:

Closing #209 as superseded; do not merge the stack.

PreserveEmptyThinkingBlocks forwarded opaque signatures as Claude.
Compat now asks DecideSignatureCompatibilityForModel; client
_cliproxy_replay_provenance is stripped first. gemini-cli keeps
thoughtSignature without rerouting visible text into thinking.
Compat restore keeps omitted thinking blocks. Cache-born EgI=
is not a Claude envelope; sanitizer must empty it, not forward it.
warelik added a commit to warelik/CLIProxyAPIPlus that referenced this pull request Aug 24, 2026
Cache-restored Claude signatures must pass Detect/Decide on
the outbound body. Stops the sanitizer bypass on the native
compat path; matches Plus kaitranntt#227.
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.

1 participant