Skip to content

Fix: transient HttpRequestException resets stabilization state in DockerApiClient#5

Closed
Copilot wants to merge 2 commits into
developfrom
copilot/sub-pr-1-yet-again
Closed

Fix: transient HttpRequestException resets stabilization state in DockerApiClient#5
Copilot wants to merge 2 commits into
developfrom
copilot/sub-pr-1-yet-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

The HttpRequestException handler in GetAllContainerHostPortsAsync was resetting lastSeenId = null and isFirstPoll = false, causing the next successful container find to be accepted immediately via the lastSeenId is null short-circuit — bypassing the two-consecutive-polls stabilization intended to guard against stale containers from a previous Aspire run.

Change

  • DockerApiClient.cs — Remove lastSeenId = null and isFirstPoll = false from the HttpRequestException catch block. A transient network error carries no information about actual container state; the existing stabilization values must survive across retries.
catch (HttpRequestException ex)
{
    _logger.LogError(ex, "Docker API request failed for {ResourceName}; retrying…", resourceName);

    // Do not reset lastSeenId or isFirstPoll — a transient error gives no information about the
    // container state, so the existing stabilization state must be preserved. Resetting would
    // set lastSeenId to null, causing the next successful find to be accepted immediately via the
    // "appeared after an empty poll" path, which defeats the two-poll confirmation.
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…on in DockerApiClient

Co-authored-by: henrikhimself <1175002+henrikhimself@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on Aspire Remote Containers beta 1 PR Fix: transient HttpRequestException resets stabilization state in DockerApiClient Mar 14, 2026
Copilot AI requested a review from henrikhimself March 14, 2026 12:09
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.

2 participants