Skip to content

fix: say the connection dropped when a sign-in poll gets no answer - #35754

Merged
bolichen97 merged 1 commit into
mainfrom
fix/34681-kas-login-restart-sentence
Nov 12, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/34681-kas-login-restart-sentence

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When the gateway restarts or the connection to it drops while a Kiro sign-in waits for approval, the sign-in screen says the connection was lost and to start over, instead of the browser's raw "Failed to fetch".

Start a Kiro sign-in from the dashboard, then let the gateway restart before you approve it. The screen ends on "Sign-in failed" / "Something went wrong while waiting for approval" / "Failed to fetch". The onboarding bug bash hit this in 4 runs on 4 host shapes, Linux and Windows.

Why it matters

A brand-new user signing in for the first time is the one most likely to restart the gateway mid-sign-in. "Failed to fetch" names neither the cause nor the next step, so they cannot tell whether to wait, retry, or report a bug, and a moment that one click fixes reads as a broken product.

Not a goal

  • Surviving the restart. A restarted gateway has forgotten the pending sign-in, so starting over is the remedy; the poll is not retried.
  • Rewording a failure the gateway itself answered: the poll's coded 502 for an unreachable Kiro auth service, an expired code, and the coded 404 (unknown_login_id) that a gateway already back up answers for a sign-in it forgot, keep their text.
  • The chooser's "Could not start sign-in" and the "We could not check sign-in status" screens, which already name what failed next to their own retry.

What changed (motivation → approach → change)

The sign-in screen printed whatever the failed poll said. When the gateway never answers (it is restarting, or the link to it dropped), that is the browser's own "Failed to fetch", which explains nothing.

KasLoginGate.tsx asks the existing isUnansweredRead check (a fetch rejection, or a 502/503/504) whether the poll got no answer. When it got none, and the response carries no code, the screen reads "Sign-in failed" with the sentence "We lost the connection to Kiro Crew, which may have restarted. Start over to sign in again.", above the same Start over button. A coded answer keeps its own text. "Ask the agent" still hands over the original failure, through the report attached to the error.

The sentence ships in every language under website/src/i18n/locales/ (components.kasLogin.connection_lost_body, English in en.manual.json), and kas-auth.md describes the screen.

Backwards compatibility

Compatible: only the text of one failure screen changes; no API, config, catalog key or stored data is renamed or removed.

Removes nothing: the raw message is replaced only on a poll the gateway never answered, and the hand-off report still carries it.

Tests

website/src/components/KasLoginGate.test.tsx:

  • A poll that rejects with TypeError('Failed to fetch') shows the connection-lost sentence, and "Failed to fetch" appears nowhere.
  • A poll answered with the gateway's coded 502 (auth_service_unreachable) keeps "Kiro auth service is unreachable." under the old headline.

Proof: not provable -- frontend test (prove.py runs Python only)

Red before: with KasLoginGate.tsx put back to its parent, the connection-lost test fails (Unable to find role="heading" and name "Sign-in failed") and the coded-502 test passes, which is its job: it guards against rewording every failure.

Determinism: both new tests passed 20 repeated runs (npx vitest run --maxWorkers=1 -t "never answered|coded 502 keeps" src/components/KasLoginGate.test.tsx), and the whole file passed in a shuffled order (--sequence.shuffle --sequence.seed=8716, 42 of 42).

Manual verification

