You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(kiro): model routing ignored without origin, parallel tool results rejected, kiro-cli social logins unsupported; Agent run failed loses its cause #6166
Using the built-in kiro provider with a Kiro Power subscription on a Google (social) login surfaced several transport/auth defects beyond #6164 and #6158, plus an unrelated diagnosability gap where Error: Agent run failed. discards its cause. All findings below were verified with live requests against the real service (0.18.1 release and 0.18.3 source, macOS arm64). A fix branch exists locally; I can open a PR.
Already tracked elsewhere, same root causes I hit:
origin is required for model selection. Without userInputMessage.origin: "AI_EDITOR" the service ignores modelId and answers every request with auto (the modelId field in every response frame is auto). Selecting kiro/claude-opus-5.5 silently has no effect. Adding origin makes the response frames report the requested model.
Parallel tool results are split → HTTP 400 TOOL_USE_RESULT_MISMATCH. The OAuth transport puts only the last toolResult in currentMessage and leaves earlier results of the same parallel batch as a separate history entry. Kiro rejects the next turn: messages.4: tool_use ids were found without tool_result blocks immediately after … (TOOL_USE_RESULT_MISMATCH). All trailing consecutive toolResult messages must travel together in currentMessage.userInputMessageContext.toolResults.
Kiro-cli social logins cannot be used. Users whose subscription is on a Google/GitHub Kiro login have no supported path: Builder ID (gjc auth-broker login kiro) is a different Kiro account (in my case Q_DEVELOPER_STANDALONE_FREE vs. …_POWER on the Google login), and KIRO_API_KEY (ksk_) hits per-account ThrottlingException 429s. Verified facts for supporting it:
kiro-cli stores the token in data.sqlite3 → table auth_kv, key kirocli:social:token → {access_token, refresh_token, expires_at, profile_arn, provider} (macOS: ~/Library/Application Support/kiro-cli/).
Refresh: POST https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken with {"refreshToken": …} → {accessToken, refreshToken, expiresIn: 3600, profileArn}. The refresh token was not rotated. Invalid token → 401 {"message":"Bad credentials"}. SSO OIDC CreateToken does not work for these tokens.
profileArn must be sent in conversationState and in ListAvailableModels for social credentials.
ListAvailableModels and GetUsageLimits accept the same OAuth bearer on codewhisperer.<region>.amazonaws.com.
Reasoning effort is not forwarded on the OAuth transport. Kiro takes the thinking budget as a prompt prefix <thinking_mode>enabled</thinking_mode><max_thinking_length>N</max_thinking_length> and streams inline <thinking>…</thinking> text, which currently lands in the answer text.
Separate: Error: Agent run failed. has no recorded cause
packages/agent/src/agent.ts replaces every thrown run failure with Agent run failed. (intentional — keeps provider text out of transcripts), but the cause is not logged anywhere, so these failures cannot be diagnosed. I saw 15 of them over 3 days on anthropic/claude-opus-5-5, all at or before stream start, no HTTP status, errorName: Error. Twice, two different sessions failed in the same millisecond, which points at shared state rather than one session. In the same window one Anthropic credential failed refresh 220× with invalid_grant: Refresh token not found or invalid yet stayed active (usage-path refresh failures never disable the row), and there were OAuth token refresh ownership remained ambiguous / SQLiteError: database is locked entries with ~11 concurrent gjc processes. Either would produce exactly this shape if thrown from getApiKey — not confirmed.
Suggested minimum: log the redacted cause (e.g. via redactCrashSecrets) at warn in that catch block, transcript/SDK surfaces unchanged.
Steps to Reproduce
Kiro Power subscription on a Google login; OAuth bearer from that login.
Any prompt that makes the model issue ≥2 parallel tool calls → next request fails with 400 TOOL_USE_RESULT_MISMATCH (finding 2).
Expected Behavior
Selected model is honored; parallel tool turns continue; kiro-cli social logins are importable and refreshable; failed runs leave a diagnosable cause in the log.
Environment
macOS 27 (arm64), gjc 0.18.1 (release) and 0.18.3 (source, dev-based branch), bun 1.4.2. Provider: kiro (OAuth), also anthropic for the run-failure part.
feat(ai)!: import kiro-cli social logins via gjc setup credentials / startup auto-import, refresh via the Kiro auth service; remove the KIRO_API_KEY path.
fix(agent): log the redacted cause behind Agent run failed.
Description
Using the built-in
kiroprovider with a Kiro Power subscription on a Google (social) login surfaced several transport/auth defects beyond #6164 and #6158, plus an unrelated diagnosability gap whereError: Agent run failed.discards its cause. All findings below were verified with live requests against the real service (0.18.1 release and 0.18.3 source, macOS arm64). A fix branch exists locally; I can open a PR.Already tracked elsewhere, same root causes I hit:
x-amz-target/content-type, wrappedtools, event payload parsingeventstream: truncated message at end of streamNew findings
originis required for model selection. WithoutuserInputMessage.origin: "AI_EDITOR"the service ignoresmodelIdand answers every request withauto(themodelIdfield in every response frame isauto). Selectingkiro/claude-opus-5.5silently has no effect. Addingoriginmakes the response frames report the requested model.TOOL_USE_RESULT_MISMATCH. The OAuth transport puts only the lasttoolResultincurrentMessageand leaves earlier results of the same parallel batch as a separate history entry. Kiro rejects the next turn:messages.4: tool_use ids were found without tool_result blocks immediately after … (TOOL_USE_RESULT_MISMATCH). All trailing consecutivetoolResultmessages must travel together incurrentMessage.userInputMessageContext.toolResults.gjc auth-broker login kiro) is a different Kiro account (in my caseQ_DEVELOPER_STANDALONE_FREEvs.…_POWERon the Google login), andKIRO_API_KEY(ksk_) hits per-accountThrottlingException429s. Verified facts for supporting it:data.sqlite3→ tableauth_kv, keykirocli:social:token→{access_token, refresh_token, expires_at, profile_arn, provider}(macOS:~/Library/Application Support/kiro-cli/).POST https://prod.us-east-1.auth.desktop.kiro.dev/refreshTokenwith{"refreshToken": …}→{accessToken, refreshToken, expiresIn: 3600, profileArn}. The refresh token was not rotated. Invalid token → 401{"message":"Bad credentials"}. SSO OIDCCreateTokendoes not work for these tokens.profileArnmust be sent inconversationStateand inListAvailableModelsfor social credentials.ListAvailableModelsandGetUsageLimitsaccept the same OAuth bearer oncodewhisperer.<region>.amazonaws.com.<thinking_mode>enabled</thinking_mode><max_thinking_length>N</max_thinking_length>and streams inline<thinking>…</thinking>text, which currently lands in the answer text.Separate:
Error: Agent run failed.has no recorded causepackages/agent/src/agent.tsreplaces every thrown run failure withAgent run failed.(intentional — keeps provider text out of transcripts), but the cause is not logged anywhere, so these failures cannot be diagnosed. I saw 15 of them over 3 days onanthropic/claude-opus-5-5, all at or before stream start, no HTTP status,errorName: Error. Twice, two different sessions failed in the same millisecond, which points at shared state rather than one session. In the same window one Anthropic credential failed refresh 220× withinvalid_grant: Refresh token not found or invalidyet stayedactive(usage-path refresh failures never disable the row), and there wereOAuth token refresh ownership remained ambiguous/SQLiteError: database is lockedentries with ~11 concurrent gjc processes. Either would produce exactly this shape if thrown fromgetApiKey— not confirmed.Suggested minimum: log the redacted cause (e.g. via
redactCrashSecrets) atwarnin that catch block, transcript/SDK surfaces unchanged.Steps to Reproduce
gjc --model kiro/claude-opus-5.5 -p "…"→ response frames reportmodelId: auto(finding 1).TOOL_USE_RESULT_MISMATCH(finding 2).Expected Behavior
Selected model is honored; parallel tool turns continue; kiro-cli social logins are importable and refreshable; failed runs leave a diagnosable cause in the log.
Environment
macOS 27 (arm64), gjc 0.18.1 (release) and 0.18.3 (source,
dev-based branch), bun 1.4.2. Provider:kiro(OAuth), alsoanthropicfor the run-failure part.Proposed fix (local branch, can PR)
fix(ai): send all trailing parallel tool results incurrentMessage; setorigin; sendprofileArn; forward reasoning as thinking budget and split inline<thinking>into thinking content; content-type check with the redacted body (overlaps bug(kiro): non-eventstream 200 body is masked as eventstream: truncated message #6158).feat(ai)!: import kiro-cli social logins viagjc setup credentials/ startup auto-import, refresh via the Kiro auth service; remove theKIRO_API_KEYpath.fix(agent): log the redacted cause behindAgent run failed.