Text sampling 502s on anna.partners-platform-side text-model outage, not an app bug

Heads-up for anyone who hit 502 Bad Gateway on text calls in that window:

What happened: Every text reverse-RPC (sampling/createMessage, agent/complete) returned HTTP 502, while image/generate succeeded over the exact same auth + reverse-RPC + Cloudflare path. GET / and /api/v1/health were both 200.

Root cause: A brief outage of the text-model upstream on anna.partners. The gateway couldn’t get a valid response from the LLM completion backend → 502. The image backend is a separate upstream and stayed healthy.

Why it’s not your app / auth / SDK: Image generation working over the identical path rules out auth, grants, protocol, the SDK, and Cloudflare-in-general. The errors are upstream signals: agent/complete → -32046 (AGENT_ERR_PROVIDER_ERROR — catch-all incl. /copilot/app/complete returning 5xx), and sampling → -32000 wrapping the raw HTTP 502.

Good news: No quota leak — the throw-away session is always torn down in finally, so retrying is safe.

What to do: Retry (it was a ~4-minute window and likely self-healed). If it persists, escalate to whoever runs the anna.partners text-model gateway with the timestamp window + the “text 502 / image OK” contrast. App correctness (e.g. for hackathon review) can be re-verified once the text upstream is back.

Hi @YuntianBi! :waving_hand: Huge thanks for such a sharp, well-structured write-up — the “text 502 / image OK” contrast and the throw-away-session teardown detail are exactly the kind of signal that makes triage fast. :raising_hands: This is really helpful for the whole community. :yellow_heart:

You’re right that a brief text-upstream blip can cause this. To make sure we pin down the exact cause (a short self-healing outage looks identical on the surface to a couple of other issues :magnifying_glass_tilted_left:), could you share a bit more when you have a moment? A few targeted details go a long way:

What would help us localize it fast :hammer_and_wrench:

  1. Timestamp window (with timezone) :three_o_clock:
    e.g. 2026-06-18 14:32–14:36 UTC — lets us line it up against upstream/gateway logs for that exact window.

  2. Which model was selected :puzzle_piece:
    The specific model name in the picker at failure time (e.g. qwen3.7-plus, google/gemini-3-flash-preview, or the free Gemma 4 E4B-it). This matters a lot — a single-model failure vs. all-models failure points to very different root causes.

  3. Was it all text models, or just one? :bullseye:
    Did switching to another model (e.g. from Gemma → a Qwen/Gemini option) also 502, or did it recover? “Every model failed” vs. “only one failed” is the single most useful disambiguator.

  4. The raw error body / code :page_facing_up:
    The exact string you saw, e.g.:

    • -32000 wrapping a bare HTTP 502 with an empty body, vs.
    • an application-level message like 404 — The model '...' does not exist
      These look similar but mean completely different things. :blush:
  5. Path contrast you already noticed :shuffle_tracks_button:
    You nailed this one — confirming image.generate succeeded on the same auth/reverse-RPC/Cloudflare path in the same window is gold for ruling out auth/SDK/protocol. :trophy:

  6. Duration & retry behavior :stopwatch:
    Was it a short window that self-healed on retry (sounds like ~4 min here), or persistent and reproducible every time? Self-healing → likely a transient upstream blip; persistent + reproducible → more likely something deterministic we can patch.

Example of an ideal report :clipboard:

When: 2026-06-18 14:32–14:36 UTC
Model: Gemma 4 E4B-it
Scope: only Gemma failed; qwen3.7-plus worked in the same window
Error: 404 — The model 'gemma-...' does not exist
Contrast: image.generate OK on the same path
Pattern: persistent, reproduced every retry

That single block usually tells us whether it’s a transient upstream outage, a model that’s been rotated/retired, or a code-path issue — and gets you a precise fix or all-clear much faster. :rocket:

Thanks again for being so thorough and community-minded — drop the details whenever you can and we’ll dig right in! Excited to keep your builds running smoothly. :clapper_board::sparkles:

Happy building! :yellow_heart: