fix(devserver): resolve bridge port polling when controller reuses existing DevServer#22953
Open
fix(devserver): resolve bridge port polling when controller reuses existing DevServer#22953
Conversation
|
|
…erver When the host process exits during the readiness probe (e.g. the controller detected an existing DevServer started by another IDE), re-check the AmbientRegistry for an active server on a different port and adopt it, instead of polling the wrong port for 30 seconds. Also distinguish between 'server alive but /mcp 404' and 'nothing listening' during the readiness probe. Hosts that respond to HTTP but lack the /mcp endpoint now report Degraded with an actionable HostMcpEndpointNotAvailable diagnostic instead of HostCrashed. Agent-Logs-Url: https://github.com/unoplatform/uno/sessions/de8ab6cb-512d-4181-a214-b4afa5cc3093 Co-authored-by: carldebilly <4174207+carldebilly@users.noreply.github.com>
…t decisions - Reset HostRespondedNoMcp in StopMonitoringAsync and before each readiness probe to prevent stale diagnostics across workspace transitions and crash recovery cycles - Extract ShouldAttemptAmbientFallback and IsReadinessAcceptable into MonitorDecisions for proper testability - Replace tautological inline-logic tests with tests that exercise the extracted decision methods - Remove fragile enum count assertion
6d787de to
b336302
Compare
Contributor
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22953/wasm-skia-net9/index.html |
jeromelaban
approved these changes
Apr 2, 2026
| /// Used by <see cref="HealthService"/> to surface an actionable diagnostic. | ||
| /// Reset on stop and at the beginning of each readiness cycle to avoid stale diagnostics. | ||
| /// </summary> | ||
| public bool HostRespondedNoMcp { get; private set; } |
Member
There was a problem hiding this comment.
Updated spec for this change?
ajpinedam
approved these changes
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the DevServer CLI MCP bridge launches a host process and that process exits
(e.g., a controller that detected an existing DevServer started by Rider/VS),
the bridge was polling its own randomly-chosen port instead of the existing
server's port — resulting in a 30-second timeout and false HostCrashed status.
Closes #22952
What changed
Core fix — AmbientRegistry fallback (
DevServerMonitor.cs):AmbientRegistry for an active server for the same solution on a different port
_serverProcesssoDeterminePostStartupActioncorrectly routes toHTTP health polling
Backward compatibility — 404 handling (
DevServerMonitor.cs):WaitForServerReadyAsyncnow returnsReadinessProbeResultinstead ofboolReady,ProcessExited,ServerRespondedNoMcp(HTTPalive but
/mcp404),TimedOut/mcpreport Degraded with an actionablediagnostic instead of HostCrashed
Stale state fix (
DevServerMonitor.cs):HostRespondedNoMcpis reset inStopMonitoringAsyncand before eachreadiness probe to prevent stale diagnostics across workspace transitions
and crash recovery cycles
Decision model (
MonitorDecisions.cs):ReadinessProbeResultenum for clean separation of probe outcomesShouldAttemptAmbientFallback— extracted decision for testabilityIsReadinessAcceptable— extracted readiness gate for testabilityHealth diagnostics (
HealthReport.cs,HealthReportFactory.cs,HealthService.cs):IssueCode.HostMcpEndpointNotAvailable(Warning severity)Test plan
ShouldAttemptAmbientFallback(5 cases: different port,no server, same port, wrong probe result, null solution)
IsReadinessAcceptable(all 4 enum values)HostMcpEndpointNotAvailablehealth issue (present/absent)ReadinessProbeResultenum coverage