Auto: ablegacy-12 — auto-demote on comm failure

Closes #255
This commit is contained in:
Joseph Doherty
2026-04-26 08:44:53 -04:00
parent 8ee65a75d2
commit 1e3053c0d8
18 changed files with 1160 additions and 31 deletions

View File

@@ -40,10 +40,19 @@ public sealed class ProbeCommand : AbLegacyCommandBase
await driver.InitializeAsync("{}", ct);
var snapshot = await driver.ReadAsync(["__probe"], ct);
var health = driver.GetHealth();
// PR ablegacy-12 / #255 — surface Demoted alongside the probe-driven
// HostState. After a one-shot probe the host hasn't been observed
// (no probe loop runs in CLI mode), so HostState is typically Unknown
// unless the read above tripped the demote threshold.
var hostStatus = driver.GetHostStatuses().FirstOrDefault();
await console.Output.WriteLineAsync($"Gateway: {Gateway}");
await console.Output.WriteLineAsync($"PLC type: {PlcType}");
await console.Output.WriteLineAsync($"Health: {health.State}");
if (hostStatus is not null)
{
await console.Output.WriteLineAsync($"Host state: {hostStatus.State}");
}
if (health.LastError is { } err)
await console.Output.WriteLineAsync($"Last error: {err}");
await console.Output.WriteLineAsync();