carlos / platform Public

status, console, cli: carry the console fleet block to carlos system status; UX pass and copy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev b5f1881523baff25b98aeccadab9659b7ce4dd15 parent f047fa8
12 files changed, +469 −9
  • docs/superpowers/notes/copy/LUNA-COPY-BRIEF-hub-console-socket.md +42 −0
  • docs/superpowers/notes/copy/hub-console-socket.md +95 −0
  • internal/console/apisystemupdate.go +6 −1
  • internal/console/apisystemupdate_test.go +32 −0
  • internal/edge/replicaconsole.go +12 −7
  • internal/host/agent.go +7 −0
  • internal/host/consolefleet.go +66 −0
  • internal/host/consolefleet_test.go +40 −0
  • internal/status/consolefleet_probe_test.go +49 −0
  • internal/status/snapshot.go +28 −1
  • system.go +32 −0
  • system_consolefleet_test.go +60 −0
diff --git a/docs/superpowers/notes/copy/LUNA-COPY-BRIEF-hub-console-socket.md b/docs/superpowers/notes/copy/LUNA-COPY-BRIEF-hub-console-socket.md
new file mode 100644
index 000000000..7066c8594
--- /dev/null
+++ b/docs/superpowers/notes/copy/LUNA-COPY-BRIEF-hub-console-socket.md
@@ -0,0 +1,42 @@
+# Copy review brief: hub console socket (delegated by Paul's standing rule)
+
+Paul delegated copy review for plan copy to you. You are the copy editor, and
+your edits are applied as approved copy.
+
+## What the change is
+
+A tunnel hub hands fleet boxes' console calls to the console on the same
+box. Until now it found the console by a setting an operator had to put on
+the box, or not at all. Now root gives the console a private socket and the
+hub uses it. `carlos system status` gains one indented line under a box that
+has a console or takes box calls, saying how the hub's last box call went:
+its result, which way it went (the private socket, the operator's setting
+`env`, or the old route scan), and how long ago. When the socket is not
+usable, a second line says why, using the system's own reason.
+
+The layout, the UX pass and the strings are in
+`docs/superpowers/notes/copy/hub-console-socket.md`. Read it first: review the
+copy in that layout.
+
+## House rules (Paul's, all binding)
+
+- No em dashes or en dashes, ever. Use a full stop and a new sentence.
+- Plain words, short sentences. Say what to do next where there is a next
+ step.
+- Keep every placeholder (`<reason>`, `<host>`, `<path>`), every backticked
+ name, unit name, path and setting exactly.
+- Do not change meaning or the facts a string states. If a fact looks
+ wrong, flag it.
+- CLI status words are lower case, like the neighbouring `current`,
+ `UNREACHABLE`, `behind → <version>`.
+- Log lines (L1-L6) are not copy: do not review them.
+
+## The rows
+
+C1-C6 and R1-R10 in the note. R1-R10 print after `socket not ready: ` and
+also in root's journal line, so they read as a clause, lower case, no full
+stop at the end.
+
+## Output
+
+A table: key, new text (or "approved"), why. Then one line: done.
diff --git a/docs/superpowers/notes/copy/hub-console-socket.md b/docs/superpowers/notes/copy/hub-console-socket.md
new file mode 100644
index 000000000..eaed4fd09
--- /dev/null
+++ b/docs/superpowers/notes/copy/hub-console-socket.md
@@ -0,0 +1,95 @@
+# Hub console socket: UX pass and copy
+
+Plan Task 6 (`docs/superpowers/plans/2026-11-24-hub-console-socket.md`).
+The UX pass comes first, then the copy review in the layout below.
+
+## UX pass (2026-11-24)
+
+The question an operator brings: "does this hub hand boxes' calls to its
+console, and how?" `carlos system status` already prints one line per box
+(label, platform, channel, release, state). The console's answer goes on its
+own indented line under a box that has a console or takes box calls, so the
+box line keeps its columns and the answer leads with its state.
+
+First draft put the answer at the end of the box line. Rendered at 48
+columns (the 390 px case) the box line already wraps at about 60
+characters, and the suffix landed mid-line on the wrap, hard to find. Moved
+to its own line, which starts in column 3 at every width.
+
+Rendered, 160 columns, no colour (states in colour: `ok` green, a status
+code red, `socket not ready` amber, `no call yet` plain):
+
+```
+carlos-flagship-ie linux-arm64 stable v0.42.0 current
+ console ok · socket · 2m00s ago
+carlos-dev-ie linux-arm64 stable v0.42.0 current
+ console ok · env · 40s ago
+ socket not ready: root's console fleet record is not exclusive: console.service sets RuntimeDirectoryPreserve=yes, so /run/carlos-console would outlive the console
+carlos-dev-ie-b linux-arm64 stable v0.42.0 current
+ console 503 · route scan · 1m05s ago
+ socket not ready: lstat /run/carlos-console: no such file or directory
+carlos-hub-b linux-arm64 stable v0.42.0 current
+ console no call yet
+```
+
+Rendered, 48 columns:
+
+```
+carlos-flagship-ie linux-arm64 stable v0.42
+.0 current
+ console ok · socket · 2m00s ago
+carlos-dev-ie-b linux-arm64 stable v0.42
+.0 current
+ console 503 · route scan · 1m05s ago
+ socket not ready: lstat /run/carlos-console: n
+o such file or directory
+```
+
+What the pass changed:
+- State first: the result (`ok`, or the status code) is the first word
+ after `console`, then the source, then the age.
+- "Socket not ready" is shown only when the socket is not ready, never
+ "socket ready" (a healthy hub prints one short line).
+- The reason is on its own line and is the system's own words; it can be
+ long, and wraps without hiding the state above it.
+- No colour still reads: every state is a word, never a colour alone.
+- On a light background the green and red are the CLI's existing `ok` and
+ `bad` colours already used on the same screen (`colorFor`); amber is its
+ `warn`. Nothing new to check for contrast.
+
+## Strings for copy review
+
+C1 `console` (the line's label)
+C2 `ok` (a 2xx answer), or the status code
+C3 sources: `socket`, `env`, `route scan`
+C4 `<age> ago` (the CLI's `agoText`)
+C5 `no call yet`
+C6 `socket not ready: <reason>`
+
+Log lines:
+L1 edge: `edge: fleet replica calls do not use the console socket: <reason>`
+L2 root: `console fleet: <outcome>, exclusive=<true|false>[: <reason>]`
+L3 console: `console: no fleet socket: <dir> does not exist (root's drop-in gives console.service that runtime directory); serving TCP only`
+L4 console: `console: no fleet socket: <dir> <refusal>; serving TCP only`, `console: no fleet socket: <error>; serving TCP only`
+L5 console: `console: fleet socket listening on <path>`
+L6 console: `console: <addr> stopped serving: <error>; the main listener carries on`
+
+Root's reasons (C6 and L2 carry them):
+R1 `the drop-in is not in effect: console.service has no RuntimeDirectory=carlos-console`
+R2 `console.service sets RuntimeDirectoryPreserve=<v>, so /run/carlos-console would outlive the console`
+R3 `console.service's RuntimeDirectoryMode is <m>, not 0755`
+R4 `a capability drop-in for <host> also claims /run/carlos-console`
+R5 `/run/carlos-console exists while console.service is <state>, so something else made it`
+R6 `no console.service on this box`
+R7 `cannot record a pending reload, so nothing was changed: <error>`
+R8 `changing <path>: <error>; the next pass reloads`
+R9 `daemon-reload after changing <path>: <error>; the next pass retries`
+R10 `daemon-reload owed by an earlier pass failed: <error>`
+
+## Copy review
+
+(Luna pass result below.)
+
+Luna pass, 2026-11-24 (`codex exec -m gpt-5.6-luna -s read-only`, brief
+`LUNA-COPY-BRIEF-hub-console-socket.md`): every row C1-C6 and R1-R10
+approved as drafted. Log lines L1-L6 are not copy and were not reviewed.
diff --git a/internal/console/apisystemupdate.go b/internal/console/apisystemupdate.go
index b0f3596dc..5730c4e49 100644
--- a/internal/console/apisystemupdate.go
+++ b/internal/console/apisystemupdate.go
@@ -1092,12 +1092,17 @@ func (s *Server) handleAPISystemStatus(w http.ResponseWriter, r *http.Request) {
// prints root's last named-units record beside the heartbeat's age.
row := map[string]any{"label": b.Label, "region": b.Region, "stale": status.BoxStale(b, now, status.SnapshotPeriod),
"platform": "", "channel": "", "release": "", "target": "", "system": nil,
- "instance_id": "", "heartbeat_at": b.GeneratedAt, "named_units": nil}
+ "instance_id": "", "heartbeat_at": b.GeneratedAt, "named_units": nil, "console_fleet": nil}
if b.Metrics != nil {
row["instance_id"] = b.Metrics.InstanceID
if b.Metrics.NamedUnits != nil {
row["named_units"] = b.Metrics.NamedUnits
}
+ // How the box's edge reaches its console for fleet boxes'
+ // calls (hub console spec §8); carlos system status prints it.
+ if b.Metrics.ConsoleFleet != nil {
+ row["console_fleet"] = b.Metrics.ConsoleFleet
+ }
ch := b.Metrics.SystemChannel
if ch == "" {
ch = release.RungStable
diff --git a/internal/console/apisystemupdate_test.go b/internal/console/apisystemupdate_test.go
index 2555a8813..84cd35c4b 100644
--- a/internal/console/apisystemupdate_test.go
+++ b/internal/console/apisystemupdate_test.go
@@ -818,3 +818,35 @@ func TestAPISystemStatusRowsCarryInstanceAndNamedUnits(t *testing.T) {
t.Errorf("plain row = %v, want instance_id \"\" and named_units null", plain)
}
}
+
+// TestAPISystemStatusRowsCarryConsoleFleet: the hub console block (hub
+// console spec §8) reaches each box's row as the heartbeat carried it, and
+// a box without it has a null field, not a missing one.
+func TestAPISystemStatusRowsCarryConsoleFleet(t *testing.T) {
+ fx := newConsoleFixture(t)
+ owner := cliToken(t, fx, "paul@keymail.dev", "code-sys-console-fleet")
+ at := time.Now().UTC().Truncate(time.Second)
+ cf := &status.ConsoleFleet{SocketReason: "lstat /run/carlos-console: no such file or directory", Source: "env", Result: "ok", At: at}
+ b := status.CollectBox(nil, status.Probes{Release: "v0.25.0", Platform: "linux-arm64", ConsoleFleet: cf}, at)
+ b.Label = "hub"
+ if err := status.WriteBox(context.Background(), fx.rel, b); err != nil {
+ t.Fatal(err)
+ }
+ seedBox(t, fx, "plain", "linux-arm64", "stable", "v0.25.0")
+ st, out := getJSON(t, fx.ts.URL+"/api/cli/system/status", owner)
+ if st != http.StatusOK {
+ t.Fatalf("status = %d %v", st, out)
+ }
+ rows := map[string]map[string]any{}
+ for _, r := range out["boxes"].([]any) {
+ row := r.(map[string]any)
+ rows[row["label"].(string)] = row
+ }
+ got, ok := rows["hub"]["console_fleet"].(map[string]any)
+ if !ok || got["source"] != "env" || got["result"] != "ok" || got["socket_ready"] != false || got["socket_reason"] != cf.SocketReason {
+ t.Fatalf("console_fleet = %v", rows["hub"]["console_fleet"])
+ }
+ if v, present := rows["plain"]["console_fleet"]; !present || v != nil {
+ t.Fatalf("plain row console_fleet = %v (present %v), want null", v, present)
+ }
+}
diff --git a/internal/edge/replicaconsole.go b/internal/edge/replicaconsole.go
index 9c1003723..ce2ffcaff 100644
--- a/internal/edge/replicaconsole.go
+++ b/internal/edge/replicaconsole.go
@@ -24,13 +24,18 @@ import (
// replicaConsoleAddrEnv names, in the hub's host.env, the loopback address
// of the console process the hub hands fleet boxes' replica calls to. It is
-// operator configuration, and the only source trusted for that endpoint:
-// route rows come from deployment records, and records are not a tenancy
-// boundary (a legacy direct-S3 fleet box can write them), so no route field
-// may choose, redirect or disable where those calls and their fleet bearer
-// tokens go. A self-hosted deployment whose console is installed into its
-// operator account sets it (Tito: 127.0.0.1:8090); the platform's own hubs
-// need not.
+// operator configuration and wins over everything else. Route rows come
+// from deployment records, and records are not a tenancy boundary (a legacy
+// direct-S3 fleet box can write them), so no route field may choose,
+// redirect or disable where those calls and their fleet bearer tokens go.
+// Unset, the hub uses the console's fleet socket (consolefleet.Socket),
+// which root's install gives console.service and only that unit's user can
+// bind, while root's record says the console holds it alone; the platform's
+// own hubs need nothing set. The setting stays the override for a console
+// root's adopt pass does not install (Tito's, a self-hosted one).
+// docs/superpowers/specs/2026-11-24-hub-console-address-from-install-design.md
+// has the argument. The route scan below the socket goes the release after
+// the socket ships (Paul, 2026-11-24).
const replicaConsoleAddrEnv = "CARLOS_REPLICA_CONSOLE_ADDR"
// WithReplicaConsoleAddr configures the replica console endpoint (tests;
diff --git a/internal/host/agent.go b/internal/host/agent.go
index b4e8f7942..645fe8bf9 100644
--- a/internal/host/agent.go
+++ b/internal/host/agent.go
@@ -1379,6 +1379,9 @@ func runAgent(args []string, buildClaims ClaimFactory) {
// behind this handle without the heartbeat needing to be re-wired.
setUpstreamSource(e.UpstreamStates)
setReplicaSource(e.ReplicaSnapshots)
+ // How the edge reaches the console for fleet boxes' calls (hub
+ // console spec §8), the same way.
+ consoleFleetEdgeSource.Store(e)
// The GeoIP block for the heartbeat (geoip spec §5.5), the same way.
geoIPSource.Store(e.GeoIPState)
heldStreamsSource.Store(e.HeldStreamsForStatus)
@@ -5317,6 +5320,10 @@ func statusLoop(reg *registry.Registry, svc *activator.Service, buildStates func
// Root's named-units record, read from its public store; nil when
// absent or unreadable. No bucket request.
p.NamedUnits = namedUnitsStatusProbe()
+ // The console fleet block (hub console spec §8): root's record from
+ // its public store, the socket's readiness and the edge's last box
+ // call. No store request.
+ p.ConsoleFleet = consoleFleetProbe()
// A fleet box (CARLOS_FLEET set) never gets here as a contender: it
// self-reports only, never attempting the election at all — no
diff --git a/internal/host/consolefleet.go b/internal/host/consolefleet.go
index 3d950d74d..605bc178b 100644
--- a/internal/host/consolefleet.go
+++ b/internal/host/consolefleet.go
@@ -18,12 +18,15 @@ import (
"path/filepath"
"slices"
"strings"
+ "sync/atomic"
"time"
"github.com/carlosframework/platform/internal/caps"
"github.com/carlosframework/platform/internal/consolefleet"
+ "github.com/carlosframework/platform/internal/edge"
"github.com/carlosframework/platform/internal/hostfloor"
"github.com/carlosframework/platform/internal/rootstate"
+ "github.com/carlosframework/platform/internal/status"
"github.com/carlosframework/platform/internal/systemd"
)
@@ -317,3 +320,66 @@ func consoleFleetLogLine(rec consolefleet.Record) string {
}
return line
}
+
+// consoleFleetEdge is what the heartbeat reads of the edge.
+type consoleFleetEdge interface {
+ LastReplicaConsoleCall() *edge.ReplicaConsoleCall
+ ConsoleFleetSocketReady() error
+}
+
+// consoleFleetEdgeSource is the running edge, once it exists.
+var consoleFleetEdgeSource atomic.Pointer[edge.Edge]
+
+// consoleFleetProbe is the heartbeat's console fleet block, or nil on a
+// box with no console (root's record absent or "absent") and no box call.
+func consoleFleetProbe() *status.ConsoleFleet {
+ var e consoleFleetEdge
+ if p := consoleFleetEdgeSource.Load(); p != nil {
+ e = p
+ }
+ return buildConsoleFleetBlock(readConsoleFleetRecordForStatus(), e)
+}
+
+// readConsoleFleetRecordForStatus is root's record through the same
+// trusted store root writes it with; nil when absent or unreadable.
+func readConsoleFleetRecordForStatus() *consolefleet.Record {
+ st, err := rootstate.Open(consolefleet.StatusDir, false, true)
+ if err != nil {
+ return nil
+ }
+ defer st.Close()
+ raw, err := st.Read(consolefleet.StatusFile)
+ if err != nil {
+ return nil
+ }
+ rec, err := consolefleet.DecodeRecord(raw)
+ if err != nil {
+ return nil
+ }
+ return &rec
+}
+
+func buildConsoleFleetBlock(rec *consolefleet.Record, e consoleFleetEdge) *status.ConsoleFleet {
+ var call *edge.ReplicaConsoleCall
+ if e != nil {
+ call = e.LastReplicaConsoleCall()
+ }
+ hasConsole := rec != nil && rec.Outcome != consolefleet.OutcomeAbsent && rec.Outcome != consolefleet.OutcomeRemoved
+ if !hasConsole && call == nil {
+ return nil
+ }
+ b := &status.ConsoleFleet{Record: rec}
+ if e != nil {
+ if err := e.ConsoleFleetSocketReady(); err != nil {
+ b.SocketReason = err.Error()
+ } else {
+ b.SocketReady = true
+ }
+ } else {
+ b.SocketReason = "the edge is not running yet"
+ }
+ if call != nil {
+ b.Source, b.Result, b.At = call.Source, call.Result, call.At
+ }
+ return b
+}
diff --git a/internal/host/consolefleet_test.go b/internal/host/consolefleet_test.go
index 065602488..04949455f 100644
--- a/internal/host/consolefleet_test.go
+++ b/internal/host/consolefleet_test.go
@@ -8,6 +8,7 @@ import (
"time"
"github.com/carlosframework/platform/internal/consolefleet"
+ "github.com/carlosframework/platform/internal/edge"
)
// fakeConsoleFleet is every seam of consoleFleetStep, in memory.
@@ -228,3 +229,42 @@ func TestParseConsoleUnitProps(t *testing.T) {
}
}
}
+
+type fakeFleetEdge struct {
+ call *edge.ReplicaConsoleCall
+ ready error
+}
+
+func (f fakeFleetEdge) LastReplicaConsoleCall() *edge.ReplicaConsoleCall { return f.call }
+func (f fakeFleetEdge) ConsoleFleetSocketReady() error { return f.ready }
+
+// TestBuildConsoleFleetBlock: a box with no console and no call reports
+// nothing; otherwise root's record, the socket's readiness and the last
+// call, each independent of the others.
+func TestBuildConsoleFleetBlock(t *testing.T) {
+ at := time.Date(2026, 11, 24, 10, 0, 0, 0, time.UTC)
+ exclusive := &consolefleet.Record{Schema: 1, Outcome: consolefleet.OutcomeUnchanged, Exclusive: true}
+ absent := &consolefleet.Record{Schema: 1, Outcome: consolefleet.OutcomeAbsent}
+ call := &edge.ReplicaConsoleCall{Source: edge.ReplicaConsoleSourceEnv, Result: "ok", At: at}
+ if b := buildConsoleFleetBlock(nil, fakeFleetEdge{}); b != nil {
+ t.Fatalf("no console, no call: %+v", b)
+ }
+ if b := buildConsoleFleetBlock(absent, fakeFleetEdge{}); b != nil {
+ t.Fatalf("absent console, no call: %+v", b)
+ }
+ b := buildConsoleFleetBlock(exclusive, fakeFleetEdge{call: call})
+ if b == nil || !b.SocketReady || b.Source != "env" || b.Result != "ok" || !b.At.Equal(at) || b.Record != exclusive {
+ t.Fatalf("env call, socket ready: %+v", b)
+ }
+ b = buildConsoleFleetBlock(exclusive, fakeFleetEdge{call: call, ready: errors.New("lstat /run/carlos-console: no such file or directory")})
+ if b == nil || b.SocketReady || !strings.Contains(b.SocketReason, "no such file") || b.Source != "env" {
+ t.Fatalf("env call, socket absent: %+v", b)
+ }
+ b = buildConsoleFleetBlock(absent, fakeFleetEdge{call: call, ready: errors.New("x")})
+ if b == nil || b.Source != "env" {
+ t.Fatalf("a hub with no console that takes calls: %+v", b)
+ }
+ if b := buildConsoleFleetBlock(exclusive, nil); b == nil || b.SocketReady || b.Source != "" {
+ t.Fatalf("no edge yet: %+v", b)
+ }
+}
diff --git a/internal/status/consolefleet_probe_test.go b/internal/status/consolefleet_probe_test.go
new file mode 100644
index 000000000..120b0e7ff
--- /dev/null
+++ b/internal/status/consolefleet_probe_test.go
@@ -0,0 +1,49 @@
+package status
+
+import (
+ "encoding/json"
+ "reflect"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/consolefleet"
+)
+
+// TestCollectBoxCarriesConsoleFleet: the block reaches Box.Metrics, and
+// survives a JSON round trip as the heartbeat does; a box without it omits
+// the key.
+func TestCollectBoxCarriesConsoleFleet(t *testing.T) {
+ at := time.Date(2026, 11, 24, 10, 0, 0, 0, time.UTC)
+ cf := &ConsoleFleet{Record: &consolefleet.Record{Schema: 1, Outcome: "unchanged", Exclusive: true, At: at}, SocketReady: true, Source: "socket", Result: "ok", At: at}
+ box := CollectBox(nil, Probes{ConsoleFleet: cf}, at)
+ if box.Metrics == nil || !reflect.DeepEqual(box.Metrics.ConsoleFleet, cf) {
+ t.Fatalf("Metrics.ConsoleFleet = %+v", box.Metrics)
+ }
+ raw, err := json.Marshal(box.Metrics)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var back BoxMetrics
+ if err := json.Unmarshal(raw, &back); err != nil || !reflect.DeepEqual(back.ConsoleFleet, cf) {
+ t.Fatalf("round trip: %+v %v", back.ConsoleFleet, err)
+ }
+ none := CollectBox(nil, Probes{Release: "v1"}, at)
+ raw, _ = json.Marshal(none.Metrics)
+ var m map[string]any
+ _ = json.Unmarshal(raw, &m)
+ if _, ok := m["console_fleet"]; ok {
+ t.Fatalf("a box without the block carried console_fleet: %s", raw)
+ }
+}
+
+// TestConsoleFleetNoCallYetOmitsTheTime: no call since the edge started
+// has no source, result or time on the wire.
+func TestConsoleFleetNoCallYetOmitsTheTime(t *testing.T) {
+ raw, err := json.Marshal(ConsoleFleet{SocketReason: "x"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if string(raw) != `{"socket_ready":false,"socket_reason":"x"}` {
+ t.Fatalf("%s", raw)
+ }
+}
diff --git a/internal/status/snapshot.go b/internal/status/snapshot.go
index c6580a0a6..fab042064 100644
--- a/internal/status/snapshot.go
+++ b/internal/status/snapshot.go
@@ -32,6 +32,7 @@ import (
"os"
"time"
+ "github.com/carlosframework/platform/internal/consolefleet"
"github.com/carlosframework/platform/internal/democlaim"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
@@ -240,6 +241,11 @@ type Probes struct {
// NamedUnits is root's last named-units record, read by the agent from
// the public root store; nil when root has written none.
NamedUnits *NamedUnitsStatus
+ // ConsoleFleet is how this box's edge reaches its console for fleet
+ // boxes' calls (hub console spec §8): root's record, the socket's live
+ // readiness and the edge's last box call. nil on a box with neither a
+ // console nor a box call.
+ ConsoleFleet *ConsoleFleet
// SeedsFloor is the box's seeds protocol floor as it advertises it in
// the edges file, so the console can read the same facts for a fleet
// (seeded-create D3). nil when the box did not say.
@@ -419,6 +425,24 @@ type ConfigRefusal struct {
Count int `json:"count"`
}
+// ConsoleFleet is the hub console spec §8's heartbeat block: root's
+// console fleet record (nil when root has written none or it does not
+// decode), whether the console's fleet socket would take a box call now
+// and, if not, why, and the edge's last box call: the source it used
+// (env, socket, route-scan), its result ("ok" or the status code) and
+// when. Source empty: no call since the edge started. It only reports;
+// nothing reads it as authority.
+//
+// PRIVATE, like everything under Box.Metrics.
+type ConsoleFleet struct {
+ Record *consolefleet.Record `json:"record,omitempty"`
+ SocketReady bool `json:"socket_ready"`
+ SocketReason string `json:"socket_reason,omitempty"`
+ Source string `json:"source,omitempty"`
+ Result string `json:"result,omitempty"`
+ At time.Time `json:"at,omitzero"`
+}
+
// NamedUnitsStatus is root's record of its last named-units step: which
// parameter it read, at what version, what it did with the value
// (Outcome: installed, unchanged, not-found, unreadable, invalid, held,
@@ -878,6 +902,8 @@ type BoxMetrics struct {
// carried in the heartbeat the agent already publishes. Omitted when root
// has written none.
NamedUnits *NamedUnitsStatus `json:"named_units,omitempty"`
+ // ConsoleFleet is Probes.ConsoleFleet. Omitted when nil.
+ ConsoleFleet *ConsoleFleet `json:"console_fleet,omitempty"`
// SeedsFloor is Probes.SeedsFloor: the seeds protocol floor facts a
// fleet's seed door reads. Omitted when the box did not say.
SeedsFloor *SeedsFloorReport `json:"seeds_floor,omitempty"`
@@ -1323,7 +1349,7 @@ func CollectBox(routes []registry.Route, p Probes, now time.Time) Box {
len(routeDBBytes) > 0 || p.Layout != nil || len(p.ConfigRefusals) > 0 || len(p.ReleaseRefusals) > 0 || len(p.ProofWaits) > 0 || p.Rollout != nil || p.ConfigGuard != "" ||
p.Alerts != nil || p.GeoIP != nil || p.HeldStreams != nil || len(p.BuildStates) > 0 || p.BuildStatesErr != "" ||
p.DemoClaimSeedReady || p.DemoMovedReady || p.UpdateSettings != 0 || len(p.Updates) > 0 || len(p.Egress) > 0 || p.SizeCommittedMiB != nil ||
- p.MailerArmed || p.OfflineMove != nil || p.NamedUnits != nil || p.SeedsFloor != nil {
+ p.MailerArmed || p.OfflineMove != nil || p.NamedUnits != nil || p.SeedsFloor != nil || p.ConsoleFleet != nil {
var capabilities []string
if p.DemoClaimSeedReady {
capabilities = append(capabilities, seeds.DemoClaimCapability)
@@ -1384,6 +1410,7 @@ func CollectBox(routes []registry.Route, p Probes, now time.Time) Box {
MailerArmed: p.MailerArmed,
OfflineMove: p.OfflineMove,
NamedUnits: p.NamedUnits,
+ ConsoleFleet: p.ConsoleFleet,
SeedsFloor: p.SeedsFloor,
}
}
diff --git a/system.go b/system.go
index 21ac8977c..bd3afbd8f 100644
--- a/system.go
+++ b/system.go
@@ -351,6 +351,10 @@ type systemBoxRow struct {
InstanceID string `json:"instance_id"`
HeartbeatAt time.Time `json:"heartbeat_at"`
NamedUnits *status.NamedUnitsStatus `json:"named_units"`
+ // ConsoleFleet is how the box's edge reaches its console for fleet
+ // boxes' calls (hub console spec §8). nil on a box with neither, or
+ // from a console before the field.
+ ConsoleFleet *status.ConsoleFleet `json:"console_fleet"`
}
// systemStatusResponse is the whole picture in one read. Partial says the box
@@ -627,6 +631,7 @@ func runSystemStatus(args []string) {
// console.
func printSystemStatus(w io.Writer, resp systemStatusResponse, channel string) {
c := colorFor(w)
+ now := time.Now()
for _, ch := range []string{"canary", "stable"} {
if channel != "" && ch != channel {
continue
@@ -691,7 +696,34 @@ func printSystemStatus(w io.Writer, resp systemStatusResponse, channel string) {
fmt.Fprintf(w, " %s %s: %s", c.bad(b.System.Outcome), b.System.Version, b.System.Reason)
}
fmt.Fprintln(w)
+ for _, line := range consoleFleetLines(c, b.ConsoleFleet, now) {
+ fmt.Fprintln(w, line)
+ }
+ }
+}
+
+// consoleFleetLines is a box's console fleet block under its line (hub
+// console spec §8; UX pass in docs/superpowers/notes/copy/
+// hub-console-socket.md): the last box call's result first, then its
+// source and age, and a second line only when the socket is not ready.
+func consoleFleetLines(c colors, f *status.ConsoleFleet, now time.Time) []string {
+ if f == nil {
+ return nil
+ }
+ var lines []string
+ if f.Source == "" {
+ lines = append(lines, " console no call yet")
+ } else {
+ result := c.ok(f.Result)
+ if f.Result != "ok" {
+ result = c.bad(f.Result)
+ }
+ lines = append(lines, fmt.Sprintf(" console %s · %s · %s", result, strings.ReplaceAll(f.Source, "-", " "), agoText(now, f.At)))
+ }
+ if !f.SocketReady {
+ lines = append(lines, " "+c.warn("socket not ready")+": "+f.SocketReason)
}
+ return lines
}
// ---- carlos system rollback --------------------------------------------
diff --git a/system_consolefleet_test.go b/system_consolefleet_test.go
new file mode 100644
index 000000000..b8a810d3a
--- /dev/null
+++ b/system_consolefleet_test.go
@@ -0,0 +1,60 @@
+package main
+
+import (
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/status"
+)
+
+// TestConsoleFleetLines: the UX pass's lines (docs/superpowers/notes/copy/
+// hub-console-socket.md): the result first, then source and age; a second
+// line only when the socket is not ready; nothing for a box without the
+// block.
+func TestConsoleFleetLines(t *testing.T) {
+ now := time.Date(2026, 11, 24, 10, 2, 0, 0, time.UTC)
+ at := now.Add(-2 * time.Minute)
+ for name, tc := range map[string]struct {
+ f *status.ConsoleFleet
+ want []string
+ }{
+ "none": {nil, nil},
+ "socket ok": {&status.ConsoleFleet{SocketReady: true, Source: "socket", Result: "ok", At: at}, []string{" console ok · socket · 2m00s ago"}},
+ "env, not ready": {&status.ConsoleFleet{SocketReason: "root's console fleet record is not exclusive: x", Source: "env", Result: "ok", At: at},
+ []string{" console ok · env · 2m00s ago", " socket not ready: root's console fleet record is not exclusive: x"}},
+ "route scan 503": {&status.ConsoleFleet{SocketReason: "lstat /run/carlos-console: no such file or directory", Source: "route-scan", Result: "503", At: at},
+ []string{" console 503 · route scan · 2m00s ago", " socket not ready: lstat /run/carlos-console: no such file or directory"}},
+ "no call yet": {&status.ConsoleFleet{SocketReady: true}, []string{" console no call yet"}},
+ } {
+ got := consoleFleetLines(colors{}, tc.f, now)
+ if strings.Join(got, "\n") != strings.Join(tc.want, "\n") {
+ t.Errorf("%s:\n got %q\nwant %q", name, got, tc.want)
+ }
+ }
+}
+
+// TestPrintSystemStatusConsoleFleet: the block prints under its own box,
+// and a box without it prints nothing more.
+func TestPrintSystemStatusConsoleFleet(t *testing.T) {
+ resp := systemStatusResponse{Boxes: []systemBoxRow{
+ {Label: "hub", Platform: "linux-arm64", Channel: "stable", Release: "v1", Target: "v1",
+ ConsoleFleet: &status.ConsoleFleet{SocketReady: true, Source: "socket", Result: "ok", At: time.Now().Add(-time.Minute)}},
+ {Label: "plain", Platform: "linux-arm64", Channel: "stable", Release: "v1", Target: "v1"},
+ }}
+ var b strings.Builder
+ printSystemStatus(&b, resp, "")
+ lines := strings.Split(strings.TrimSpace(b.String()), "\n")
+ var hub, plain int = -1, -1
+ for i, l := range lines {
+ switch {
+ case strings.HasPrefix(l, "hub "):
+ hub = i
+ case strings.HasPrefix(l, "plain "):
+ plain = i
+ }
+ }
+ if hub < 0 || plain != hub+2 || !strings.HasPrefix(lines[hub+1], " console ok · socket · ") {
+ t.Fatalf("output:\n%s", b.String())
+ }
+}