Skip to content

fix: lead network failures in doctor and the relay pipe with the cause - #34559

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
cwu98:fix/network-failure-cause-33901
Nov 10, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
cwu98:fix/network-failure-cause-33901

Conversation

@cwu98

@cwu98 cwu98 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: kirocrew doctor's model url probe and the remote relay pipe lead a network failure with its plain cause instead of Python's exception text.

#33713 made network failures lead with the cause through asset_downloader.network_failure_cause. Two user-facing messages it did not cover still print the raw exception:

  • kirocrew doctor: model url: ❌ unreachable (<urlopen error [Errno -2] Name or service not known>) https://...
  • the remote workspace's relay pipe: crew-remote: relay unreachable: [Errno 111] Connect call failed ('127.0.0.1', <port>)

The doctor line also had a leak. It prints the url through redact_model_url, but urllib quotes parts of a malformed url in its error text. With https://user:pass@host/... it printed nonnumeric port: 'pass@host', showing the password beside the redacted url.

Why it matters

A person reading doctor or a failed remote session sees "connection refused" or "the host name could not be resolved", not an errno. The doctor output no longer shows a password from a private-mirror url.

Not a goal

  • The other raw-exception sites listed under Sibling sweep.
  • Changing redact_model_url itself.

What changed (motivation → approach → change)

  • src/kiro_crew/cli_doctor.py: the unreachable line uses network_failure_cause(exc). When it names no cause, the new _model_url_failure_text keeps the exception text, unless the url carries a password, query or fragment (or cannot be parsed). Then it prints the fixed the model url could not be opened. Masking the secret by value was not enough: http.client splits the port at the host's last :, so a password with a colon reaches the error text only in part.
  • src/kiro_crew/remote_session/client.py: the relay-unreachable line uses network_failure_cause(exc), else the exception as before. The import is local, so only a failed dial loads the downloader module.

Backwards compatibility

Message text only. No config, route, exit code or API changes. A failure with no named cause prints the same text as before, except a doctor url with a password, query or fragment, which prints the fixed line.

Tests

  • test/test_cli_stt_memory_doctor.py::TestModelUrlUnreachableCause: host not found, connection refused, an unnamed error keeps its text, a url with a password (with and without a colon), query or fragment prints the fixed line, a real urllib error for a colon password is not echoed, and a secret-bearing url still names a known cause.
  • test/test_remote_session_client.py: a refused relay prints connection refused, and an unnamed dial failure keeps its text.

Proof: PROVEN test/test_cli_stt_memory_doctor.py::TestModelUrlUnreachableCause::test_unresolved_host_names_the_cause, test/test_cli_stt_memory_doctor.py::TestModelUrlUnreachableCause::test_refused_connection_names_the_cause, test/test_cli_stt_memory_doctor.py::TestModelUrlUnreachableCause::test_a_secret_bearing_url_never_reaches_the_error_text[password], test/test_cli_stt_memory_doctor.py::TestModelUrlUnreachableCause::test_a_secret_bearing_url_never_reaches_the_error_text[password-with-colon], test/test_cli_stt_memory_doctor.py::TestModelUrlUnreachableCause::test_a_secret_bearing_url_never_reaches_the_error_text[query] (head b41b4e7)

Manual verification

Ran both paths on main before the fix: an unresolvable model url host, a user:pass@ model url, and a relay pipe dialed at a closed loopback port. Each printed the raw text shown above. After the fix they print the host name could not be resolved, the model url could not be opened and connection refused. The review's https://user:pa:hunter2@mirror.example/m.gguf case also prints the fixed line, with no part of the password.

Related Issues

Closes #33901

Sibling sweep

Swept: git grep -nE "(unreachable|could not reach|could not connect|connection failed)[^"]*{exc}" -- src/
Sibling: src/kiro_crew/memory_forget_client.py:158 -- tracked in #33608
Sibling: src/kiro_crew/coder/session_browse.py:219 -- not affected -- not in this issue's scope; left for a follow-up sweep
Sibling: src/kiro_crew/apps/builtins/mochi/petdex_import.py:242 -- not affected -- not in this issue's scope; left for a follow-up sweep
Sibling: src/kiro_crew/apps/builtins/dev_fleet/pointer_broker.py:94 -- not affected -- loopback gateway route error, not in this issue's scope
Sibling: src/kiro_crew/apps/builtins/design_tweak/backend/dev_preview.py:568 -- not affected -- HTTP 502 body for a local dev server, not in this issue's scope

Pattern harvest

Rule candidate: semgrep
Pattern: an f-string that prints a caught network exception's text as the failure reason without 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

@cwu98
cwu98 requested review from a team and KiroCrewCaptain as code owners November 10, 2026 13:59
@cwu98
cwu98 requested a review from iamwhatever November 10, 2026 13:59
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 10, 2026

