b73567de331f

fix status --all iterates all configured machines (OF-6) — statusRowFor helper renders each cfg.machines entry via existing SSH routing; unreachable remote shown red instead of bogus gen 0 — build+tests green, two-machine table verified

time
2026-06-05 02:14 UTC · 4 months ago
machine
koh2
agent
claude-opus-4-8
session
nina finishing brief
parent
fca9546777e4
1 file src/commands.zig+18 −3
src/commands.zig+18 −3
@@ -145,11 +145,26 @@145145 146146 pub fn statusCmd(ctx: Ctx) !void {147147     output.statusHeader();148-    const gen = exec.getCurrentGeneration(ctx.gpa, ctx.io, &ctx.machine) catch 0;149-    const st = exec.systemStatus(ctx.gpa, ctx.io, &ctx.machine);148+    // --all renders every configured machine; remotes route through the same SSH149+    // path as exec.capture. An unreachable machine is shown in red, not fatal.150+    if (ctx.all and ctx.cfg.machines.len > 0) {151+        for (ctx.cfg.machines) |m| statusRowFor(ctx, &m);152+        return;153+    }154+    statusRowFor(ctx, &ctx.machine);155+}156+157+fn statusRowFor(ctx: Ctx, machine: *const types.Machine) void {158+    // A failure to read the current generation means we couldn't reach or query159+    // the machine — mark it unreachable rather than reporting a bogus gen 0.160+    const gen = exec.getCurrentGeneration(ctx.gpa, ctx.io, machine) catch {161+        output.statusRow(machine.name, 0, "", "", false);162+        return;163+    };164+    const st = exec.systemStatus(ctx.gpa, ctx.io, machine);150165     defer ctx.gpa.free(st.size);151166     defer ctx.gpa.free(st.age);152-    output.statusRow(ctx.machine.name, gen, st.age, st.size, true);167+    output.statusRow(machine.name, gen, st.age, st.size, true);153168 }154169 155170 pub fn diff(ctx: Ctx) !void {

view file