Skip to content

Commit 9f9a8ed

Browse files
RomneyDashanselmanCopilot
authored
ci: test exact Windows release artifacts against gateway candidate (#1104)
* ci: add Windows node release candidate E2E * ci: test Windows node release artifacts * ci: exclude MXC from hosted release candidate E2E * ci: bind Windows candidate E2E to release provenance * ci: harden release candidate E2E gate Co-authored-by: Copilot App <[email protected]> * ci: fetch full history for release E2E Co-authored-by: Copilot App <[email protected]> * ci: restore WinUI runtime assets for release E2E Co-authored-by: Copilot App <[email protected]> * ci: restore release E2E runtime assets Co-authored-by: Copilot App <[email protected]> * test: assert E2E restore ordering Co-authored-by: Copilot App <[email protected]> * test: bind E2E restore to RID builds Co-authored-by: Copilot App <[email protected]> * test: order E2E restore before its build Co-authored-by: Copilot App <[email protected]> * ci: bind Windows release asset tuple * fix(setup): clean staged package on cancellation * ci: restore exact release candidate validation Co-authored-by: Copilot App <[email protected]> * ci: bind candidate artifact source run Download the exact caller artifact from its immutable workflow run instead of assuming the reusable workflow shares the producer run. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 84bc73e4-939a-4e25-ba88-26af9f4fc8b5 * fix: support gateway command config migration Co-authored-by: Copilot App <[email protected]> Copilot-Session: 84bc73e4-939a-4e25-ba88-26af9f4fc8b5 * fix(setup): replay normalized gateway restarts Recognize the Gateway 2026.7.2 wizard restart error so setup uses the existing bounded, ownership-verified replay path instead of failing before reconnect. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 84bc73e4-939a-4e25-ba88-26af9f4fc8b5 * fix(setup): own gateway lifecycle during wizard Co-authored-by: Copilot App <[email protected]> Copilot-Session: 84bc73e4-939a-4e25-ba88-26af9f4fc8b5 --------- Co-authored-by: Scott Hanselman <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: 84bc73e4-939a-4e25-ba88-26af9f4fc8b5
1 parent e295df2 commit 9f9a8ed

19 files changed

Lines changed: 1755 additions & 121 deletions

‎.github/workflows/release-candidate-e2e.yml‎

Lines changed: 405 additions & 0 deletions
Large diffs are not rendered by default.

‎docs/SETUP_ENGINE_REDESIGN.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ OpenClaw.SetupEngine.Program.Main(["--log-path", "./trace.log"])
313313
```
314314

315315
Common flags include `--config`, `--headless`, `--dry-run`, `--rollback-on-failure`, `--no-rollback-on-failure`, `--log-path`, `--gateway-port`, and uninstall safety flags such as `--uninstall` plus `--confirm-destructive`.
316+
The cross-repository release gate may also pass `--gateway-candidate-package <absolute-tgz>` together with `--validate-gateway-candidate`, headless mode, and rollback-on-failure. This runtime-only input is not deserialized from setup config and does not authorize normal product setup to install an unvalidated release.
316317

317318
SetupEngine option names are case-insensitive. Value options accept either separated
318319
syntax (`--config custom.json`) or equals syntax (`--config=custom.json`). Unknown
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
using System.Runtime.CompilerServices;
22

33
[assembly: InternalsVisibleTo("OpenClaw.SetupEngine.Tests")]
4+
[assembly: InternalsVisibleTo("OpenClaw.E2ETests")]

‎src/OpenClaw.SetupEngine/CommandRunner.cs‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Task<CommandResult> RunAsync(
1616
IReadOnlyDictionary<string, string>? environment = null,
1717
string? workingDirectory = null,
1818
string? stdinInput = null,
19-
CancellationToken ct = default);
19+
CancellationToken ct = default,
20+
Stream? stdinStream = null);
2021

2122
/// <summary>
2223
/// Run a command inside a WSL distro.
@@ -84,8 +85,14 @@ public async Task<CommandResult> RunAsync(
8485
IReadOnlyDictionary<string, string>? environment = null,
8586
string? workingDirectory = null,
8687
string? stdinInput = null,
87-
CancellationToken ct = default)
88+
CancellationToken ct = default,
89+
Stream? stdinStream = null)
8890
{
91+
ArgumentNullException.ThrowIfNull(executable);
92+
ArgumentNullException.ThrowIfNull(arguments);
93+
if (stdinInput != null && stdinStream != null)
94+
throw new ArgumentException("Only one standard input source may be provided.");
95+
8996
_logger.CommandStarted(executable, arguments, timeout);
9097
var sw = Stopwatch.StartNew();
9198

@@ -94,7 +101,7 @@ public async Task<CommandResult> RunAsync(
94101
FileName = executable,
95102
RedirectStandardOutput = true,
96103
RedirectStandardError = true,
97-
RedirectStandardInput = stdinInput != null,
104+
RedirectStandardInput = stdinInput != null || stdinStream != null,
98105
UseShellExecute = false,
99106
CreateNoWindow = true,
100107
WorkingDirectory = workingDirectory ?? ""
@@ -137,12 +144,21 @@ public async Task<CommandResult> RunAsync(
137144

138145
try
139146
{
140-
if (stdinInput != null)
147+
if (stdinInput != null || stdinStream != null)
141148
{
142149
try
143150
{
144-
await process.StandardInput.WriteAsync(stdinInput.AsMemory(), timeoutCts.Token);
145-
await process.StandardInput.FlushAsync(timeoutCts.Token);
151+
if (stdinStream != null)
152+
{
153+
await stdinStream.CopyToAsync(process.StandardInput.BaseStream, timeoutCts.Token);
154+
await process.StandardInput.BaseStream.FlushAsync(timeoutCts.Token);
155+
}
156+
else
157+
{
158+
await process.StandardInput.WriteAsync(stdinInput!.AsMemory(), timeoutCts.Token);
159+
await process.StandardInput.FlushAsync(timeoutCts.Token);
160+
}
161+
146162
process.StandardInput.Close();
147163
}
148164
catch (IOException) when (process.HasExited)

‎src/OpenClaw.SetupEngine/GatewayReleasePolicy.cs‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,56 @@ public static GatewayReleaseResolution ResolveAndApply(
312312
return resolution;
313313
}
314314

315+
internal static GatewayReleaseResolution ResolveAndApplyValidationPackage(SetupConfig config)
316+
{
317+
ArgumentNullException.ThrowIfNull(config);
318+
var policyErrors = ValidateEmbeddedPolicy();
319+
if (policyErrors.Count != 0)
320+
{
321+
throw Failure(
322+
GatewayCompatibilityFailureKind.InvalidPolicy,
323+
$"Embedded Gateway release policy is invalid: {string.Join(" ", policyErrors)}");
324+
}
325+
326+
if (!IsOfficialInstallerUrl(config.Gateway.InstallUrl))
327+
{
328+
throw Failure(
329+
GatewayCompatibilityFailureKind.InvalidPolicy,
330+
"Gateway candidate package validation requires the official installer.");
331+
}
332+
333+
var selectedVersion = config.Gateway.Version?.Trim();
334+
if (string.IsNullOrWhiteSpace(selectedVersion))
335+
{
336+
throw Failure(
337+
GatewayCompatibilityFailureKind.InvalidPolicy,
338+
"Gateway candidate package validation requires an exact Gateway.Version.");
339+
}
340+
341+
ValidateStableFloor(selectedVersion);
342+
_ = s_releases.TryGetValue(selectedVersion, out var evidence);
343+
if (evidence?.Status == GatewayReleaseStatus.Rejected)
344+
{
345+
var detail = string.IsNullOrWhiteSpace(evidence.RejectionReason)
346+
? ""
347+
: $" {evidence.RejectionReason}.";
348+
throw Failure(
349+
GatewayCompatibilityFailureKind.UnattestedRelease,
350+
$"Gateway {selectedVersion} is rejected for protocol-v{ProtocolGeneration} Windows setup.{detail}");
351+
}
352+
353+
var resolution = new GatewayReleaseResolution(
354+
GatewayReleaseSelectionMode.Exact,
355+
selectedVersion,
356+
ProtocolGeneration,
357+
IsCustomInstaller: false,
358+
evidence);
359+
config.Gateway.Selection = "exact";
360+
config.Gateway.Version = selectedVersion;
361+
config.Gateway.ResolvedRelease = resolution;
362+
return resolution;
363+
}
364+
315365
public static GatewayCompatibilityException? ValidateHandshake(
316366
SetupConfig config,
317367
GatewaySelfInfo? gatewaySelf)

‎src/OpenClaw.SetupEngine/GatewayWizardRestartRecoveryPolicy.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static bool IsRestartLikeDisconnect(Exception exception)
3535
if (current is GatewayConnectionLostException ||
3636
current.Message.Contains("connection lost", StringComparison.OrdinalIgnoreCase) ||
3737
current.Message.Contains("gateway restarting", StringComparison.OrdinalIgnoreCase) ||
38+
current.Message.Contains("during gateway restart", StringComparison.OrdinalIgnoreCase) ||
3839
current.Message.Contains("service restart", StringComparison.OrdinalIgnoreCase))
3940
{
4041
return true;

‎src/OpenClaw.SetupEngine/Program.cs‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public static class Program
1616
"--local-data-dir",
1717
"--distro-name",
1818
"--gateway-port",
19+
"--gateway-candidate-package",
1920
"--tailscale-auth",
2021
"--tailscale-hostname",
2122
"--autostart-name",
@@ -63,6 +64,7 @@ public static async Task<int> Main(string[] args)
6364
var localDataDir = parsedArguments.GetValue("--local-data-dir");
6465
var distroName = parsedArguments.GetValue("--distro-name");
6566
var gatewayPortText = parsedArguments.GetValue("--gateway-port");
67+
var gatewayCandidatePackage = parsedArguments.GetValue("--gateway-candidate-package");
6668
var tailscale = parsedArguments.HasFlag("--tailscale");
6769
var tailscaleTrustAuth = parsedArguments.HasFlag("--tailscale-trust-auth");
6870
var validateGatewayCandidate = parsedArguments.HasFlag("--validate-gateway-candidate");
@@ -142,13 +144,37 @@ public static async Task<int> Main(string[] args)
142144
if (dryRun) config.DryRun = true;
143145
if (confirmDestructive) config.ConfirmDestructive = true;
144146

147+
if (gatewayCandidatePackage != null)
148+
{
149+
if (!validateGatewayCandidate || !config.Headless || !config.RollbackOnFailure)
150+
{
151+
Console.Error.WriteLine(
152+
"ERROR: --gateway-candidate-package requires --validate-gateway-candidate, headless mode, and rollback on failure.");
153+
return 2;
154+
}
155+
156+
if (!InstallCliStep.TryValidateCandidatePackagePath(
157+
gatewayCandidatePackage,
158+
out var normalizedPackagePath,
159+
out var packageError))
160+
{
161+
Console.Error.WriteLine($"ERROR: {packageError}");
162+
return 2;
163+
}
164+
165+
config.Gateway.ValidationPackagePath = normalizedPackagePath;
166+
}
167+
145168
if (!uninstall && !wizardOnly)
146169
{
147170
try
148171
{
149-
GatewayReleasePolicy.ResolveAndApply(
150-
config,
151-
allowCandidate: validateGatewayCandidate);
172+
if (config.Gateway.ValidationPackagePath != null)
173+
GatewayReleasePolicy.ResolveAndApplyValidationPackage(config);
174+
else
175+
GatewayReleasePolicy.ResolveAndApply(
176+
config,
177+
allowCandidate: validateGatewayCandidate);
152178
}
153179
catch (GatewayCompatibilityException ex)
154180
{

‎src/OpenClaw.SetupEngine/SetupContext.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ public sealed class GatewayConfig
157157
public string? InstallUrl { get; set; }
158158
public string Selection { get; set; } = "recommended";
159159
public string? Version { get; set; }
160+
// Runtime-only input for the explicit headless release-candidate validation lane.
161+
[JsonIgnore]
162+
public string? ValidationPackagePath { get; set; }
160163
public int HealthTimeoutSeconds { get; set; } = 90;
161164
public string ReloadMode { get; set; } = "hybrid";
162165
public string AuthMode { get; set; } = "token";

0 commit comments

Comments
 (0)