Skip to content

fix: lead network failures in kas login and install with the cause - #33713

Merged
bolichen97 merged 1 commit into
mainfrom
fix/31920-plain-network-errors
Nov 10, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/31920-plain-network-errors

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When kirocrew kas login or the KAS engine download cannot reach its host, the error names the host and the cause in plain words instead of Python's exception text.

With the sign-in service unreachable, kirocrew kas login prints ❌ could not reach the sign-in service: Cannot connect to host oidc.us-east-1.amazonaws.com:443 ssl:default [Multiple exceptions: [Errno 111] Connect call failed ...]. With the engine host unreachable, the one-line installer prints ❌ could not fetch https://kas.crew.kiro.dev: <urlopen error [Errno 111] Connection refused>.

Why it matters

Both lines are what a new user sees on a fresh machine when the network or a firewall is in the way. ssl:default [Multiple exceptions: ...] and <urlopen error ...> are Python internals: the user cannot tell whether it is their network, their proxy or a Kiro Crew bug, and the sign-in line never says to check the network.

Not a goal

What changed (motivation → approach → change)

Where Before After
kirocrew kas login ❌ could not reach the sign-in service: Cannot connect to host oidc.us-east-1.amazonaws.com:443 ssl:default [Multiple exceptions: ...] ❌ could not reach the sign-in service (oidc.us-east-1.amazonaws.com): connection refused.
Nothing was stored. Check your network connection, then run the command again.
KAS engine manifest fetch (acp/kas_bundle.py: kirocrew kas install, the installer, the dashboard and spawn installs) ❌ could not fetch https://kas.crew.kiro.dev: <urlopen error [Errno 111] Connection refused> ❌ could not download the KAS engine from https://kas.crew.kiro.dev: connection refused

Both messages printed the library exception's own text, which is written for a Python developer, not for the person running the command.

A small helper, asset_downloader.network_failure_cause, names the three causes a user can act on: connection refused, the host name could not be resolved and timed out. It reads them from the exception types (urllib's URLError.reason, aiohttp's ClientConnectorError.os_error), never from the text. Both sign-in messages (starting a sign-in, and losing contact while waiting for approval) name the host aiohttp reports and say what to do next; aiohttp's connect timeout carries no host, so its own text (Connection timeout to host <url>) stays the reason there. The engine message says what was being downloaded; the dashboard and spawn installs show it inside their own Kiro Crew could not install its KAS engine: ... line. Any other failure still shows the library's text, which is then the only clue there is. error-handling.md gets one Boundaries row for this rule.

Backwards compatibility

Compatible: only the wording of these failure messages changes. Exit codes, exception types and callers are the same, and nothing reads the old text (the cloud sign-in parser reads only the Open and code: lines).

Removes nothing: no path, record, key or function is taken away; three message strings are reworded.

Tests

  • test/test_cli_kas_login.py::TestLogin::test_an_unreachable_sign_in_service_names_the_host_and_the_cause: the reported aiohttp shape (both addresses refused) prints exactly the host, connection refused and the next step.
  • test/test_cli_kas_login.py::TestLogin::test_a_connect_timeout_keeps_the_host_its_text_names: a connect timeout, which has no host, keeps the text that names the host instead of a bare timed out.
  • test/test_kas_bundle.py::TestManifest::test_an_unreachable_host_is_named_with_the_cause_in_plain_words: a refused, an unresolved and a timed-out urllib failure each give the plain cause.
  • test_fetch_from_a_malformed_url_is_a_refusal_not_a_traceback matches the new lead; an unparseable url still keeps urllib's own text.
  • Determinism: the four new or changed tests passed 20 runs at -n0 and 10 runs at -n 4 --dist loadgroup beside test_kas_route.py, and both touched test files (107 tests) passed in a shuffled order (seed 27471).

Proof: PROVEN test/test_cli_kas_login.py::TestLogin::test_an_unreachable_sign_in_service_names_the_host_and_the_cause, test/test_cli_kas_login.py::TestLogin::test_a_connect_timeout_keeps_the_host_its_text_names, test/test_kas_bundle.py::TestManifest::test_fetch_from_a_malformed_url_is_a_refusal_not_a_traceback, test/test_kas_bundle.py::TestManifest::test_an_unreachable_host_is_named_with_the_cause_in_plain_words[reason0-connection refused], test/test_kas_bundle.py::TestManifest::test_an_unreachable_host_is_named_with_the_cause_in_plain_words[reason1-the host name could not be resolved] (head 6e9c189)