@bolichen97 bolichen97 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. The change is small and does what #33901 asks.

  • cli_doctor.py: network_failure_cause(exc) comes first, and the fallback masks the url's password, query and fragment. That closes the nonnumeric port: 'pass@host' leak beside the redacted url.
  • remote_session/client.py: same cause-first line, and the import stays local to the failed dial.
  • I ran the touched suites on head 9e02735baf: test/test_cli_stt_memory_doctor.py + test/test_remote_session_client.py gave 58 passed, and test/test_flake_pattern_ratchet.py gave 68 passed.

One non-blocking nit: _without_url_secrets uses str.replace, so a very short query or fragment (for example ?a) masks every matching substring in the error text. The result is over-masking, never a leak, so it is fine to leave as is.

I'll merge once CI and the review lanes are green.

AI-assisted, sent by CommunityCrew

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision b41b4e76263343ff611f5023552c490b64093447 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 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of b41b4e76263343ff611f5023552c490b64093447 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: two message sites now reuse the existing type-based network_failure_cause, and the doctor line falls back to a fixed message for secret-bearing urls.

[DESIGN-REVIEWED] b41b4e7

Description read

[DESCRIPTION-READ] 482c5579ac56937ed39a59f113c217e00922f2bf01d6ab28d8045703afbb93e8

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of b41b4e76263343ff611f5023552c490b64093447 via the fork AI-review pipeline — 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. The change reuses the existing asset_downloader.network_failure_cause, and the masking branch removes a password leak the description shows.

What this change ships

Inventory (3 items) — 3 justified

Intent: a person reading kirocrew doctor or a failed remote session sees the plain network cause ("connection refused") instead of Python's exception text. This is a FIX.

  1. Doctor's "model url unreachable" line names the cause (host not resolved, refused, timed out) instead of the raw urllib error — justified
  2. The remote relay pipe's "relay unreachable" message names the cause instead of the errno text — justified
  3. Doctor prints a fixed "the model url could not be opened" for an unnamed failure when the url has a password, query or fragment, so no part of the secret is echoed — justified

[FIRST-PRINCIPLES-REVIEWED] b41b4e7

Description read

[DESCRIPTION-READ] f23284fcbbeb6f5b8c0ffe0254302546c4130227daa64fc28943ceb2a2cdf262

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed b41b4e76263343ff611f5023552c490b64093447 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] b41b4e7

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed b41b4e76263343ff611f5023552c490b64093447 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] b41b4e7

@bolichen97 bolichen97 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.

Changing my approval to a change request. The GPT lane's security finding reproduces on head 9e02735baf.

With url = "https://user:pa:hunter2@mirror.example/m.gguf", urlopen raises:

nonnumeric port: 'hunter2@mirror.example'

_without_url_secrets looks for the whole password pa:hunter2, which is not in that text, so the output still shows hunter2. http.client splits the port at the host's last :, so only the tail after it appears.

Suggested fix, in line with the lane's advice: when network_failure_cause(exc) names no cause and the url carries a password (or the url cannot be parsed), print a fixed line such as the model url could not be opened instead of the exception text. Please add a test with a colon in the password.

The relay pipe change and the rest of the doctor change look good to me.

AI-assisted, sent by CommunityCrew

kirocrew doctor's model url probe and the remote workspace's relay pipe
printed Python's exception text when a connection failed. Both now lead
with the plain cause from network_failure_cause when it names one, and
keep today's text otherwise.

urllib quotes parts of a malformed url in its error text, so the doctor
line could show a password beside the redacted url. When the url carries
a password, query or fragment and no cause is named, doctor now prints a
fixed line instead of the exception text.

Closes kirodotdev#33901
@cwu98
cwu98 force-pushed the fix/network-failure-cause-33901 branch from 9e02735 to b41b4e7 Compare November 10, 2026 15:42
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 10, 2026

@bolichen97 bolichen97 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 head b41b4e7626. _model_url_failure_text now names a known cause first, and otherwise prints the fixed the model url could not be opened for any url that carries a password, query or fragment, or that cannot be parsed. That closes the colon-password leak without masking by value. The new tests cover the colon case with a real urllib error.

I ran test/test_cli_stt_memory_doctor.py + test/test_remote_session_client.py on this head: 63 passed. I'll merge once CI and the review lanes are green.

AI-assisted, sent by CommunityCrew

@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 10, 2026
@bolichen97 bolichen97 closed this Nov 10, 2026
@bolichen97 bolichen97 reopened this Nov 10, 2026
@bolichen97 bolichen97 closed this Nov 10, 2026
@bolichen97 bolichen97 reopened this Nov 10, 2026
@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 labels Nov 10, 2026
@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 10, 2026
@bolichen97
bolichen97 merged commit 4431fa7 into kirodotdev:main Nov 10, 2026
181 of 190 checks passed
@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

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network failure messages in kirocrew doctor and the remote relay pipe still show raw exception text

2 participants