Hollowhere (magpie 0.1.1319, kiro-cli 2.33.1, macOS) signed in to Kiro in
magpie with a Kiro API key. /v1/models listed kiro/auto alone, and every
request failed with "Kiro: Kiro didn't take the API key: 400 Bad Request",
while kiro-cli listed claude-opus-5.5 and claude-sonnet-5.5 and chatted
with the same key.
Cause: the plugin asked GetProfile in us-east-1 only and threw on any
answer but a profile, so a key GetProfile has no profile for never got
further: the model list fell back to Auto and every request failed with
that 400. kiro-cli 2.32.0 (installed here), traced with KIRO_API_KEY set
to a made-up key in a sandbox HOME, every host behind a local proxy that
refused all of them (nothing left the machine), and then with
api.cps.service/api.krs.service/api.codewhisperer.service pointed at a
local recorder:
- asks GetProfile (POST management/, X-Amz-Target
AmazonCodeWhispererService.GetProfile, body {}) in us-east-1, then
eu-central-1, then GovCloud and ISO, and with every one refused goes on
to list models and chat in us-east-1 all the same;
- lists models with the control plane's ListAvailableModels (POST
management/?origin=KIRO_CLI, X-Amz-Target
KiroControlPlaneBearerService.ListAvailableModels, body
{"origin":"KIRO_CLI"}, paged with nextToken), not the REST
List-Available-Models with a profileArn;
- reads credits with GetUsageLimits (same shape, body {"origin":"KIRO_CLI"});
- names no profileArn in generateAssistantResponse, ListAvailableModels
or GetUsageLimits, even when GetProfile gave one;
- sends each with Content-Type application/x-amz-json-1.0,
Authorization: Bearer <key>, tokentype: API_KEY (as the plugin did).
The plugin now does the same for an API key: GetProfile in us-east-1 then
eu-central-1, once per key; a found profile only picks the region; none
found means us-east-1. Its models are ListAvailableModels as above, its
credits GetUsageLimits as above, and its chat names no profile. Sign-ins
other than an API key are unchanged.
Run, in packages/kiro, H=$(mktemp -d); HOME="$H" bun test: 55 pass at
this head (rebased on origin/main 4d73d22, kiro 0.1.14). The new
apikey.test.mjs (fake management and runtime API built from the recorded
shapes: GetProfile 400 in both regions, a key whose profile is in
eu-central-1, two pages of models, GetUsageLimits) fails 4 of 4 with
origin/main's index.mjs (0.1.14) and passes with this one.
bun scripts/check.mjs kiro passes.
Not tried: no real API key was tried. None was used anywhere; the traces
used a made-up key against a local recorder only. That Kiro answers a
real key's GetProfile with 400 when it has no profile, and serves its
ListAvailableModels and chat in us-east-1 without one, is what kiro-cli
2.32.0 does and Hollowhere's kiro-cli 2.33.1 succeeds with, not seen
here. kiro-cli's own handling of a 400 (rather than a refused host) per
region was not traced, since its TLS goes through the system's trust and
was not intercepted. GovCloud and ISO regions are not asked.
magpie names a plugin's account by its accountId (host.js whoOf) and,
when two read the same, adds the slot: molvqingtai's Google and GitHub
accounts of one email read "email (uid-slot)". The accountId is now the
email and the way, as Kiro's sign-in page names it: Google, GitHub,
Builder ID, IAM Identity Center, Internal. A way not known (kiro-cli's
or the Kiro IDE's sign-in, which carry no loginProvider) keeps the bare
email, and magpie's slot stays the fallback.
- browserSignIn's success names the account so.
- An account kept by its bare email, with a known loginProvider, is
given the name the way the uid was in 0.1.13: by the save after a
request, model listing or usage read (once per token), and in
auth.refresh's result (host.js renew merges it over the old).
- Sibling: usage's user is the same name for a sign-in kept here
(magpie's quota card shows it); kiro-cli's and the IDE's stay bare.
The window: magpie's settle (internal/plugin/host.js) replaces an account
only when whoOf (the accountId) is equal and the uids don't differ. An
old account still named "email", signed in again the same way before
its first use on 0.1.14, has "email (Google)" against "email" and is
kept beside it as a second account. The plugin can't close it: its
client.auth has set/remove for the account in scope only, and a sign-in
result is matched by name alone. Any use (magpie's usage read, a
request, a renewal) renames it first, after which the sign-in replaces
it. Said in the README.
Run at d767d1c + this change:
- accounts.test.mjs on the old index.mjs: 3 fail (the two existing
tests' labelled expectations, and the bare-email rename), 2 pass (the
kiro-cli bare-email guard, and the no-save case). On the new: 5 pass.
- HOME=$(mktemp -d) bun test: 2104 pass, 0 fail, 184 files.
- bun scripts/check.mjs: ok.
Not tried: a real Kiro sign-in; the names were checked only against the
tests' fake Kiro.
molvqingtai: Kiro keeps a GitHub and a Google sign-in that share an
email as two accounts, but only one could be added; the second replaced
the first. The plugin named each sign-in by its email alone, and magpie's
host.js settle (internal/plugin/host.js:1022) replaces an account whose
accountId is the new sign-in's, unless both carry a uid and the two
differ (the rule WorkBuddy's uid uses, #413).
Each browser sign-in now carries uid = its way in, lowercased (google,
github, builderid, enterprise, internal). accountId stays the email, so:
- Google and GitHub (or Builder ID) of one email are kept side by side;
magpie labels the two rows apart by their slot.
- A sign-in again the same way still replaces its own account.
- An account saved before 0.1.13 (bare email, loginProvider kept, as the
built-in's mover also saved it) still matches a sign-in again, so no
duplicate appears. It is given its uid from loginProvider on its first
request, model listing or usage read (one save per token), and on
magpie's renewal (auth.refresh returns uid with the token). Until then,
a sign-in the other way of the same email would still replace it, as
before; magpie lists each account's models when its host starts, so
that window is the time to the first listing.
Not changed: kiro-cli's and the IDE's sign-in (a pointer to whatever they
are signed in to; kiro-cli's social token doesn't say Google or GitHub)
keeps no uid and matches by email as before. Two Identity Center orgs
with one email are still one (both "enterprise"). Kiro's userInfo gives
no per-account id this plugin reads; none was assumed.
Run at this tree (origin/main 6219a71), sandbox HOME:
- bun test packages/kiro: 49 pass, 0 fail.
- bun test (whole repo): 2102 pass, 0 fail.
- bun scripts/check.mjs: ok.
- accounts.test.mjs on origin/main's index.mjs: 2 of 3 red (Google and
GitHub sign-ins carry no uid, so magpie's rule keeps one; an old
account is never given its uid). The third (no save for an account
that has its uid or no known way) passes on both, as it should.
Not tried: a real Google and GitHub Kiro sign-in of one email (no such
accounts here); the reporter is asked to confirm on #309.
Kiro's generateAssistantResponse has no field for the answer's format, so
magpie's built-in Kiro (internal/gateway/kiro.go, req.inSystem()) told
the model the schema at the end of the system prompt: "Respond with a
single JSON value and nothing else, matching this JSON schema:\n<schema>."
The plugin dropped output_config.format, and magpie's generic plugin path
falls back to inSystem only when an upstream answers 400 naming the
format, which the plugin never did, so a moved user asking for JSON got
prose. buildKiro now says the schema the same way, after the caller's
system prompt and before the thinking budget prefix. The AI SDK's
output_format is read too. A JSON object with no schema needs nothing
here: magpie's Anthropic body already tells it in the system prompt.
Run: HOME=$(mktemp -d) bun test in packages/kiro: 46 pass, 0 fail.
structured-output.test.mjs: 3 of its 4 tests red with the index.mjs
change taken out (the fourth checks a request with no format is
unchanged). bun scripts/check.mjs kiro: ok.
Not run: a real Kiro account, nor magpie end to end.
The variants came from BUDGETS (low, medium, high, max), while thinking()
already read xhigh. magpie fits an effort the model doesn't offer to the
nearest it does, so Claude Code's xhigh on a moved Kiro was recorded and
sent as max: 166 of the reporter's requests on 10-14, after the built-in,
which takes xhigh, had served it as xhigh the day before.
BUDGETS now has xhigh at 50k, the budget thinking() and the built-in's
kiroThinkingBudget give it, so what Kiro is asked is unchanged; only the
level magpie records and passes is. Both configModel and runtimeModel
read BUDGETS.
Run: bun test across the repo (TMPDIR+HOME in the scratchpad), all pass;
the new effort.test.mjs fails on the old BUDGETS. Not tried with a real
Kiro account (none signed in on this machine).
What: buildKiro dropped every cache_control, so Kiro was never asked to
cache a prompt and its tokenUsage reported no cache reads ("kiro cli
cache 率为 0"). Kiro's generateAssistantResponse takes Bedrock's cachePoint
({"type":"default"}) on a userInputMessage, on an assistantResponseMessage
and as an entry of the tools: the CodeWhisperer streaming model's
UserInputMessage.cachePoint, AssistantResponseMessage.cachePoint and
Tool::CachePoint (aws/amazon-q-developer-cli's generated client), and
Kiro CLI 2.27's model list carries supportsPromptCaching and
maximumCacheCheckpointsPerRequest. A message holding a marked block now
gets a cachePoint on the entry it ends up in (merged turns included; a
marked system prompt marks the first message, where the instructions
go), and a marked tool is followed by a cachePoint entry, as kirocc and
AIClient2API send. Four at most, the last kept, as Anthropic allows.
conversationId is left per request: a cachePoint caches the prompt's
prefix, not a conversation.
Run: TMPDIR=<scratch> HOME=<scratch> bun test (1191 pass, 0 fail) and bun
scripts/check.mjs kiro. cache-points.test.mjs's first fixture places the
marks where a captured Claude Code 2.1.296 request had them (two system
blocks and the trailing system-role hook message; texts cut short); the
second is the shape magpie's buildAnthropic hands a plugin for a
translated request. With the two cachePoint lines taken out, 3 of its 4
tests fail. Not tried against a real Kiro account (none signed in here),
so whether Kiro then reports cacheReadInputTokens is not seen yet.
What: buildKiro read a tool_result's content for its text alone, so an
image a tool returned (Codex's view_image, a computer-use screenshot,
Claude Code's Read of a PNG) never reached Kiro: the model got
"(no output)" and said it saw nothing. Its image blocks (base64) now go
with the message that answers the call, beside any image the user sent,
as magpie's built-in has sent them since yetone/magpie#369. Kiro's tool
results hold text alone. The "only the latest images" rule is unchanged;
an image named only by a URL still has no bytes to send and is left out.
Why: simonsmh reported Codex's view_image unreadable through Kiro on
magpie v0.1.1215 (#1861). A moved Kiro is served by this plugin, which
never got #369's fix.
Run: HOME=<scratch> TMPDIR=<scratch> bun test (1152 pass, 0 fail) and
bun scripts/check.mjs. tool-images.test.mjs's fixture is the Anthropic body
magpie's gateway hands the plugin for Codex 0.162's view_image output
([{"type":"input_image","image_url":"data:...","detail":"high"}]), dumped
from magpie's buildAnthropic; 3 of its 4 tests fail on 0.1.8. Not tried
against a real Kiro account (none signed in here); #369 checked the same
body shape on the built-in against a real account.
Kiro answers a tool name longer than 64 characters "Invalid tool use
format." (REQUEST_BODY_INVALID), and has declined to raise the limit
(kirodotdev/Kiro#7684). Claude Code names a plugin's MCP tools
mcp__plugin_<plugin>_<server>__<tool>, e.g. the Cloudflare plugin's
mcp__plugin_cloudflare_cloudflare-docs__search_cloudflare_documentation
(71), so every turn that offered it failed. The plugin passed t.name
through as it was.
toolName keeps a name of [a-zA-Z0-9_-]{1,64} as it is; any other becomes
its head (other characters as _) plus _ and 12 hex of its sha256, at most
64 characters. It is the same each turn, so the declaration, the history's
toolUses and the tools declared for the history all agree without state.
toolNames maps each such name back from the request's tools and history,
and reply gives the caller's name on tool_use blocks, streamed and not.
Results pair by toolUseId, which is unchanged.
tool-names.test.mjs (the reporter's 71- and 70-character names) fails 3
of 3 without the change and passes; HOME=$(mktemp -d) bun test: 1003
pass, 0 fail across the repo; bun scripts/check.mjs kiro passes. Not
tried against Kiro itself: no Kiro sign-in on this machine.
buildKiro already joins consecutive assistant messages, so #1275's request
reaches Kiro with both calls in one assistantResponseMessage and both real
results after; a call that went unanswered is still answered for. The test
keeps it so. Test-only, no version bump; HOME=$(mktemp -d) bun test (30
pass, 0 fail) and bun scripts/check.mjs pass.
auth.refresh with refreshLead 10 minutes (in-fetch: 2) for sign-ins kept in
magpie; kiro-cli's and the IDE's (expires 0) are renewed as before. It runs
under the request path's per-account lock, and an after map lets a request
holding the old token use the new one. Every failure, a refusal included,
throws plainly: the built-in never marked a Kiro account lapsed.
The check before each request stays for OpenCode, which doesn't call the
hook (magpie 0.1.684+ does). refresh.test.mjs fails without the change;
HOME=$(mktemp -d) bun test passes (396 across the repo).
.github/workflows/publish.yml runs the tests (in a throwaway HOME) and
scripts/publish.sh on each package.json change pushed to main, or by hand;
npm's OIDC exchange stands in for a token and an OTP. Every package now
names magpie-community/plugins' publish.yml as its trusted publisher on
npmjs.com, and gets the repository field npm checks it against.
bun test runs every file in one process, and three usage tests left
globalThis.fetch on a fake of theirs: zcode's (offline, set in a
beforeEach, never restored), kiro's and workbuddy's (offline, set at
import, never restored). A file run after them got that fake:
- minimax's tests (27/27 alone) failed 19 after zcode's usage test: the
plugin's requests to the local fake MiniMax went to zcode's offline and
threw "no network in tests".
- qoder's cn.test.mjs takes globalThis.fetch as the real one when it loads;
after kiro's or workbuddy's usage test that was offline, so every request
meant for its Bun.serve stand-in threw. The CN sign-in, which polls on
through errors, timed out at 10 s and kept polling, and the job-token test
timed out too, so a full bun test never finished.
Each of the three now keeps the fetch it found and puts it back in
afterAll. Test-only; no package version changes. HOME=$(mktemp -d) bun
test: 341 pass, 0 fail across 42 files (8.5 s); bun scripts/check.mjs
passes.
- every {type:"failed"} carries an error reason magpie shows
- commandcode/devin: accounts taken from the CLI are marked metadata.cli and re-read its credentials on each request, usage and models
- factory: a refused refresh answers 401 authentication_error (Anthropic shape on /llm/a/, OpenAI's elsewhere) instead of throwing; the whoami back-off is per account; 403 hints name the account to sign in again
- versions: factory/devin/commandcode/cursor/kiro/mimo/zed/zcode 0.1.2, workbuddy 0.1.3