graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
fix: route Windows mid-handshake TLS aborts through the construction recovery
Rach Pradhanf95f15656bf8
diff --git a/src/agent_stream.zig b/src/agent_stream.zigindex 697dec6f..2cdafecc 100644--- a/src/agent_stream.zig+++ b/src/agent_stream.zig@@ -124,7 +124,7 @@ pub fn postStreamWithClient(self: *Agent, client: *std.http.Client, body: []cons},.extra_headers = extra,}) catch |err| {- if (err == error.TlsInitializationFailed) return http_client.constructionTlsError(transport);+ if (http_client.constructionTlsFailure(err, provider.url)) return http_client.constructionTlsError(transport);return err;};defer req.deinit();diff --git a/src/http.zig b/src/http.zigindex 38a35220..2817e66c 100644--- a/src/http.zig+++ b/src/http.zig@@ -137,7 +137,7 @@ fn post(gpa: Allocator, client: *std.http.Client, provider: Provider, body: []co},.extra_headers = extra,}) catch |err| {- if (err == error.TlsInitializationFailed) return http_client.constructionTlsError(transport);+ if (http_client.constructionTlsFailure(err, provider.url)) return http_client.constructionTlsError(transport);return err;};defer req.deinit();diff --git a/src/http_client.zig b/src/http_client.zigindex c476a5cd..490dcc1c 100644--- a/src/http_client.zig+++ b/src/http_client.zig@@ -234,6 +234,16 @@ pub fn acquire(requested: *std.http.Client) Lease {return .{ .client = requested };}+/// True when a `transport.request()` construction error must traverse the+/// TLS recovery path: the handshake failed outright — or (Windows) died+/// mid-read, where NTSTATUS LOCAL_DISCONNECT surfaces as error.Unexpected+/// out of the handshake read instead of TlsInitializationFailed. Gated to+/// https so a plain-HTTP connect error is never mislabeled a TLS failure.+pub fn constructionTlsFailure(err: anyerror, url: []const u8) bool {+ return err == error.TlsInitializationFailed or+ (err == error.Unexpected and std.mem.startsWith(u8, url, "https://"));+}+pub fn constructionTlsError(failed: *std.http.Client) anyerror {g_lifecycle_mutex.lockUncancelable(failed.io);defer g_lifecycle_mutex.unlock(failed.io);