The built SPA from this head, served by website/scripts/lib/serve-dist.mjs with every /api/** call stubbed: begin a Google device sign-in, then make the poll's request fail at the network layer (what a restarting gateway does), and separately answer it with the coded 502. Each frame was checked for its text before it was captured (below).

Screenshots / video

Captured from this head's built SPA, poll forced to fail at the network layer (the restart case), dark and light:

Sign-in failed: we lost the connection to Kiro Crew, which may have restarted. Start over to sign in again. (dark)

The same screen, light theme

Unchanged: a poll the gateway answered with its coded 502 keeps its own text under the old headline:

Something went wrong while waiting for approval: Kiro auth service is unreachable.

Related Issues

Closes #34681

Sibling sweep

Swept: git grep -nE "error??.message" -- website/src/components/KasLoginGate.tsx
Sibling: website/src/components/KasLoginGate.tsx:1157 -- not affected -- the status read's headline already says the status could not be checked, and Check again plus the 30 s refetch recover it; the begin error (line 1281) is the same: no sign-in is pending, and "Could not start sign-in" sits under the provider buttons that retry it

Pattern harvest

Not generalizable: the shared isUnansweredRead check already names the no-answer class; whether a screen rewords it depends on what that screen can offer next, which no lint rule can read.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 12, 2026 05:25
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of e0ca298ec80e5c80b70e7264b69a8450c96a571f — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. It is a fix tied to an issue (#34681), with a test that fails on base, and it reuses the existing isUnansweredRead check.

What this change ships

Inventory (5 items) — 5 justified

Intent: a first-time user whose gateway restarts during a Kiro sign-in should be told the connection dropped and to start over, not shown "Failed to fetch". FIX.

  1. When a sign-in poll gets no answer, the failure screen shows "Sign-in failed" with a connection-lost sentence instead of "Failed to fetch" — justified
  2. A poll the gateway did answer with a code (for example the 502 auth_service_unreachable) keeps its own text — justified
  3. "Ask the agent" still hands over the original failure under the reworded sentence (the new report prop has 1 caller) — justified
  4. The new sentence connection_lost_body ships in all 14 locale catalogs — justified
  5. kas-auth.md describes the new screen — justified

[FIRST-PRINCIPLES-REVIEWED] e0ca298

Description read

[DESCRIPTION-READ] 95ccdb0e506d6f8193bb87374e642d2615a4fc324a542b9f77a2efcd48aeebb8

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of e0ca298ec80e5c80b70e7264b69a8450c96a571f — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the change rewords one failure screen, but only for the class that isUnansweredRead already defines; coded answers keep their own text, and the hand-off report still carries the original error.

[DESIGN-REVIEWED] e0ca298

Description read

[DESCRIPTION-READ] ece744375211055298f962a29eed46f84312e4703171a26b66a686e39cc150b9

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of e0ca298ec80e5c80b70e7264b69a8450c96a571f — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The connection-lost screen appears in both themes, and the blind reader read "Start over" correctly and would click it.

Notes

  • The sentence "We lost the connection to Kiro Crew, which may have restarted." left the blind reader unsure whether they had caused it. Saying the cause directly would answer that: "Kiro Crew stopped responding — it may be restarting."

[UX-REVIEWED] e0ca298

Description read

[DESCRIPTION-READ] f46f15e24529bfae5109e9f537b1b9aa1762f673edc721a357247efbaa80c183

That sha256 names everything this verdict read: the PR description, plus the 6 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed e0ca298ec80e5c80b70e7264b69a8450c96a571f — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] e0ca298

Verdict parsed from the review's SHA-scoped output markers for commit e0ca298ec80e5c80b70e7264b69a8450c96a571f.

False positive or not applicable? A repository writer can comment:
/ai-review override fable e0ca298ec80e5c80b70e7264b69a8450c96a571f false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of e0ca298ec80e5c80b70e7264b69a8450c96a571f and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e0ca298

False positive or not applicable? A repository writer can comment:
/ai-review override gpt e0ca298ec80e5c80b70e7264b69a8450c96a571f false-positive: <reason, 20 to 500 characters>

@KiroCrewCaptain

KiroCrewCaptain commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: Approve

Why: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes.

This narrow UI fix does what the PR says. When a poll gets no answer (fetch rejection, or a 502/503/504 with no code), the failure screen shows a translated "connection lost, start over" sentence instead of "Failed to fetch". Every 5xx the gateway itself sends from the kas_login handlers is coded (kas_login_unavailable, auth_service_unreachable, device_authorization_failed), so those keep their text. Start over recovers after a restart because the cancel endpoint is idempotent. The hand-off keeps the original error through reportForError. The key is in all 14 locales and uses {{productName}}. The spec doc is updated. Two tests were added, one of which fails without the change.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit e0ca298ec8 · 74 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@bolichen97
bolichen97 enabled auto-merge (squash) November 12, 2026 05:49
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 12, 2026
buluoray
buluoray previously approved these changes Nov 12, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve on ff21264. When a Kiro sign-in poll gets no answer from Kiro Crew (the browser could not reach it, or a proxy answered 502, 503 or 504 without a code), the failure screen now says the connection was lost and to start over, instead of the browser's "Failed to fetch". Every answer the gateway itself gives keeps its own text: an expired code, a denied or failed sign-in, a forgotten sign-in id, and the coded 502 when the auth service is unreachable. Only the wording changes; the poll still stops on the first failure and Start over behaves as before. Both new tests turn red when their guard is removed. The red backend shards fail only on a cloud-launch test that main fixed after this run was created, so the PR needs a rebase onto main for CI to go green. Decisive lines: website/src/components/KasLoginGate.tsx:1196, website/src/components/KasLoginGate.tsx:718-724, website/src/api/queryClient.ts:50-54, src/kiro_crew/dashboard/handlers/kas_login.py:222-247

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 12, 2026
When the gateway restarted, or the link to it dropped, while a Kiro
sign-in was waiting for approval, the sign-in screen showed the
browser's raw "Failed to fetch" under "Something went wrong while
waiting for approval". It named no cause and no next step.

A poll the gateway never answered (a fetch rejection, or a 502/503/504
with no code) now ends with "Sign-in failed" and a sentence saying the
connection to Kiro Crew was lost, maybe because it restarted, and to
start over. An answer the gateway did send keeps its own text, so its
coded 502 for an unreachable Kiro auth service still says that. The
agent hand-off keeps the original failure through the report the
transport pinned to it. The sentence ships in every language.

Closes #34681
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/kas-auth.md, website/src/components/KasLoginGate.tsx, website/src/components/KasLoginGate.test.tsx and website/src/i18n/locales/*.json since this head's CI ran (ee7a026 -> e7e2146); CI re-running.

Two reasons. GitHub reported a conflict in kas-auth.md after #35176 added a sentence to the same bullet; both sentences are kept, this one after #35176's. And Backend Tests shard 2 (Linux and Windows), with the Coverage Gate behind it, was red on test/test_cloud_launch_customize.py::TestAmiArchitectureCheck::test_matching_architecture_proceeds_to_deploy: a red on main (#35106 and #35010 collided) that #35746 fixed after this branch's base, and the new base carries that fix. The code change itself is unchanged.

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 12, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve on e0ca298. This head is a rebase of ff21264, which we approved. The patch is the same: 15 of its 16 files carry the same added and removed lines, and in the one doc file the PR's own sentence is only wrapped differently, with no word changed. What we checked still holds. When a Kiro sign-in poll gets no answer from Kiro Crew (the browser could not reach it, or a proxy answered 502, 503 or 504 without a code), the failure screen now says the connection was lost and to start over, instead of the browser's "Failed to fetch". Every answer the gateway itself gives keeps its own text: an expired code, a denied or failed sign-in, a forgotten sign-in id, and the coded 502 when the auth service is unreachable. Only the wording changes; the poll still stops on the first failure and Start over behaves as before. Both new tests turn red when their guard is removed. The rebase cleared the red backend shards of the old head, and every check on this head is green. Decisive lines: website/src/components/KasLoginGate.tsx:1232, website/src/components/KasLoginGate.tsx:718-724, website/src/api/queryClient.ts:50-54, src/kiro_crew/dashboard/handlers/kas_login.py:222-247

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 12, 2026
@bolichen97
bolichen97 merged commit 40cfcd6 into main Nov 12, 2026
101 checks passed
@bolichen97
bolichen97 deleted the fix/34681-kas-login-restart-sentence branch November 12, 2026 17:55
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After the gateway restarts, the sign-in error is a raw browser fetch error. It does not say what happened or what to do

3 participants