Improve doctor reachability diagnostics#35
Conversation
📝 WalkthroughWalkthroughA new ChangesHealth-check module and devspace doctor integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli.ts`:
- Around line 225-226: Normalize the host used for the local probe URLs in the
CLI so `localMcpUrl` and `localHealthUrl` are built from a loopback-safe address
instead of raw `config.host`, since IPv6 literals and bind-all hosts can produce
invalid or unusable URLs. Update the URL construction in the `src/cli.ts` logic
that builds the local probe endpoints to match the same host-normalization
behavior used by `localPublicBaseUrl()`, including bracketed IPv6 handling and
replacing `0.0.0.0`/`::` with a loopback address.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 250eec39-1e02-4daa-b6bb-386063f89724
📒 Files selected for processing (4)
package.jsonsrc/cli.tssrc/health.test.tssrc/health.ts
| const localHealthUrl = `http://${config.host}:${config.port}/healthz`; | ||
| const publicHealthUrl = new URL("/healthz", config.publicBaseUrl).toString(); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -nP '\bhost\b' src/config.ts -C2
rg -nP 'DEVSPACE_HOST|host\s*[:=]' src/config.ts -C2Repository: Waishnav/devspace
Length of output: 2133
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the relevant config and CLI code around the reported lines.
sed -n '200,270p' src/config.ts
printf '\n--- CLI ---\n'
sed -n '210,255p' src/cli.tsRepository: Waishnav/devspace
Length of output: 4458
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the relevant config and CLI code around the reported lines.
sed -n '200,270p' src/config.ts
printf '\n--- CLI ---\n'
sed -n '210,255p' src/cli.tsRepository: Waishnav/devspace
Length of output: 4458
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check how config.host is parsed from files and whether any validation constrains it.
rg -n "files\.config\.host|host:" src/config.ts -C3
printf '\n--- loadDevspaceFiles ---\n'
sed -n '1,220p' src/config.tsRepository: Waishnav/devspace
Length of output: 8335
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check how config.host is parsed from files and whether any validation constrains it.
rg -n "files\.config\.host|host:" src/config.ts -C3
printf '\n--- loadDevspaceFiles ---\n'
sed -n '1,220p' src/config.tsRepository: Waishnav/devspace
Length of output: 8335
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect how the endpoint checker consumes the constructed URLs.
rg -n "function checkEndpoint|checkEndpoint\(" src/cli.ts -C3
sed -n '1,120p' src/cli.tsRepository: Waishnav/devspace
Length of output: 4600
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect how the endpoint checker consumes the constructed URLs.
rg -n "function checkEndpoint|checkEndpoint\(" src/cli.ts -C3
sed -n '1,120p' src/cli.tsRepository: Waishnav/devspace
Length of output: 4600
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect how the endpoint checker consumes the constructed URLs.
rg -n "function checkEndpoint|checkEndpoint\(" src/cli.ts -C3
sed -n '1,120p' src/cli.tsRepository: Waishnav/devspace
Length of output: 4600
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the health checker to see how these URLs are consumed.
sed -n '1,220p' src/health.tsRepository: Waishnav/devspace
Length of output: 1047
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the health checker to see how these URLs are consumed.
sed -n '1,220p' src/health.tsRepository: Waishnav/devspace
Length of output: 1047
Normalize the probe host before building local URLs.
HOST/files.config.host is unrestricted (default 127.0.0.1), so localMcpUrl and localHealthUrl can break for IPv6 literals like ::1 and can point at unusable bind-all addresses like 0.0.0.0/::. Use a loopback address for probes and bracket IPv6 hosts, matching localPublicBaseUrl().
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/cli.ts` around lines 225 - 226, Normalize the host used for the local
probe URLs in the CLI so `localMcpUrl` and `localHealthUrl` are built from a
loopback-safe address instead of raw `config.host`, since IPv6 literals and
bind-all hosts can produce invalid or unusable URLs. Update the URL construction
in the `src/cli.ts` logic that builds the local probe endpoints to match the
same host-normalization behavior used by `localPublicBaseUrl()`, including
bracketed IPv6 handling and replacing `0.0.0.0`/`::` with a loopback address.
Summary
Verification
Summary by CodeRabbit
New Features
doctorcommand now checks both local and public health endpoints and reports whether each one is reachable.Tests