Commit Graph
2 Commits
Author SHA1 Message Date
yetone 9b41df1507 kiro 0.1.33: an account in Kiro IDE's CreateResponse experiment is asked at /v1/responses, as the IDE asks it (#842, #848)
ThirdTimes (#842, #848): on one Builder ID account the plugin (0.1.32)
was answered 429 USER_REQUEST_RATE_EXCEEDED on generateAssistantResponse,
and Kiro IDE 1.4.121, 11s later, was answered. The IDE's log says
"api=CreateResponse armSource=experiment callPath=main". The version
strings the plugin sends already match the IDE (1.4.121, the update
feed's latest, 2026-11-06). The difference is the call. Kiro puts accounts
in a create_response_api experiment, and an account in its arm is asked
at POST runtime.<region>.kiro.dev/v1/responses. The IDE's own
generateAssistantResponse title call on that account was 429 too.

All of this is read from the IDE's extension.js (kiro.kiro-agent, in the
1.4.121 linux tarball, which was not run):
- The experiment is read as ExperimentConfigService reads it:
  GET /featureConfiguration?origin=AI_EDITOR&version=1.4.121 with
  x-amzn-kiro-profile-arn. The key is
  sha256hex("kiro-feature-config-key-salt-3e9b1d7a" + "create_response_api"),
  and the arm's value is "create_response". The result is kept 15 minutes
  per sign-in. A failed read is asked again after 60s and keeps the last
  good config, and the read has a 5s timeout. With no config the account
  stays on generateAssistantResponse, as the IDE's default does, so an
  account outside the arm is sent what 0.1.32 sent.
- CreateResponse is sent with the IDE's headers: the plain IDE user agent
  (no aws-sdk prefix, no amz-sdk-*), x-amzn-kiro-origin AI_EDITOR,
  x-amzn-codewhisperer-optout, x-amzn-kiro-profile, TokenType and
  x-amzn-kiro-attempt "n;max=3". The body is {model, input, tools, stream,
  origin, profileArn, metadata kiro:agent_mode/kiro:conversation_id,
  reasoning}, made from the request built for generateAssistantResponse
  (history, tool calls and results, images as data: URLs). The system text
  stays at the head of the first message, as with the IDE's
  system_field_injection off.
- The SSE reply is read into the same events the old frames gave: text,
  reasoning and its signature, refusals, function calls (pieces or
  whole), stop reason, context %, and credits. An error before any answer
  becomes the status generateAssistantResponse's would have, mapped through
  the IDE's reason table (rate_limit_exceeded is USER_REQUEST_RATE_EXCEEDED,
  context_length_exceeded is CONTENT_LENGTH_EXCEEDS_THRESHOLD, and so on).
  The 0.1.32 429 retry applies to both paths.

Not done: the auxiliary path (create_response_api_auxiliary; the plugin
has no auxiliary calls), the x-amzn-kiro-fallback header, documents as
input_file, and reasoning items in history.

Run on mote at base 966cf717: packages/kiro bun test 168 pass 0 fail
(HOME a temp dir). bun scripts/check.mjs kiro ok. Root bun test 6892 pass,
20 skip, 0 fail. Rebased onto e7af7856 (inkstone only) before pushing.
Broken by hand: with the arm's value changed, 8 of the 11 new tests go
red. image-size and refresh tests now leave the featureConfiguration GET
out of what they count as a chat send.

Not tried: a real Kiro account. No account in the CreateResponse arm was
available, so the /v1/responses body and SSE are as the IDE's source
writes and reads them, not as captured from Kiro.
2026-11-08 20:31:34 +08:00
yetone ce009e60c6 kiro 0.1.6: magpie renews the sign-in ahead of time through auth.refresh
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).
2026-10-03 12:07:22 +08:00