Commit Graph
4 Commits
Author SHA1 Message Date
yetone e8050e812d kiro 0.1.24: a conversation past the model's window is a 400 that says too long
Kiro says a conversation is too long for the model three ways: an HTTP
400 ValidationException "Input is too long." (CONTENT_LENGTH_EXCEEDS_THRESHOLD),
the same ValidationException as an exception frame in the event stream,
or a metadataEvent with stopReason MODEL_CONTEXT_WINDOW_EXCEEDED. Only the
first came out as the 400 "input is too long for the model's context: ..."
that magpie's gateway reads as an overflow (tooLong). The stream exception
went out as a 502 (failedBefore), and the stop reason as end_turn.

As a 502, magpie counted a passing failure: it asked the same Kiro model
again, could rest the account, and in a group routed by intent only moved
on as for any vendor error; a lone agent got a vendor error instead of
context_length_exceeded, so it never compacted. Reported by
ergou0954_54426 on Discord (Kiro's Claude/GPT and DeepSeek in intent
routing, "kiro 那边报错说超出上下文").

Now failedBefore, and the turn after a web search, answer a too-long
exception with that 400. A MODEL_CONTEXT_WINDOW_EXCEEDED stop before any
of the reply is the same 400; after some of it, the reply ends with stop
reason model_context_window_exceeded (Anthropic's word for it). Other
exceptions keep 502, quota and throttling keep 429.

Run on mote: HOME=$(mktemp -d) bun test in packages/kiro, 122 pass;
bun scripts/check.mjs ok. Broken by hand: with index.mjs at HEAD the
three new too-long tests fail (13 pass, 3 fail in errors.test.mjs).
Not tried: a real Kiro account pushed past its window; the stream shapes
come from Kiro's own clients (amazon-q-developer-cli's error enums,
kiro.rs, opencodex's kiro stream reader).
2026-11-01 11:11:02 +08:00
yetone 01aee5da28 all: a usage read says what it means for the sign-in, and a renewal clears the mark whatever follows, as the built-ins did (要保证插件跟内置的所有逻辑都要一模一样) — auth.usage returns signIn on every path: expired where the built-in's quota read marked the account (Zed's /users/me 401, Factory's and MiMo's refused renewals, Qoder's refused job refresh), renewed after a renewal, which took the mark off, kept everywhere else, so magpie no longer guesses from the words 'sign in again' (Kiro's, Devin's and ZCode's usage errors marked accounts their built-ins never did) nor clears on a clean read. A request after a renewal says renewed on any status; one without says kept, as the built-ins cleared only on renewal. Kiro, Cursor, Devin, Command Code, WorkBuddy, Grok and ZCode, whose built-ins never marked an account, say kept on every answer. New tests fail against 85d7dd0's index.mjs. 2026-10-01 04:53:29 +08:00
yetone 85d7dd0d0a all: each plugin fails with its built-in's status and marks the sign-in as it did, through X-Magpie-Sign-In (要保证插件跟内置的所有逻辑都要一模一样) — Factory's and MiMo's refused renewals are the built-ins' 502 marked expired, not 401s; Qoder's vendor 403 is the built-in's 401 kept, its model list's failure a 400, its job refresh refused marked expired; Zed's retried 401 is a 401 kept, not a 403; Kiro's unreachable refresh a 401 kept; Cursor's expired trial a 401 kept; a vendor 401 WorkBuddy, Grok, Devin, Command Code and ZCode passed on no longer marks the account, as their built-ins never did, and Grok and MiMo no longer retry what their built-ins sent once. Messages take the built-ins' words. New tests fail against the previous index.mjs. 2026-10-01 04:47:03 +08:00
yetone 8efe85163c kiro 0.1.4: an exception Kiro sends before any of the answer (a throttle, a quota, a server error) is a status, not a 200 stream holding an error event, as the built-in's relay answers it: a 429 when it reads as a quota or rate limit (magpie's quotaWords), else a 502, so magpie moves on to the next account exactly as it did; unstreamed, what was said before a later exception is the answer, as the built-in's collector gives it, where the plugin answered 502. errors.test.mjs fails without the change. 2026-10-01 03:45:12 +08:00