Manual verification

  • kirocrew kas install --url https://127.0.0.1:1 and --url https://kas.nonexistent.invalid (isolated KIROCREW_HOME, Linux): ❌ could not download the KAS engine from https://127.0.0.1:1: connection refused and ... from https://kas.nonexistent.invalid: the host name could not be resolved, exit 1.
  • The real sign-in client (_run_device_login with the issuer url pointed at https://127.0.0.1:1 and at https://oidc.nonexistent.invalid): ❌ could not reach the sign-in service (127.0.0.1): connection refused. and (oidc.nonexistent.invalid): the host name could not be resolved., each followed by the next-step line, exit 1.

Screenshots / video

N/A — terminal text only; no frontend file changes.

Related Issues

Closes #31920

Sibling sweep

Swept: git grep -nE "(could not|cannot|failed to) (reach|fetch|connect|download)[^"]{exc}" -- 'src/kiro_crew/.py' ':!src/kiro_crew/apps/builtins/'
Sibling: src/kiro_crew/cli_kas_login.py:300 -- changed here
Sibling: src/kiro_crew/platform/wheel_engine_transfer.py:155 -- tracked in #33608
Sibling: src/kiro_crew/memory_forget_client.py:158 -- tracked in #33608
Sibling: src/kiro_crew/platform/policy_distribution.py:369 -- tracked in #33608
Sibling: src/kiro_crew/platform/policy_distribution_boot.py:486 -- tracked in #33608
Sibling: src/kiro_crew/asset_downloader.py:1045 -- tracked in #33608
Sibling: src/kiro_crew/coder/session_browse.py:219 -- not affected -- the text is the remote worker's own error message, not a socket exception

Pattern harvest

Rule candidate: review-prompt
Pattern: a user-facing network failure message that interpolates the raw exception ({exc}) instead of naming the cause through asset_downloader.network_failure_cause.

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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 9, 2026 05:12
@bolichen97
bolichen97 requested a review from Zedmor November 9, 2026 05:12
@bolichen97
bolichen97 enabled auto-merge (squash) November 9, 2026 05:14
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 6e9c189c4b50e5656eb43479354b41a06ad2351e touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the change only rewords three messages and is easy to revert. The cause is read from the exception types, with the library's text kept as the fallback.

Notes

  • The fix for the reported line depends on aiohappyeyeballs. It raises OSError(errno, "Multiple exceptions: ..."), and Python turns that into ConnectionRefusedError. That only happens when every address fails with the same errno. If the addresses fail with different errnos, the old ssl:default [Multiple exceptions ...] text comes back, now behind the host name.

[DESIGN-REVIEWED] 6e9c189

Description read

[DESCRIPTION-READ] 366a637ccc335c7255c2fa889e0e6ac1b3d48956972c930c9bdfb734eba8b647

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 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 6e9c189c4b50e5656eb43479354b41a06ad2351e — 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

This fix is aimed at the real cause: both messages printed the library's exception text. The new helper has two real consumers, and the five unfixed sibling messages are declared and tracked in #33608.

What this change ships

Inventory (5 items) — 5 justified

Intent: a new user on a blocked network should learn which host failed and why, in plain words. This is a FIX for #31920.

  1. When kas login can't reach the sign-in service, it names the host, says why in plain words and says what to do next — justified
  2. "Lost contact while waiting for approval" now uses the same host, cause and next-step wording — justified
  3. A failed KAS engine manifest fetch now reads "could not download the KAS engine from : " instead of urllib's text — justified
  4. New exported helper asset_downloader.network_failure_cause, used in kas_bundle.py and cli_kas_login.py (2 consumers) — justified
  5. One new Boundaries row in error-handling.md for this rule — justified

[FIRST-PRINCIPLES-REVIEWED] 6e9c189

Description read

[DESCRIPTION-READ] a0df2128eb63996aaa94169a1de35c904d755a1d84ff0e863c86b93dc72ff679

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 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 6e9c189

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

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

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6e9c189

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

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 9, 2026
buluoray
buluoray previously approved these changes Nov 9, 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.

Approving. When kas login or the KAS engine manifest fetch fails, the error now names the host and a plain cause (refused / unresolved / timed out), read from the exception types (asset_downloader.py:351-364, cli_kas_login.py:211-230, kas_bundle.py:383-386). Other failures keep the library text, and exit codes and exception types do not change. The current reds are rate limits and a GitHub 504 during setup, not findings; they need a rerun.

`kirocrew kas login` and the KAS engine manifest fetch printed the raw
aiohttp / urllib exception text when a host did not answer
(`ssl:default [Multiple exceptions: [Errno 111] ...]`,
`<urlopen error [Errno 111] Connection refused>`), so a new user could
not tell their network from a Kiro Crew bug.

Both now name the host and the cause in plain words: connection
refused, the host name could not be resolved, or timed out, read from
the exception types by a shared asset_downloader helper. The sign-in
messages add what to do next. Any other failure keeps the library text.

Closes #31920
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/acp/kas_bundle.py, src/kiro_crew/cli_kas_login.py, src/kiro_crew/asset_downloader.py, docs/system-specs/common/error-handling.md, test/test_kas_bundle.py and test/test_cli_kas_login.py since this head's CI ran (2caa69b -> 73e3275); CI re-running.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 10, 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 6e9c189. Pure rebase of the previously approved head fe6e9d7 onto newer main; every added/removed line is identical (only diff context differs), tests 110/110 green, two mutations each redden a named test; all red checks are GitHub API rate-limit infra. Decisive lines: src/kiro_crew/asset_downloader.py:352, src/kiro_crew/cli_kas_login.py:221, src/kiro_crew/acp/kas_bundle.py:394

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 10, 2026
@bolichen97
bolichen97 merged commit 0396be4 into main Nov 10, 2026
157 of 169 checks passed
@bolichen97
bolichen97 deleted the fix/31920-plain-network-errors branch November 10, 2026 12:51
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 10, 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.

Network failure messages show raw exception text (sign-in, engine download)

2 participants