gateway: thinking with no signature never goes to Claude
citricdu (Discord, 0.1.3356): Claude Code auto-compacted a session on a
Smart group that had moved to Cursor's Grok 4.7, then the group went
back to Kiro's Claude Opus 5.5. The compacted history kept a thinking
block Grok made, which magpie hands a Messages client signed "", and
Kiro answered 13 times in a row with a bare invalid_request_error. The
same request without the block was answered.
withoutForeignThinking dropped only DeepSeek's UUID-signed blocks and
kept an empty signature on purpose ("a block with no signature Claude
takes"), and Kiro's refusal names nothing boundRefusal reads, so
refuseBoundThinking never mended it. Now every thinking block whose
signature is empty, blank or missing is left out for an upstream
serving Claude (api.anthropic.com, or a claude- model: relays, Bedrock
and Vertex ids, a plugin's fetch such as Kiro's), on every route
forwardOnce takes (relayed, translated, plugin, count_tokens), and
refuseBoundThinking runs it too. Text, tool_use and tool_result stay;
Claude's own signed thinking and redacted_thinking are untouched. A
model that learned thinkingBackNeeded (DeepSeek under another name)
keeps its unsigned blocks. Chat and Responses translated into Messages
already dropped unsigned thinking in anthropicBody.
Tests: TestUnsignedThinkingNotSentToClaude builds the reporter's shape
(the compaction summary, then two tool turns opening with Grok's
thinking signed "") against a fake Kiro that gives the same bare 400,
relayed and through the fake plugin's fetch (FAKE_KIRO model added).
TestGrokThinkingThenClaude runs the switch itself: a group answered by
a Chat Grok, then moved to Claude mid tool loop.
TestWithoutForeignThinking adds an unsigned block, Bedrock and Vertex
ids, a missing and a blank signature.
Run (mote, at this head rebased on 136178803):
- gofmt -l: clean; go vet ./internal/gateway: clean
- go test -run 'TestUnsignedThinkingNotSentToClaude|TestGrokThinkingThenClaude|TestWithoutForeignThinking|TestDeepSeekThinkingThenClaude|Bound|TestPluginBoundThinkingLeftOut|ThinkingBack' ./internal/gateway: ok
Broken by hand: the old predicate (DeepSeek signatures only, the
"signature" precheck only) put back: TestWithoutForeignThinking,
TestUnsignedThinkingNotSentToClaude/relayed and
TestGrokThinkingThenClaude fail (Kiro relay 400 "Improperly formed
request."). The plugin subtest passes on the old code too.
Not run before push: the full suite and the Linux/Windows vet; they
are queued behind other sessions' suites, and their result follows.
Not tried: a real Kiro or Anthropic account; Kiro's exact error text
is the reporter's description, not captured bytes.
Reported-by: citricdu (Discord)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -5744,7 +5744,7 @@ func (s *Server) forwardOnce(ctx context.Context, p provider.Provider, to provid
|
||||
// (thinking_bound.go), every route to it alike
|
||||
body = s.withoutRefusedThinking(p, body)
|
||||
// and those another vendor signed, to Claude (thinking_bound.go)
|
||||
body = withoutForeignThinking(p, body)
|
||||
body = s.withoutForeignThinking(p, body)
|
||||
if isKimi(p, to) || isDeepSeekAnthropic(p, to) || p.IsOpenCode() && strings.Contains(strings.ToLower(modelOf(body)), "deepseek") {
|
||||
// Claude Code's deferred-tool blocks, for which Kimi's
|
||||
// Anthropic endpoint turns the whole request away with a 400
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
@@ -179,7 +180,7 @@ func (s *Server) refuseBoundThinking(p provider.Provider, errBody, body []byte)
|
||||
if !boundRefusal.Match(errBody) {
|
||||
return false
|
||||
}
|
||||
sent := withoutForeignThinking(p, s.withoutRefusedThinking(p, body))
|
||||
sent := s.withoutForeignThinking(p, s.withoutRefusedThinking(p, body))
|
||||
msgs := gjson.GetBytes(sent, "messages").Array()
|
||||
// from the block named, or from the start when it names none, or one
|
||||
// that isn't a thinking block in what was sent
|
||||
@@ -218,15 +219,39 @@ func (s *Server) refuseBoundThinking(p provider.Provider, errBody, body []byte)
|
||||
// Claude refuses each one, 400 "messages.1.content.0: Invalid `signature`
|
||||
// in `thinking` block" (checked on 2026-11-03), which forward mends only
|
||||
// where the refusal reaches it as Claude's own 400, and with a request
|
||||
// spent. withoutForeignThinking leaves those blocks out of a request to an
|
||||
// upstream serving Claude before it sees them: Claude's own signatures are
|
||||
// base64 (3,000 of Claude Code's, 800 characters and longer), never a
|
||||
// UUID. A block with no signature Claude takes (checked the same day), so
|
||||
// it goes as it was, and so does every other vendor's signature, which
|
||||
// refuseBoundThinking still mends. Every other upstream, DeepSeek's among
|
||||
// them, gets the body byte for byte.
|
||||
// spent. A conversation that ran on a model magpie translates for (Grok
|
||||
// on Cursor's plugin, a Chat or Responses vendor) holds thinking blocks
|
||||
// signed empty: magpie gives every block a client gets a signature, and
|
||||
// one it has none for is "" (thinking_signature.go). Claude Code keeps
|
||||
// them through a compaction and sends them on to whatever the group
|
||||
// picks next (citricdu on Discord: Grok 4.7, then Claude Opus 5.5 on
|
||||
// Kiro, which answered 13 turns in a row with a bare
|
||||
// invalid_request_error that refuseBoundThinking can't read; the same
|
||||
// request without the block was answered). A block with no signature
|
||||
// can't be Claude's own, as Claude signs every block it makes, and where
|
||||
// it sits in a tool loop Claude checks it.
|
||||
//
|
||||
// withoutForeignThinking leaves both out of a request to an upstream
|
||||
// serving Claude (api.anthropic.com, or a claude- model on any route:
|
||||
// a relay, Bedrock's and Vertex AI's ids, a plugin such as Kiro's) before
|
||||
// it sees them, and an assistant message left with nothing goes too. Its
|
||||
// text, tool calls and the results after them stay. Claude's own
|
||||
// signatures (base64, 3,000 of Claude Code's 800 characters and longer)
|
||||
// go as they were, as do redacted_thinking and every other vendor's
|
||||
// signature, which refuseBoundThinking still mends. Every other upstream,
|
||||
// DeepSeek's among them (which wants its thinking back and takes an empty
|
||||
// signature), gets the body byte for byte, and so does a model that asked
|
||||
// for its tool turns' thinking back (thinking_back.go: DeepSeek behind a
|
||||
// name that doesn't say so), whose filled-in blocks are signed empty.
|
||||
func (s *Server) withoutForeignThinking(p provider.Provider, body []byte) []byte {
|
||||
if !s.fits(p.ID, thinkingBackNeeded(modelOf(body)), provider.Anthropic) {
|
||||
return body
|
||||
}
|
||||
return withoutForeignThinking(p, body)
|
||||
}
|
||||
|
||||
func withoutForeignThinking(p provider.Provider, body []byte) []byte {
|
||||
if !bytes.Contains(body, []byte(`"signature"`)) {
|
||||
if !bytes.Contains(body, []byte(`"signature"`)) && !thinkingTyped.Match(body) {
|
||||
return body
|
||||
}
|
||||
model := modelOf(body)
|
||||
@@ -234,10 +259,18 @@ func withoutForeignThinking(p provider.Provider, body []byte) []byte {
|
||||
return body
|
||||
}
|
||||
return withoutThinkingBlocks(body, func(_, _ int, b gjson.Result) bool {
|
||||
return b.Get("type").String() == "thinking" && deepseekSignature.MatchString(b.Get("signature").String())
|
||||
if b.Get("type").String() != "thinking" {
|
||||
return false
|
||||
}
|
||||
sig := b.Get("signature").String()
|
||||
return strings.TrimSpace(sig) == "" || deepseekSignature.MatchString(sig)
|
||||
})
|
||||
}
|
||||
|
||||
// thinkingTyped is a body with a thinking block in it, for one that says
|
||||
// no signature at all.
|
||||
var thinkingTyped = regexp.MustCompile(`"type"\s*:\s*"thinking"`)
|
||||
|
||||
// deepseekSignature is the signature DeepSeek's Anthropic endpoint gives
|
||||
// its thinking: the reply's id, a UUID.
|
||||
var deepseekSignature = regexp.MustCompile(`(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`)
|
||||
|
||||
@@ -298,7 +298,7 @@ func deepSeekThenClaude(t *testing.T, stream bool) {
|
||||
}
|
||||
|
||||
// Only an upstream serving Claude is sent the body without DeepSeek's
|
||||
// blocks; Claude's own, an unsigned one and a redacted one stay, and
|
||||
// blocks and those signed empty; Claude's own and a redacted one stay, and
|
||||
// DeepSeek's endpoint and another vendor's get it byte for byte.
|
||||
func TestWithoutForeignThinking(t *testing.T) {
|
||||
fresh(t)
|
||||
@@ -329,8 +329,20 @@ func TestWithoutForeignThinking(t *testing.T) {
|
||||
if s := gjson.GetBytes(got, "messages.1.content.#.type").Raw; s != `["text"]` {
|
||||
t.Errorf("Claude's message 1 = %s, want DeepSeek's thinking out", s)
|
||||
}
|
||||
if s := gjson.GetBytes(got, "messages.3.content").Raw; s != gjson.GetBytes(conv("claude-opus-5-5"), "messages.3.content").Raw {
|
||||
t.Errorf("Claude's message 3 = %s, want it as it was", s)
|
||||
// an empty signature is none Claude made (citricdu: Grok's thinking
|
||||
// after a compaction): out too, Claude's own and redacted ones kept
|
||||
want3 := `[{"type":"thinking","thinking":"b","signature":"CAQS8gcKEAgTGAI4AUqAAQ=="},{"type":"redacted_thinking","data":"EmwKAhgB"},{"type":"text","text":"Ok"}]`
|
||||
if s := gjson.GetBytes(got, "messages.3.content").Raw; s != want3 {
|
||||
t.Errorf("Claude's message 3 = %s, want %s", s, want3)
|
||||
}
|
||||
// on Bedrock's and Vertex AI's ids too, and a block with no signature
|
||||
// field at all; an assistant message of nothing else goes
|
||||
for _, model := range []string{"us.anthropic.claude-opus-5-5-v1:0", "claude-opus-5-5@20261001"} {
|
||||
body := []byte(`{"model":"` + model + `","messages":[{"role":"user","content":"go"},{"role":"assistant","content":[{"type":"thinking","thinking":"grok"}]},{"role":"assistant","content":[{"type":"thinking","thinking":"x","signature":" "},{"type":"tool_use","id":"t1","name":"Read","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"t1","content":"ok"}]}]}`)
|
||||
got := withoutForeignThinking(find("claude-api"), body)
|
||||
if n, s := len(gjson.GetBytes(got, "messages").Array()), gjson.GetBytes(got, "messages.1.content.#.type").Raw; n != 3 || s != `["tool_use"]` {
|
||||
t.Errorf("%s: messages = %s", model, gjson.GetBytes(got, "messages").Raw)
|
||||
}
|
||||
}
|
||||
for _, c := range []struct{ id, model string }{{"deepseek", "deepseek-v4-pro"}, {"kimi", "kimi-k2.6"}} {
|
||||
if got := withoutForeignThinking(find(c.id), conv(c.model)); string(got) != string(conv(c.model)) {
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
"github.com/yetone/magpie/internal/provider"
|
||||
)
|
||||
|
||||
// citricdu on Discord (magpie 0.1.3356): Claude Code auto-compacted a
|
||||
// session on a Smart group that had moved to Cursor's Grok 4.7, then the
|
||||
// group went back to Kiro's Claude Opus 5.5. The compacted history kept a
|
||||
// thinking block Grok made, which magpie had handed Claude Code signed
|
||||
// empty, and Kiro turned the session away 13 times in a row with a bare
|
||||
// invalid_request_error. The same request without the block was answered.
|
||||
|
||||
// grokThought is the shape of the reasoning Grok gave in the report: its
|
||||
// own words, not Claude's, in a tool turn.
|
||||
const grokThought = "The user wants the split logic checked. I should read internal/split.go first, then run the tests to see which case fails."
|
||||
|
||||
// unsignedConversation is the reporter's request after the compaction:
|
||||
// the summary Claude Code continues from, then the tool loop it was in,
|
||||
// whose assistant turns open with Grok's thinking signed "" before the
|
||||
// calls, and the results after them.
|
||||
func unsignedConversation(model string) string {
|
||||
return `{"model":"` + model + `","max_tokens":32000,"stream":false,"thinking":{"type":"adaptive"},"output_config":{"effort":"high"},` +
|
||||
`"tools":[{"name":"Read","description":"Read a file","input_schema":{"type":"object","properties":{"file_path":{"type":"string"}}}},{"name":"Bash","description":"Run a command","input_schema":{"type":"object","properties":{"command":{"type":"string"}}}}],` +
|
||||
`"messages":[` +
|
||||
`{"role":"user","content":[{"type":"text","text":"This session is being continued from a previous conversation that ran out of context. The summary below covers the earlier portion of the conversation.\n\nSummary: the user asked to fix the split of long requests."}]},` +
|
||||
`{"role":"assistant","content":[{"type":"thinking","thinking":` + jsonString(grokThought) + `,"signature":""},{"type":"text","text":"Reading the split code."},{"type":"tool_use","id":"toolu_01Grok1","name":"Read","input":{"file_path":"internal/split.go"}}]},` +
|
||||
`{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Grok1","content":"package split"}]},` +
|
||||
`{"role":"assistant","content":[{"type":"thinking","thinking":"Now run the tests.","signature":""},{"type":"tool_use","id":"toolu_01Grok2","name":"Bash","input":{"command":"go test ./internal/split"}}]},` +
|
||||
`{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Grok2","content":"ok"}]}]}`
|
||||
}
|
||||
|
||||
func jsonString(s string) string {
|
||||
b, _ := json.Marshal(s)
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// kiroClaude answers as the reporter's Kiro did: a thinking block with no
|
||||
// signature is turned away with Anthropic's error type and words that
|
||||
// name nothing (so refuseBoundThinking can't mend it); anything else is
|
||||
// answered as boundClaude answers.
|
||||
type kiroClaude struct{ boundClaude }
|
||||
|
||||
func (c *kiroClaude) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
b, _ := io.ReadAll(r.Body)
|
||||
for _, m := range gjson.GetBytes(b, "messages").Array() {
|
||||
for _, blk := range m.Get("content").Array() {
|
||||
if blk.Get("type").String() == "thinking" && blk.Get("signature").String() == "" {
|
||||
c.mu.Lock()
|
||||
c.bodies = append(c.bodies, string(b))
|
||||
c.mu.Unlock()
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(400)
|
||||
io.WriteString(w, `{"type":"error","error":{"type":"invalid_request_error","message":"Improperly formed request."}}`)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
r.Body = io.NopCloser(strings.NewReader(string(b)))
|
||||
c.boundClaude.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
// Every route to Claude leaves the empty-signed thinking out, and keeps
|
||||
// the turns' text, calls and results: relayed to a Claude API, and
|
||||
// through Kiro's plugin's fetch.
|
||||
func TestUnsignedThinkingNotSentToClaude(t *testing.T) {
|
||||
check := func(t *testing.T, sent []string, code int, said string) {
|
||||
t.Helper()
|
||||
if code != 200 {
|
||||
t.Fatalf("answered %d %s, want 200", code, said)
|
||||
}
|
||||
if len(sent) != 1 {
|
||||
t.Fatalf("Claude asked %d times, want once", len(sent))
|
||||
}
|
||||
b := sent[0]
|
||||
if strings.Contains(b, "split logic") || strings.Contains(b, "Now run the tests.") || len(signatures(b)) != 0 {
|
||||
t.Errorf("unsigned thinking went to Claude: %s", gjson.Get(b, "messages").Raw)
|
||||
}
|
||||
for _, want := range []string{`"Reading the split code."`, `"toolu_01Grok1"`, `"toolu_01Grok2"`, `"package split"`, `"go test ./internal/split"`} {
|
||||
if strings.Count(b, want) == 0 {
|
||||
t.Errorf("%s left out: %s", want, gjson.Get(b, "messages").Raw)
|
||||
}
|
||||
}
|
||||
if n := len(gjson.Get(b, "messages").Array()); n != 5 {
|
||||
t.Errorf("%d messages sent, want the 5 the agent sent", n)
|
||||
}
|
||||
}
|
||||
t.Run("relayed", func(t *testing.T) {
|
||||
fresh(t)
|
||||
up := &kiroClaude{}
|
||||
srv := httptest.NewServer(up)
|
||||
t.Cleanup(srv.Close)
|
||||
if err := provider.Save(provider.Provider{ID: "kiro-relay", Name: "Kiro relay", Key: "k", Anthropic: srv.URL, Models: []string{"claude-opus-5-5"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
code, said := claudeCodeMessages(t, New(), unsignedConversation("kiro-relay/claude-opus-5-5"))
|
||||
check(t, up.sent(), code, said)
|
||||
})
|
||||
t.Run("plugin", func(t *testing.T) {
|
||||
up := &kiroClaude{boundClaude{stream: true}}
|
||||
t.Setenv("FAKE_KIRO", "1")
|
||||
pid := besideFake(t, "kiro", up)
|
||||
code, said := claudeCodeMessages(t, New(), unsignedConversation(pid+"/claude-opus-5.5"))
|
||||
check(t, up.sent(), code, said)
|
||||
})
|
||||
}
|
||||
|
||||
func claudeCodeMessages(t *testing.T, s *Server, body string) (int, string) {
|
||||
t.Helper()
|
||||
rec := httptest.NewRecorder()
|
||||
req := httptest.NewRequest("POST", "/v1/messages", strings.NewReader(body))
|
||||
req.Header.Set("anthropic-version", "2023-06-01")
|
||||
req.Header.Set("User-Agent", "claude-cli/2.1.120 (external, cli)")
|
||||
s.Handler().ServeHTTP(rec, req)
|
||||
return rec.Code, rec.Body.String()
|
||||
}
|
||||
|
||||
// switchGrok answers as a Chat vendor serving Grok does: its reasoning,
|
||||
// then a tool call, or text once the call has its result.
|
||||
type switchGrok struct {
|
||||
mu sync.Mutex
|
||||
n int
|
||||
}
|
||||
|
||||
func (g *switchGrok) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
b, _ := io.ReadAll(r.Body)
|
||||
g.mu.Lock()
|
||||
g.n++
|
||||
n := g.n
|
||||
g.mu.Unlock()
|
||||
ms := gjson.GetBytes(b, "messages").Array()
|
||||
done := len(ms) > 0 && ms[len(ms)-1].Get("role").String() == "tool"
|
||||
msg := map[string]any{"role": "assistant", "reasoning_content": grokThought}
|
||||
finish := "tool_calls"
|
||||
if done {
|
||||
msg["content"], finish = "Read it.", "stop"
|
||||
} else {
|
||||
msg["content"] = ""
|
||||
msg["tool_calls"] = []any{map[string]any{"id": fmt.Sprintf("call_grok%d", n), "type": "function", "function": map[string]any{"name": "Read", "arguments": fmt.Sprintf(`{"file_path":"f%d.go"}`, n)}}}
|
||||
}
|
||||
if !gjson.GetBytes(b, "stream").Bool() {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]any{"id": "c1", "object": "chat.completion", "model": "grok-4.7", "choices": []any{map[string]any{"index": 0, "message": msg, "finish_reason": finish}}, "usage": map[string]any{"prompt_tokens": 1, "completion_tokens": 1}})
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "text/event-stream")
|
||||
chunk := func(delta map[string]any, finish any) {
|
||||
c, _ := json.Marshal(map[string]any{"id": "c1", "object": "chat.completion.chunk", "model": "grok-4.7", "choices": []any{map[string]any{"index": 0, "delta": delta, "finish_reason": finish}}})
|
||||
fmt.Fprintf(w, "data: %s\n\n", c)
|
||||
}
|
||||
chunk(map[string]any{"role": "assistant", "reasoning_content": grokThought}, nil)
|
||||
if done {
|
||||
chunk(map[string]any{"content": "Read it."}, nil)
|
||||
} else {
|
||||
calls := msg["tool_calls"].([]any)
|
||||
c := calls[0].(map[string]any)
|
||||
chunk(map[string]any{"tool_calls": []any{map[string]any{"index": 0, "id": c["id"], "type": "function", "function": c["function"]}}}, nil)
|
||||
}
|
||||
chunk(map[string]any{}, finish)
|
||||
io.WriteString(w, "data: [DONE]\n\n")
|
||||
}
|
||||
|
||||
// The reporter's whole path: a group's turns on Grok (a Chat vendor,
|
||||
// whose reasoning Claude Code gets as thinking signed empty), then the
|
||||
// group moves to Claude in the middle of a tool loop. Claude, which
|
||||
// turns a block it didn't sign away, is never sent Grok's.
|
||||
func TestGrokThinkingThenClaude(t *testing.T) {
|
||||
fresh(t)
|
||||
gk, cl := &switchGrok{}, &switchClaude{}
|
||||
gku, clu := httptest.NewServer(gk), httptest.NewServer(cl)
|
||||
t.Cleanup(gku.Close)
|
||||
t.Cleanup(clu.Close)
|
||||
for _, p := range []provider.Provider{
|
||||
{ID: "grokco", Name: "Grok", Key: "sk-gk", Chat: gku.URL + "/v1", Models: []string{"grok-4.7"}},
|
||||
{ID: "claude-api", Name: "Claude API", Key: "sk-ant", Anthropic: clu.URL, Models: []string{"claude-opus-5-5"}},
|
||||
} {
|
||||
if err := provider.Save(p); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
g := provider.Group{ID: "dc", Name: "Smart split", Members: []string{"grokco/grok-4.7", "claude-api/claude-opus-5-5"}}
|
||||
if err := provider.SaveGroup(g); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s := New()
|
||||
msgs := []json.RawMessage{json.RawMessage(`{"role":"user","content":[{"type":"text","text":"check the split"}]}`)}
|
||||
var code int
|
||||
var said string
|
||||
if msgs, code, said = switchTurn(t, s, false, msgs); code != 200 {
|
||||
t.Fatalf("Grok's turn: %d %s", code, said)
|
||||
}
|
||||
last := msgs[len(msgs)-1]
|
||||
th := gjson.GetBytes(last, `content.#(type=="thinking")`)
|
||||
if th.Get("thinking").String() != grokThought || !th.Get("signature").Exists() || th.Get("signature").String() != "" {
|
||||
t.Fatalf("Grok's reply = %s, want its thinking signed empty", last)
|
||||
}
|
||||
id := gjson.GetBytes(last, `content.#(type=="tool_use").id`).String()
|
||||
msgs = append(msgs, json.RawMessage(`{"role":"user","content":[{"type":"tool_result","tool_use_id":"`+id+`","content":"package f"}]}`))
|
||||
// Grok unticked: the tool loop goes on on Claude
|
||||
g.Off = []string{"grokco/grok-4.7"}
|
||||
if err := provider.SaveGroup(g); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, code, said = switchTurn(t, s, false, msgs); code != 200 {
|
||||
t.Fatalf("Claude's turn: %d %s", code, said)
|
||||
}
|
||||
if cl.refused != 0 || len(cl.bodies) != 1 {
|
||||
t.Fatalf("Claude refused %d of %d requests: %s", cl.refused, len(cl.bodies), cl.bodies[0])
|
||||
}
|
||||
sent := cl.bodies[0]
|
||||
if strings.Contains(sent, "split logic") {
|
||||
t.Errorf("Grok's thinking went to Claude: %s", sent)
|
||||
}
|
||||
if !strings.Contains(sent, id) || !strings.Contains(sent, `"package f"`) {
|
||||
t.Errorf("Grok's call or its result left out: %s", sent)
|
||||
}
|
||||
}
|
||||
+3
@@ -81,6 +81,9 @@ export const FakePlugin = async ({ client }) => ({
|
||||
"fake-gemini": { name: "Fake Gemini", provider: { npm: "@ai-sdk/google" }, reasoning: true, modalities: { input: ["text"], output: ["text"] }, limit: { context: 3000, output: 300 } },
|
||||
},
|
||||
}
|
||||
// $FAKE_KIRO: a Claude model named as Kiro's plugin names it, on
|
||||
// Anthropic's Messages API
|
||||
if (process.env.FAKE_KIRO) cfg.provider[ID].models["claude-opus-5.5"] = { name: "Claude Opus 5.5", provider: { npm: "@ai-sdk/anthropic" }, reasoning: true, modalities: { input: ["text", "image"], output: ["text"] }, limit: { context: 200000, output: 32000 } }
|
||||
// $FAKE_RESPONSES: one model more, on OpenAI's Responses (Grok's)
|
||||
// $FAKE_FAST=1: fake-1 has a fast one, as Cursor's plugin 0.1.x lists
|
||||
// a model's -fast (=tier: see the models hook)
|
||||
|
||||
Reference in New Issue
Block a user