gateway: a group skips Antigravity for the system prompt it just turned away (#2156)

Antigravity answers Claude Code's and the Agent SDK's system prompt (the
x-anthropic-billing-header line, "built on Anthropic's Claude Agent SDK")
with 429 "Resource has been exhausted" whatever quota is left (#666).
magpie already tells it as prompt_turned_away, rests nobody and hands it
on, but each Claude Desktop turn in a group waited on the same refusal
first (#2156: 429 in 1073ms, then cursor/composer-2.5 200).

Now, once Antigravity has turned such a request away (any of the three
paths that set holdWriter.turnedAway), for agForeseeing (6h) after, the
candidate loop skips an Antigravity candidate for a request that carries
the line, when someone is left after it (antigravityForeseen). The skip
goes in Fallback with the hint, sets `other` as the asked path does, and
changes no account state. The last one left is still asked and told the
400 with the hint. A request without the line (titles, Codex) still goes.
An old refusal foresees nothing, so a block Google lifts is noticed. The
lines are still neither rewritten nor hidden (#666). The stamp is per
Server, in memory.

TestAntigravityTurnedAwayRestsNobody's "asked first again" half now
checks it with a turn without the line, since one with it is foreseen.

Run:
- TestAntigravityTurnedAwayIsForeseen: fails with the skip turned off
  ("Antigravity was asked again for the prompt it just turned away"),
  passes with it; TestAntigravity* -count=3 green.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
- go test -tags nogui ./... in a sandbox HOME at load average 140-220:
  everything green except 10m timeouts in agent, cli, gateway, library,
  provider and TestSetAnswersWhileDevinAndProvidersHang (#1375, noted
  there); those six packages rerun with -timeout 45m: all ok.
Not tried: the skip against the real Antigravity account (the refusal
itself was reproduced with a real account before: 400 with the line,
200 without), nor Windows/Claude Desktop as the reporter uses. No GUI
change.
This commit is contained in:
yetone
2026-10-14 18:41:56 +08:00
parent 9bc9a6e5e1
commit a4d580fa24
4 changed files with 106 additions and 3 deletions
+1 -1
View File
@@ -140,7 +140,7 @@ recorded as a prediction failure (`noPrediction`).
- A model the user ticked no levels of (`ModelReasonless` in [settings](../../internal/settings/settings.go), `SetModelReasonless`; the provider editor's Names & levels, or `magpie model efforts <provider/model> off`) is sent no reasoning field on any route, whatever the agent asks: the candidate loop strips the body with `withoutAnyReasoning` ([`quiet.go`](../../internal/gateway/quiet.go): Chat's `reasoning_effort`, `reasoning`, `thinking`, `enable_thinking` and `include`'s `reasoning.encrypted_content`, Responses' `reasoning`, Anthropic's `thinking` of any type and `output_config.effort`, Gemini's `thinkingConfig`), the Anthropic relay doesn't add `thinking:{type:disabled}` for it, and `forwardTranslated` clears `Effort`, `ThinkOff` and `Thinking` for its other callers. It offers no levels (`Efforts`, `entryFor`), is `Quiet`, and as a routing-group member doesn't take the group's levels away. The learned refusals above cover only reasoning *off* and Gemini levels; a vendor that answers a plain `reasoning_effort` with 422 (yuexian7 on Discord) is not learned, so this is the user's switch. `TestReasonlessModelSentNoReasoning`, `TestReasonlessAnthropicRelay`, `TestGroupReasonlessMemberKeepsLevels`, `model-reasonless.test.cjs`. - A model the user ticked no levels of (`ModelReasonless` in [settings](../../internal/settings/settings.go), `SetModelReasonless`; the provider editor's Names & levels, or `magpie model efforts <provider/model> off`) is sent no reasoning field on any route, whatever the agent asks: the candidate loop strips the body with `withoutAnyReasoning` ([`quiet.go`](../../internal/gateway/quiet.go): Chat's `reasoning_effort`, `reasoning`, `thinking`, `enable_thinking` and `include`'s `reasoning.encrypted_content`, Responses' `reasoning`, Anthropic's `thinking` of any type and `output_config.effort`, Gemini's `thinkingConfig`), the Anthropic relay doesn't add `thinking:{type:disabled}` for it, and `forwardTranslated` clears `Effort`, `ThinkOff` and `Thinking` for its other callers. It offers no levels (`Efforts`, `entryFor`), is `Quiet`, and as a routing-group member doesn't take the group's levels away. The learned refusals above cover only reasoning *off* and Gemini levels; a vendor that answers a plain `reasoning_effort` with 422 (yuexian7 on Discord) is not learned, so this is the user's switch. `TestReasonlessModelSentNoReasoning`, `TestReasonlessAnthropicRelay`, `TestGroupReasonlessMemberKeepsLevels`, `model-reasonless.test.cjs`.
- A request to an Anthropic endpoint with `temperature`, `top_p` or `top_k` reaches a model that refuses them without them (`samplingAsTaken`, beside `thinkingOffAsTaken` in `forwardOnce`): Opus 4.7, 4.8, 5 and 5.5, Fable 5, Mythos 5, Sonnet 5 and 5.5, and Haiku 5.5, whose 400 is "`temperature` is deprecated for this model" (Claude Code's auto mode classifier and magpie's own classifiers ask at temperature 0). Older Claudes, Haiku 4.5 among them, other vendors' models and later lines go as they came (#1454). A Claude by a name these rules can't read, answering that a sampling parameter is deprecated (`samplingDeprecated`), is asked again without them, once — a Chat or Responses client's request translated to Messages (`forwardTranslated`) as much as a relayed one. - A request to an Anthropic endpoint with `temperature`, `top_p` or `top_k` reaches a model that refuses them without them (`samplingAsTaken`, beside `thinkingOffAsTaken` in `forwardOnce`): Opus 4.7, 4.8, 5 and 5.5, Fable 5, Mythos 5, Sonnet 5 and 5.5, and Haiku 5.5, whose 400 is "`temperature` is deprecated for this model" (Claude Code's auto mode classifier and magpie's own classifiers ask at temperature 0). Older Claudes, Haiku 4.5 among them, other vendors' models and later lines go as they came (#1454). A Claude by a name these rules can't read, answering that a sampling parameter is deprecated (`samplingDeprecated`), is asked again without them, once — a Chat or Responses client's request translated to Messages (`forwardTranslated`) as much as a relayed one.
- Claude Code's auto mode asks the API to review each action ([`automode.go`](../../internal/gateway/automode.go), Anthropic's [auto-mode-classifier-billing](https://code.claude.com/docs/en/auto-mode-classifier-billing)): the `dangerous-tool-use-…` beta, a `safeguards` field, and `safeguard_results` in the reply (a stream's in its `message_delta`). Only Anthropic runs that classifier, so they reach only a route it answers on (`AutoModeReviewed`): the Claude subscription (the bridge hands them to Claude Code's own binary), a Claude model under any vendor's spelling (Anthropic's API, a relay, Bedrock, Vertex), and anything on `api.anthropic.com`. There the beta, `safeguards` and the results pass as sent, a whole reply's results moved into a stream's `message_delta` (`anthropicWholeEvents`), tool-use ids unchanged. To any other model they are taken off (`serverReview`; a translation never carries them), and magpie never answers a result on Anthropic's behalf. Claude Code then classifies locally and names the gateway in a notice; the wiring turns the review off in its settings while no model it can reach through magpie is reviewed (`claudeReviewEnv`, [agent wiring](agent-wiring.md)), which is the page's remedy for a gateway that can't run the checks (1EFLOPS on X: Codex's model behind magpie). - Claude Code's auto mode asks the API to review each action ([`automode.go`](../../internal/gateway/automode.go), Anthropic's [auto-mode-classifier-billing](https://code.claude.com/docs/en/auto-mode-classifier-billing)): the `dangerous-tool-use-…` beta, a `safeguards` field, and `safeguard_results` in the reply (a stream's in its `message_delta`). Only Anthropic runs that classifier, so they reach only a route it answers on (`AutoModeReviewed`): the Claude subscription (the bridge hands them to Claude Code's own binary), a Claude model under any vendor's spelling (Anthropic's API, a relay, Bedrock, Vertex), and anything on `api.anthropic.com`. There the beta, `safeguards` and the results pass as sent, a whole reply's results moved into a stream's `message_delta` (`anthropicWholeEvents`), tool-use ids unchanged. To any other model they are taken off (`serverReview`; a translation never carries them), and magpie never answers a result on Anthropic's behalf. Claude Code then classifies locally and names the gateway in a notice; the wiring turns the review off in its settings while no model it can reach through magpie is reviewed (`claudeReviewEnv`, [agent wiring](agent-wiring.md)), which is the page's remedy for a gateway that can't run the checks (1EFLOPS on X: Codex's model behind magpie).
- Claude Code's billing line (`x-anthropic-billing-header: cc_version=…; cc_entrypoint=…; cch=…;`, its own first system block, `cch` changing every turn) goes on only to a Claude model asked on Anthropic's Messages API (`keepsBillingLine` in [`billing_line.go`](../../internal/gateway/billing_line.go): Anthropic's, a relay's, Bedrock's), as Claude Code sent it. Anywhere else it is left out, the rest of the system as sent (`withoutBillingLine`): a vendor's model relayed on Messages (`passthrough`), every translation to Chat, Responses or Gemini (`forwardTranslated`, Claude models too), and the subscriptions asked through their own clients' APIs (Cursor, Devin, Kiro, Qoder, Zed, Command Code's Go plan, in `attempt`). Kept, a vendor read it as the prompt's first words and its prefix cache missed from byte 0 every turn (#1600, justrun1983: 4% read from DeepSeek's cache behind Command Code's plan). The Claude subscription's run sends its own (`withoutBillingHeader`), another magpie decides for the provider it picks, and Code Assist (Antigravity, Gemini CLI) is sent it as before, which `antigravityTurnsAway` reads (#666). - Claude Code's billing line (`x-anthropic-billing-header: cc_version=…; cc_entrypoint=…; cch=…;`, its own first system block, `cch` changing every turn) goes on only to a Claude model asked on Anthropic's Messages API (`keepsBillingLine` in [`billing_line.go`](../../internal/gateway/billing_line.go): Anthropic's, a relay's, Bedrock's), as Claude Code sent it. Anywhere else it is left out, the rest of the system as sent (`withoutBillingLine`): a vendor's model relayed on Messages (`passthrough`), every translation to Chat, Responses or Gemini (`forwardTranslated`, Claude models too), and the subscriptions asked through their own clients' APIs (Cursor, Devin, Kiro, Qoder, Zed, Command Code's Go plan, in `attempt`). Kept, a vendor read it as the prompt's first words and its prefix cache missed from byte 0 every turn (#1600, justrun1983: 4% read from DeepSeek's cache behind Command Code's plan). The Claude subscription's run sends its own (`withoutBillingHeader`), another magpie decides for the provider it picks, and Code Assist (Antigravity, Gemini CLI) is sent it as before, which `antigravityTurnsAway` reads (#666). Once Antigravity has turned such a request away, for `agForeseeing` (6 hours) after, a candidate loop with someone left after an Antigravity account skips it for a request that carries the line, without asking it (`antigravityForeseen`, #2156: each Claude Desktop turn waited about a second on the same refusal before the next member). The skip goes in `Fallback` with the hint, nothing rests, and the agent is told the refusal if nobody after it answers but with a quota. The last one left is still asked, and an old refusal foresees nothing, so a block Google lifts is noticed (`TestAntigravityTurnedAwayIsForeseen`).
- Claude Code's advisor (`/advisor`, `--advisor`) is Anthropic's server tool `advisor_20260301`, its `model` named as Claude Code names its own: on magpie, by magpie's id (the tier an alias like `opus` is on), which no vendor knows, so the request was turned away whole (JackChou on Discord). Relayed on Messages (`passthrough`), the advisor's model goes as the upstream's own name for it when it is the same provider's Claude model, or a Claude id naming no provider (`advisorTools` in [`advisor.go`](../../internal/gateway/advisor.go)); one it can't run there (another provider's, a group, not Claude's) is left out, as is every advisor when the request's own model isn't a Claude model (a vendor's Messages API knows no such tool), and the turn is answered without one. A translation drops it with every other server tool. The Claude subscription's run declares only magpie's tools, so it never has one. `TestAdvisorModelAsTheUpstreamNamesIt`. - Claude Code's advisor (`/advisor`, `--advisor`) is Anthropic's server tool `advisor_20260301`, its `model` named as Claude Code names its own: on magpie, by magpie's id (the tier an alias like `opus` is on), which no vendor knows, so the request was turned away whole (JackChou on Discord). Relayed on Messages (`passthrough`), the advisor's model goes as the upstream's own name for it when it is the same provider's Claude model, or a Claude id naming no provider (`advisorTools` in [`advisor.go`](../../internal/gateway/advisor.go)); one it can't run there (another provider's, a group, not Claude's) is left out, as is every advisor when the request's own model isn't a Claude model (a vendor's Messages API knows no such tool), and the turn is answered without one. A translation drops it with every other server tool. The Claude subscription's run declares only magpie's tools, so it never has one. `TestAdvisorModelAsTheUpstreamNamesIt`.
- Kiro is told where to cache the prompt (plugins#110: a Kiro subscription read 0 from its cache). Its API takes Bedrock's `cachePoint: {"type":"default"}` on a `userInputMessage`, an `assistantResponseMessage` or as a tool entry. The built-in (`buildKiro` in [`kiro.go`](../../internal/gateway/kiro.go)) marks the first message when there is a system prompt, which it folds into that message, and the current message, as `buildAnthropic` marks Anthropic's. A moved Kiro's plugin (opencode-kiro-auth 0.1.10, the mover's `min`) turns each `cache_control` in the Anthropic body it is handed into one, at most 4, the last kept. - Kiro is told where to cache the prompt (plugins#110: a Kiro subscription read 0 from its cache). Its API takes Bedrock's `cachePoint: {"type":"default"}` on a `userInputMessage`, an `assistantResponseMessage` or as a tool entry. The built-in (`buildKiro` in [`kiro.go`](../../internal/gateway/kiro.go)) marks the first message when there is a system prompt, which it folds into that message, and the current message, as `buildAnthropic` marks Anthropic's. A moved Kiro's plugin (opencode-kiro-auth 0.1.10, the mover's `min`) turns each `cache_control` in the Anthropic body it is handed into one, at most 4, the last kept.
- A model that refuses a conversation ending with the assistant's message (`refusesPrefill`: OpenCode Go's Claude models over Messages, "This model does not support assistant message prefill"; Volcengine's Agent Plan, "…for a model that does not support prefill"; Gemini's, "Requests ending with a model turn are not supported") is marked for that provider, model and API (`prefillRefused`, #1447); the provider's other models keep their prefill ([`prefill.go`](../../internal/gateway/prefill.go)). A Chat or Responses client's conversation ending with the assistant's message, which those APIs read as a turn already said (`Request.LastIsTurn`), is asked again with a user turn after it (`continueText`), translated (`forwardTranslated`) or relayed (`passthrough`, `userLastBody`), and so from then on. An Anthropic client's prefill is its own ask and gets the refusal as sent. magpie's own continuation of a cut reply (`continuation.go`) isn't asked of that model again; the try the model refused ends the reply with what cut it, not with the refusal. A request magpie builds in Gemini's own shape (`buildCodeAssistSent`: Vertex AI, Gemini CLI's and Antigravity's Code Assist, Factory) never ends with the model's turn, which all of them turn away: a user turn goes after it, `continueText`, or `compactLastText` when an agent is compacting with its ask in the system prompt (`modelLastAsk`), as one goes before a history that opens with the model's. Nor does it send a user turn that mixes a tool's `functionResponse` with text, which Vertex AI answers with the same "ending with a model turn" (#1533: Codex's compaction prompt after a tool's output): what the user said goes in a user turn of its own after the tools' responses (`hasResponse`), except for a Claude model on Antigravity, whose tool_result turn holds both. - A model that refuses a conversation ending with the assistant's message (`refusesPrefill`: OpenCode Go's Claude models over Messages, "This model does not support assistant message prefill"; Volcengine's Agent Plan, "…for a model that does not support prefill"; Gemini's, "Requests ending with a model turn are not supported") is marked for that provider, model and API (`prefillRefused`, #1447); the provider's other models keep their prefill ([`prefill.go`](../../internal/gateway/prefill.go)). A Chat or Responses client's conversation ending with the assistant's message, which those APIs read as a turn already said (`Request.LastIsTurn`), is asked again with a user turn after it (`continueText`), translated (`forwardTranslated`) or relayed (`passthrough`, `userLastBody`), and so from then on. An Anthropic client's prefill is its own ask and gets the refusal as sent. magpie's own continuation of a cut reply (`continuation.go`) isn't asked of that model again; the try the model refused ends the reply with what cut it, not with the refusal. A request magpie builds in Gemini's own shape (`buildCodeAssistSent`: Vertex AI, Gemini CLI's and Antigravity's Code Assist, Factory) never ends with the model's turn, which all of them turn away: a user turn goes after it, `continueText`, or `compactLastText` when an agent is compacting with its ask in the system prompt (`modelLastAsk`), as one goes before a history that opens with the model's. Nor does it send a user turn that mixes a tool's `functionResponse` with text, which Vertex AI answers with the same "ending with a model turn" (#1533: Codex's compaction prompt after a tool's output): what the user said goes in a user turn of its own after the tools' responses (`hasResponse`), except for a Claude model on Antigravity, whose tool_result turn holds both.
+62 -2
View File
@@ -151,8 +151,9 @@ func TestAntigravityTurnedAwayRestsNobody(t *testing.T) {
if _, ok := restOf("antigravity@u@example.com"); ok { if _, ok := restOf("antigravity@u@example.com"); ok {
t.Fatalf("antigravity@u@example.com rests for a request it answered with a refusal: %v", rests()) t.Fatalf("antigravity@u@example.com rests for a request it answered with a refusal: %v", rests())
} }
// the same account is asked first again on the next turn // the same account is asked first again on the next turn that doesn't
code, out = turnOn(t, s, claudeTurn(claudeCodeSystem)) // carry that system prompt (one that does is foreseen, #2156)
code, out = turnOn(t, s, claudeTurn("You are a helpful assistant."))
if code != 200 || !strings.Contains(out, "from the other") { if code != 200 || !strings.Contains(out, "from the other") {
t.Fatalf("the next turn: %d %s", code, out) t.Fatalf("the next turn: %d %s", code, out)
} }
@@ -161,6 +162,65 @@ func TestAntigravityTurnedAwayRestsNobody(t *testing.T) {
} }
} }
// #2156: once Antigravity has turned the system prompt away, the group's
// next turn carrying it doesn't wait on the same refusal: Antigravity isn't
// asked, the member after it answers, and the skip says why. A turn without
// that prompt still asks it, the account alone is still asked (and told
// as before), and once the last refusal is old, it is asked again, so a
// block Google lifts is noticed.
func TestAntigravityTurnedAwayIsForeseen(t *testing.T) {
asked := 0
s, askedUsage := antigravityTurnedAwayGroup(t, []string{"u@example.com"}, func(w http.ResponseWriter, r *http.Request) {
asked++
w.WriteHeader(http.StatusTooManyRequests)
io.WriteString(w, turnedAway)
})
if code, out := turnOn(t, s, claudeTurn(claudeCodeSystem)); code != 200 || !strings.Contains(out, "from the other") {
t.Fatalf("the first turn: %d %s", code, out)
}
if asked != 1 {
t.Fatalf("the first turn asked Antigravity %d times", asked)
}
// the next turn with that prompt: only the other member is asked
if code, out := turnOn(t, s, claudeTurn(claudeCodeSystem)); code != 200 || !strings.Contains(out, "from the other") {
t.Fatalf("the next turn: %d %s", code, out)
}
if asked != 1 {
t.Fatalf("Antigravity was asked again for the prompt it just turned away")
}
if r := lastRoute(s); len(r.Tries) != 1 || r.Tries[0].ID != "other" {
t.Fatalf("the next turn asked %+v", r.Tries)
}
if c := s.Recent()[0]; !strings.Contains(c.Fallback, antigravityTurnedAwayHint) {
t.Fatalf("the skip doesn't say why: %q", c.Fallback)
}
if *askedUsage != 0 {
t.Fatalf("the account's usage was asked again %d times", *askedUsage)
}
if _, ok := restOf("antigravity@u@example.com"); ok {
t.Fatalf("the skipped account rests: %v", rests())
}
// the Agent SDK's identity line is foreseen as the billing line is
if code, _ := turnOn(t, s, claudeTurn("You are a Claude agent, built on Anthropic's Claude Agent SDK.")); code != 200 || asked != 1 {
t.Fatalf("the SDK's turn: %d, Antigravity asked %d times", code, asked)
}
// Antigravity alone, the last one left: still asked, and told why
code, out := turnOn(t, s, directTurn(claudeCodeSystem, false))
if code != http.StatusBadRequest || !strings.Contains(out, antigravityTurnedAwayHint) || asked != 2 {
t.Fatalf("Antigravity alone: %d (asked %d times) %s", code, asked, out)
}
// an old refusal foresees nothing: it is asked again
s.agTurnedAway.Store(time.Now().Add(-agForeseeing - time.Minute).UnixNano())
if code, _ := turnOn(t, s, claudeTurn(claudeCodeSystem)); code != 200 || asked != 3 {
t.Fatalf("after an old refusal: %d, Antigravity asked %d times", code, asked)
}
// a turn without it (a title, Codex) still asks Antigravity first; last,
// as this upstream answers it with the 429 that is a quota and rests it
if code, _ := turnOn(t, s, claudeTurn("You are a helpful assistant.")); code != 200 || asked != 4 {
t.Fatalf("a turn without that prompt: %d, Antigravity asked %d times", code, asked)
}
}
// A 429 that really is the plan used up — no such system prompt asking — // A 429 that really is the plan used up — no such system prompt asking —
// still rests the account, as it did (#147, #530). // still rests the account, as it did (#147, #530).
func TestAntigravityQuotaStillRests(t *testing.T) { func TestAntigravityQuotaStillRests(t *testing.T) {
+24
View File
@@ -8,6 +8,7 @@ import (
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
"time"
"github.com/yetone/magpie/internal/catalog" "github.com/yetone/magpie/internal/catalog"
"github.com/yetone/magpie/internal/provider" "github.com/yetone/magpie/internal/provider"
@@ -73,6 +74,29 @@ func antigravityTurnedAway(p provider.Provider, system, said string) bool {
return accountAgent(p) == "antigravity" && antigravityTurnsAway(system) && antigravityRefuses(said) return accountAgent(p) == "antigravity" && antigravityTurnsAway(system) && antigravityRefuses(said)
} }
// agForeseeing is how long after Antigravity last turned that system prompt
// away a group still skips it for one, without asking: long enough that a
// conversation doesn't wait on the same refusal turn after turn, short
// enough that a block Google lifts is noticed on the next request after it.
const agForeseeing = 6 * time.Hour
// antigravityForeseen says whether p is an Antigravity account that would
// turn body away: it carries the system prompt Antigravity refuses, and
// Antigravity has refused it within agForeseeing. It holds for exactly the
// requests antigravityTurnedAway would tell as the refusal, and it changes
// nothing about the account.
func (s *Server) antigravityForeseen(p provider.Provider, from provider.Protocol, body []byte) bool {
if accountAgent(p) != "antigravity" {
return false
}
at := s.agTurnedAway.Load()
if at == 0 || time.Since(time.Unix(0, at)) > agForeseeing {
return false
}
req, err := parse(from, body)
return err == nil && antigravityTurnsAway(req.System)
}
// antigravityTurnedAwayHint is what magpie adds to Antigravity's words, after // antigravityTurnedAwayHint is what magpie adds to Antigravity's words, after
// " — ", for the agent and the Routing page, which says it apart from them in // " — ", for the agent and the Routing page, which says it apart from them in
// its own language (routing.js AG_TURNED_AWAY). // its own language (routing.js AG_TURNED_AWAY).
+19
View File
@@ -377,6 +377,10 @@ type Server struct {
requestLimits requestLimits requestLimits requestLimits
// what a restart would cut short (busy.go) // what a restart would cut short (busy.go)
busyCounters busyCounters
// when Antigravity last turned away the system prompt it refuses
// (UnixNano, 0 for never): while that is recent, a group skips it for
// such a request when someone is left after it (antigravityForeseen)
agTurnedAway atomic.Int64
} }
// New makes a gateway. // New makes a gateway.
@@ -2143,6 +2147,18 @@ func (s *Server) serve(w http.ResponseWriter, r *http.Request, from provider.Pro
attemptBody, _ = textOnlyBody(from, body) // omit images in prior turns and tool results attemptBody, _ = textOnlyBody(from, body) // omit images in prior turns and tool results
} }
} }
if !last && s.antigravityForeseen(c.p, from, attemptBody) {
// Antigravity would only turn it away, as it did lately, and
// someone after it may answer: it isn't asked, and nothing is
// held against the account (#2156). If nobody after it answers
// but with a quota, the agent is told this, as it would be had
// Antigravity been asked
if other == nil {
other = &Try{Status: turnedAwayStatus, Error: c.p.Name + ": " + antigravityTurnedAwayHint}
}
skipped = append(skipped, c.label()+": "+antigravityTurnedAwayHint)
continue
}
// a group tells agents the longest reply a member of it gives // a group tells agents the longest reply a member of it gives
// (groupEntries); each member is asked for no more than its own // (groupEntries); each member is asked for no more than its own
if isGroup { if isGroup {
@@ -2409,6 +2425,9 @@ func (s *Server) serve(w http.ResponseWriter, r *http.Request, from provider.Pro
call.Error = c.p.Name + ": " + provider.APIError([]byte(hw.failMsg), hw.failMsg) call.Error = c.p.Name + ": " + provider.APIError([]byte(hw.failMsg), hw.failMsg)
} }
} }
if hw.turnedAway {
s.agTurnedAway.Store(time.Now().UnixNano())
}
if hw.turnedAway && !strings.HasSuffix(call.Error, antigravityTurnedAwayHint) { if hw.turnedAway && !strings.HasSuffix(call.Error, antigravityTurnedAwayHint) {
call.Error += " — " + antigravityTurnedAwayHint call.Error += " — " + antigravityTurnedAwayHint
} }