Repository navigation
fix(kiro): validate whoami output before reporting authentication - #37890
primevishnu wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Kiro authentication reporting now requires validated whoami output before marking the provider authenticated. The change is limited to status interpretation and existing probe gating, with no credential or permission changes. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem and change
Kiro's sign-in check could report
authenticatedwhenkiro-cli whoami --format jsonexited 0 with empty, malformed, or account-less output. Its signed-out detection also depended on the literal substring"account":null, so valid JSON with whitespace was treated as unknown.Decode a signed-out object or a meaningful account object before assigning authentication state. Accept whole JSON output, including formatted signed-out JSON, while preserving the first-line fallback for the Identity Center
Profile:suffix. Unparseable or empty account output remainsunknown, and a positive account result still requires a successful exit. The existing warning tells users to checkkiro-cli whoamiwhen sign-in cannot be confirmed.This matters beyond the label: model/agent discovery is gated on confirmed authentication because a signed-out Kiro can start browser login during discovery. Invalid output must not supply positive evidence for that gate.
Proof and verification
Extended the existing parser test rather than adding a second test layer. Before the fix, the regression fails for valid spaced signed-out JSON: expected
unauthenticated, receivedunknown. It also now checks empty output, invalid JSON, an empty object, a missing account type and an empty account type. Existing API-key, Builder ID, Identity Center suffix and failure cases remain covered.Owning-package typecheck, changed-file lint, formatting and
git diff --checkpass.A separate lightweight runtime transcript executes the exact parser/schema fragments from base
9d28fc921be19a7314376f6438242dcb838eb221and the fix with Effect 4.1.3:Environment: Windows 11 x64, Node 26.13.1, Effect 4.1.3. These are controlled parser/service fixtures; no live Kiro login or paid agent turn was used. The tests do not claim that current official Kiro normally emits corrupt output. This patch makes the existing parser conservative at those boundaries.
Full workspace checks are limited by this low-memory local machine and incomplete desktop/mobile dependency setup. Focused checks above pass; CI provides the broader validation. The earlier root
check:changedattempt on the sibling Cursor change failed on that setup, not on this parser's focused checks.AI-assisted implementation and verification: GPT-6.1 Sol through Codex in T3 Code.