From c4df4fed751a40db2d54d3f330db8141ab718dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deniz=20=C4=B0rgin?= Date: Tue, 24 Nov 2026 11:17:08 +0300 Subject: [PATCH] test(hosting): mark the handoff request's arrival before the release closes it The concurrent-fresh-sidecar test released the held responses before it marked the ticket request's arrival. On net472 the handler does not retry a connection that closed without a response, so PrepareAsync could fail, find the fresh sidecar and return before the arrival was marked, and the arrival assertion read false. The response that marks the arrival is now built before the release. --- .../BackgroundService/Handoff/ServicePtyHandoffTests.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/OpenCode.Sdk.Tests/Hosting/BackgroundService/Handoff/ServicePtyHandoffTests.cs b/tests/OpenCode.Sdk.Tests/Hosting/BackgroundService/Handoff/ServicePtyHandoffTests.cs index 64e862b9..89d569d1 100644 --- a/tests/OpenCode.Sdk.Tests/Hosting/BackgroundService/Handoff/ServicePtyHandoffTests.cs +++ b/tests/OpenCode.Sdk.Tests/Hosting/BackgroundService/Handoff/ServicePtyHandoffTests.cs @@ -173,13 +173,16 @@ public async Task PrepareAsync_Should_Return_When_A_Concurrent_Caller_Published_ return NoContent(); } - if (!arrived.Task.IsCompleted) + // Arrival is marked before the release closes this request: net472 does not retry, so PrepareAsync can return at once. + var first = !arrived.Task.IsCompleted; + var response = Pending(arrived); + if (first) { Seed(_scenario.SidecarPath(), Sidecar(registration!, Ticket, NowMilliseconds + 60_000).ToUtf8Json()); respondingServer!.ReleaseResponses(); } - return Pending(arrived); + return response; }); respondingServer = server; registration = ServicePtyHandoffScenario.Registration(server.Endpoint);