fix(mcp-v2): don't claim relay-tunnel disconnects mean toggle is off#4095
Conversation
The 503 "Host not connected" branch from the relay fires for several distinct conditions (toggle off, desktop closed, WS dropped, tunnel auth failed, tunnel not yet established). The previous message named only the toggle case and pushed a misleading remediation step. Replace with a terse statement of fact matching the surrounding error strings.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA single error message in the host relay failure handler was updated to provide clearer indication of tunnel connectivity status. The 503 error response message for disconnected hosts now reports the specific host ID and relay tunnel state instead of settings guidance. ChangesRelay Error Message Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile Summary
Confidence Score: 5/5Safe to merge — one-line error message correction with no logic, API, or type changes. The change is a pure string replacement in a single branch of a private helper function. It cannot introduce regressions, break types, or affect control flow. The PR description confirms no callers rely on the old string. No files require special attention.
|
| Filename | Overview |
|---|---|
| packages/mcp-v2/src/host-service-client.ts | Single-line fix replacing a misleading, toggle-specific error message with a neutral "relay tunnel is not connected" fact statement; no logic changes. |
Sequence Diagram
sequenceDiagram
participant Client as MCP Client
participant Relay as Relay Server
participant Host as Desktop Host
Client->>Relay: POST /hosts/{routingKey}/trpc/{procedure}
alt tunnel connected
Relay->>Host: forward request
Host-->>Relay: tRPC response
Relay-->>Client: 200 OK
else tunnel not connected (toggle off / WS dropped / auth fail / app closed)
Relay-->>Client: 503 {"error":"Host not connected"}
Note over Client: describeRelayFailure()<br/>OLD: "Host X has not enabled remote access. Toggle..."<br/>NEW: "Host X relay tunnel is not connected."
end
Reviews (1): Last reviewed commit: "fix(mcp-v2): don't claim relay-tunnel di..." | Re-trigger Greptile
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
…4095) The 503 "Host not connected" branch from the relay fires for several distinct conditions (toggle off, desktop closed, WS dropped, tunnel auth failed, tunnel not yet established). The previous message named only the toggle case and pushed a misleading remediation step. Replace with a terse statement of fact matching the surrounding error strings.
Summary
503 {"error":"Host not connected"}whenevertunnelManager.hasTunnel(hostId)is false (apps/relay/src/index.ts:55-56). That fires for several distinct conditions: toggle off, desktop app closed, WebSocket dropped mid-session, tunnel auth failed during WS upgrade, or tunnel not yet established.describeRelayFailurein packages/mcp-v2/src/host-service-client.ts named only the toggle case and pushed a remediation step that's wrong in the other scenarios.Host <id> relay tunnel is not connected.) matching the surrounding'You are not authenticated'/Host ${hostId} not foundstyle.Skipped the optional relay-side enrichment (
{ error: 'host_not_connected', reason: ... }) — it's a non-trivial cross-package change, would need new types, and wasn't required for the fix. Leaving for a follow-up if we want to surface the actual disconnect reason.Test plan
bun run lint:fixcleanbun run typecheckcleanSummary by cubic
Fix inaccurate error text for relay 503 "Host not connected" responses. Now shows "Host relay tunnel is not connected." instead of telling users to enable remote access, which was wrong for cases like app closed, dropped WS, auth failure, or a not-yet-established tunnel.
Written for commit b6a7b6f. Summary will update on new commits.
Summary by CodeRabbit