Files
magpie/internal
ggbdpq 8daab00a2e gateway: a completion call Antigravity's model wrote into its text goes out of the history, the answer it repeated staying (#5091)
What changed
- buildCodeAssistSent (internal/gateway/codeassist.go) hands an Antigravity
  request's history through dropPseudoCalls (internal/gateway/textcalls.go).
- dropPseudoCalls rewrites a model turn only when nothing structured is in
  it, a whole call written out in its text is there — of a tool the request
  offers, its arguments readable by the readers Chat replies already go
  through (<tool_call>'s JSON and pairs, an invoke with its parameters),
  closed — and the text after it says the call's result again, up to
  punctuation, spacing and case. The turn then goes upstream as that text
  without the call. msgs is not changed: a fallback builds from the same
  request.

Why
- #5091 (Phoenix12580): gemini-4-argon deep in a long session wrote the
  completion call it meant into its reply's text — the report's two-sided
  SSE capture shows every part Google returned is text, none a
  functionCall — so the client ran nothing and read the call's arguments
  as the answer's lead. The turn came back in the history as that text,
  and every later turn read its own wrapper back and wrote the next one
  the same way; clearing such turns from the history restored normal
  calls in the report's own controlled try.

Not changed
- A reply that carries its call as text still streams as it came: the
  report asks for no call read out of a live reply, and none is made.
- The gemini and vertex requests keep their histories as they came; the
  report is the Antigravity route.
- A wrapper the readers can't read — a call:default_api: whose arguments
  textArgs refuses, a shape with none of the marks, a call example inside
  a code fence — stays in the history; the report's conditions are kept
  to what can be checked.
- No receive-side counter is added: the reply's decoder has no logger of
  its own, and the shapes it reads are the report's own open question.

Run
- TestAntigravityPseudoCallOutOfHistory
  (internal/gateway/textcalls_pseudo_test.go): red before the change, the
  wrapper, the split-block and the invoke cases each failing with the call
  still in the turn, green after, and red again with the ag wiring taken
  back out of buildCodeAssistSent
- go test -tags nogui -count=1 -run 'TestAntigravityPseudoCallOutOfHistory|TestCodeAssist|TestTextCall|TestTextWritten' ./internal/gateway/: ok 5.016s
- go test -race -tags nogui -count=1 -run 'TestAntigravityPseudoCall|TestCodeAssistTextCalls|TestTextWrittenCall|TestTextCalls' ./internal/gateway/: ok 2.952s
- go test -tags nogui -count=1 -timeout 25m ./internal/gateway/: ok 600.353s
- gofmt -l internal/gateway/codeassist.go internal/gateway/textcalls.go
  internal/gateway/textcalls_pseudo_test.go: empty
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: clean
- go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok

Reviewed and ported (on origin/main 1b0340fdb, cherry-picked clean):
- Read: only the Antigravity envelope (ag) is rewritten, only model
  turns with no structured part, only a whole closed call of an offered
  tool whose result the text after it repeats; r.Messages is untouched,
  and the rewrite is the same on every request, so the history prefix
  stays stable. Nothing is added to the prompt.
- mote: TestAntigravityPseudoCallOutOfHistory green. With codeassist.go
  and textcalls.go put back to main it is red on the wrapper, the
  split-block and the invoke cases ("the pseudo call stayed in the
  turn sent to Antigravity: ...").
- mote: go test -tags nogui -timeout 45m ./internal/gateway ok (1009s);
  vet darwin/linux/windows ok; gofmt -l clean.
Not tried: a real Antigravity long session; the reporter's own
controlled replay is the evidence that clearing such turns helps.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
Generated-by: GLM-5.3-Flash (ZCode)
2026-11-05 18:31:17 +08:00
..
…
…
…
…
…
…
…