console, cli: label answer names the coordinator and the floor box
Additive answer fields, each set only on its refusal: coordinator_box on
coordinated; floor_box (a box label, or "console"), floor_release
("unknown" if unreported) and floor on floor. The CLI fills C24 and C29
from them, taking the floor from the answer; floor_box "console" reads
"the console". Door tests assert the fields on both refusals.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
instances_cli.go+14 −9instances_cli_label_test.go+6 −2internal/console/instancelabel.go+55 −0internal/console/instancelabel_test.go+18 −3
Intent
<task-notification> <task-id>ab2cf8140995c083d</task-id> <tool-use-id>toolu_01BswY8xVhNFgY8SkRStihKi</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ac77363b-5830-422c-9f38-d7f2540dd398/tasks/ab2cf8140995c083d.output</output-file> <status>completed</status> <summary>Agent "Implement Task 5: carlos instances label" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>- **Status:** NEEDS_CONTEXT. The verb is built, tested and committed. Two copy keys (C24, C29) need data the door's answer doesn't send. - **Commits:** `b39eecf5 cli: carlos instances label`. It changes `instances_cli.go`, `cli.go`, `parity/cli.tsv` and the new `instances_cli_label_test.go`. - **Tests:** RED, then GREEN. The brief's Step 4 command passes, and so does `go test ./internal/parity`, so `TestParityCLIPaths` is fixed. The darwin and windows builds compile. - **Concerns:** - **C24 and C29:** the answer has no coordinator box (C24) and no box release (C29). A `floor` refusal can also come from another box or the console, not only the named box. For now the CLI fills them with "another box", and with "an older release" plus the CLI's own copy of the floor version. Either the door adds those fields, or T7 rewrites the two strings. I did not change the door. - **C07 exits 0:** when the record is already tied and no box (or the same box) is named, it prints C07 and exits 0. That is the re-run C38 tells the user to make. C20 vs C34 is told apart by `serving_box`, which is only set when the door judged the evidence, so the door needed no change. - **For the T7 UX pass:** C14's suggested command leaves out `--console` and `--account`, and the `no_evidence` refusal repeats a line already printed above it. - **Deadline test:** it cancels the context at the channel barrier instead of letting a real timer fire, because a real timer could fire before the request is sent. - **Node location:** the clireg node is in `cli.go`, not `commands.go` as the brief says, because the `instances` node's children are defined there. - **Report:** /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-record-labels/.superpowers/sdd/2026-11-14-fleet-record-labels/task-5-report.md</result> <usage><subagent_tokens>156187</subagent_tokens><tool_uses>57</tool_uses><duration_ms>660153</duration_ms></usage> </task-notification>
Attributed to this commit: 11.1 g CO₂e (1,347,046 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on fleet-record-labels-m2, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/instances_cli.go b/instances_cli.go| index d62d65011..741c573b9 100644 |
| --- a/instances_cli.go |
| +++ b/instances_cli.go |
| @@ -1307,13 +1307,9 @@ var labelUnmovableReasons = map[string]string{ |
| "demo": "it is a demo", // draft for copy review (C31) |
| } |
| -// labelUnstatedCoordinator and labelUnstatedRelease fill C24's and C29's |
| -// second blanks: the door's answer carries neither the coordinating box nor |
| -// the release a box runs (task 5 report, concerns). |
| -const ( |
| - labelUnstatedCoordinator = "another box" |
| - labelUnstatedRelease = "an older release" |
| -) |
| +// labelFloorConsole is C29's first blank when the door's floor_box is |
| +// "console": it is this console that is below the floor. |
| +const labelFloorConsole = "the console" // draft for copy review (C29) |
| // instanceLabelBinding mirrors the door's labelBinding. |
| type instanceLabelBinding struct { |
| @@ -1338,6 +1334,11 @@ type instanceLabelAnswer struct { |
| Eligible bool `json:"eligible"` |
| WhyNot string `json:"why_not"` |
| Applied bool `json:"applied"` |
| + // Set only on their refusals: coordinated, and floor. |
| + CoordinatorBox string `json:"coordinator_box,omitempty"` |
| + FloorBox string `json:"floor_box,omitempty"` // a box label, or "console" |
| + FloorRelease string `json:"floor_release,omitempty"` |
| + Floor string `json:"floor,omitempty"` |
| } |
| // instanceLabelHTTPTimeout outlasts the door's own 30-second bound |
| @@ -1497,7 +1498,7 @@ func labelRefusal(host string, a *instanceLabelAnswer) string { |
| case "import": |
| return fmt.Sprintf(labelImporting, host) |
| case "coordinated": |
| - return fmt.Sprintf(labelCoordinated, host, labelUnstatedCoordinator) |
| + return fmt.Sprintf(labelCoordinated, host, a.CoordinatorBox) |
| case "not_active": |
| return fmt.Sprintf(labelNotActive, a.Box, a.Fleet) |
| case "draining": |
| @@ -1507,7 +1508,11 @@ func labelRefusal(host string, a *instanceLabelAnswer) string { |
| case "runtime": |
| return fmt.Sprintf(labelRuntime, a.Box) |
| case "floor": |
| - return fmt.Sprintf(labelFloor, a.Box, labelUnstatedRelease, a.Fleet, release.FleetRecordLabelFloor) |
| + who := a.FloorBox |
| + if who == "console" { |
| + who = labelFloorConsole |
| + } |
| + return fmt.Sprintf(labelFloor, who, a.FloorRelease, a.Fleet, a.Floor) |
| case "not_serving": |
| return fmt.Sprintf(labelNotServing, a.Box) |
| case "disagree": |
diff --git a/instances_cli_label_test.go b/instances_cli_label_test.go| index 74fe07034..1ce666797 100644 |
| --- a/instances_cli_label_test.go |
| +++ b/instances_cli_label_test.go |
| @@ -236,12 +236,16 @@ func TestInstancesLabelRefusalExitsNonZero(t *testing.T) { |
| {"assigned", withEarly("assigned", nil), nil, "shop.example.com runs as copies, so placement chooses its boxes"}, |
| {"move", withEarly("move", nil), nil, "shop.example.com has a move in progress. finish it before tying it to a box"}, |
| {"import", withEarly("import", nil), nil, "shop.example.com has an import in progress. finish it before tying it to a box"}, |
| - {"coordinated", refused("coordinated", nil), nil, "shop.example.com is coordinated by"}, |
| + {"coordinated", refused("coordinated", map[string]any{"coordinator_box": "box-2"}), nil, |
| + "shop.example.com is coordinated by box-2 right now. try again in a few minutes"}, |
| {"not_active", refused("not_active", nil), nil, "box-1 is not an active box of fleet pi"}, |
| {"draining", refused("draining", nil), nil, "box-1 is draining. it cannot take an instance"}, |
| {"stale", refused("stale", nil), nil, "box-1 has not reported in recently"}, |
| {"runtime", refused("runtime", nil), nil, "box-1 cannot run this app's runtime yet"}, |
| - {"floor", refused("floor", nil), nil, "before instances can be tied to boxes"}, |
| + {"floor: a box", refused("floor", map[string]any{"floor_box": "box-2", "floor_release": "v0.34.0", "floor": "v9.9.9"}), nil, |
| + "box-2 runs v0.34.0. every box of fleet pi needs v9.9.9 or later before instances can be tied to boxes"}, |
| + {"floor: the console", refused("floor", map[string]any{"floor_box": "console", "floor_release": "v0.34.0", "floor": "v9.9.9"}), nil, |
| + "the console runs v0.34.0. every box of fleet pi needs v9.9.9 or later before instances can be tied to boxes"}, |
| {"not_serving", refused("not_serving", map[string]any{"box": "box-2"}), []string{"--box", "box-2"}, |
| "box-2 is not the box serving it now. only that box can be named for now"}, |
| {"disagree", refused("disagree", map[string]any{"hub_box": "box-2", "agree": false, "serving_box": "", "box": ""}), nil, |
diff --git a/internal/console/instancelabel.go b/internal/console/instancelabel.go| index 1a4fe48a6..d3fce08d7 100644 |
| --- a/internal/console/instancelabel.go |
| +++ b/internal/console/instancelabel.go |
| @@ -65,6 +65,15 @@ type instanceLabelAnswer struct { |
| Eligible bool `json:"eligible"` |
| WhyNot string `json:"why_not"` |
| Applied bool `json:"applied"` |
| + // CoordinatorBox is set only on coordinated: the box the record's live |
| + // coordinator names. |
| + CoordinatorBox string `json:"coordinator_box,omitempty"` |
| + // FloorBox, FloorRelease and Floor are set only on floor: the first |
| + // box below release.FleetRecordLabelFloor ("console" when it is this |
| + // console), the release it reported ("unknown" if none), and the floor. |
| + FloorBox string `json:"floor_box,omitempty"` |
| + FloorRelease string `json:"floor_release,omitempty"` |
| + Floor string `json:"floor,omitempty"` |
| } |
| // The door's why_not codes, each one copy key in the CLI (plan T5/T7). |
| @@ -382,6 +391,8 @@ func (s *Server) judgeLabel(ctx context.Context, reg consoleRegistry, rec provis |
| return |
| case !box.AtLabelFloor || !s.fleetAtRecordFloor(v): |
| a.WhyNot = labelWhyFloor |
| + a.FloorBox, a.FloorRelease = s.labelFloorBox(ctx, v, *box) |
| + a.Floor = release.FleetRecordLabelFloor |
| return |
| case !box.destinationFor(rootfs): |
| a.WhyNot = labelWhyRuntime // a rootfs record on a box not rootfs-ready at the rootfs floor |
| @@ -415,9 +426,53 @@ func (s *Server) judgeLabel(ctx context.Context, reg consoleRegistry, rec provis |
| } |
| if c := rec.Coordinator; c != nil && c.Box != a.Box && (c.ExpiresAt.IsZero() || now.Before(c.ExpiresAt)) { |
| a.WhyNot = labelWhyCoordinated |
| + a.CoordinatorBox = c.Box |
| } |
| } |
| +// labelFloorBox names what failed the floor check for the answer, in the |
| +// check's order: the named box, this console, the first active box of the |
| +// fleet below the record label floor, then the first box of the deployment |
| +// below the box label floor (DeploymentCurrent). A release never reported |
| +// is "unknown". "" only if none of them is below (the view changed). |
| +func (s *Server) labelFloorBox(ctx context.Context, v fleetView, box fleetBoxView) (name, rel string) { |
| + reported := func(r string) string { |
| + if r == "" { |
| + return "unknown" |
| + } |
| + return r |
| + } |
| + if !box.AtLabelFloor || !atRecordLabelFloor(box.Release) { |
| + return box.Label, reported(box.Release) |
| + } |
| + build := s.consoleBuild |
| + if build == "" { |
| + build = version.Build |
| + } |
| + if !atRecordLabelFloor(build) { |
| + return "console", reported(build) |
| + } |
| + for _, b := range v.Boxes { |
| + if !atRecordLabelFloor(b.Release) { |
| + return b.Label, reported(b.Release) |
| + } |
| + } |
| + deploy, _, err := s.loadDeploymentBoxesComplete(ctx) |
| + if err != nil { |
| + log.Printf("console: api instance label: floor box: deployment heartbeats: %v", err) |
| + } |
| + for _, b := range deploy { |
| + if !boxAtLabelFloor(b) { |
| + r := "" |
| + if b.Metrics != nil { |
| + r = b.Metrics.Release |
| + } |
| + return b.Label, reported(r) |
| + } |
| + } |
| + return "", "" |
| +} |
| + |
| // unmovableReason is why movableVerified refused rec, in movable's order: |
| // a demo, an address the platform does not manage, an HA record, a system |
| // unit, and otherwise an always-on binary whose selected release is not |
diff --git a/internal/console/instancelabel_test.go b/internal/console/instancelabel_test.go| index e0d65d505..c515efb80 100644 |
| --- a/internal/console/instancelabel_test.go |
| +++ b/internal/console/instancelabel_test.go |
| @@ -259,7 +259,14 @@ func TestLabelDoorRefusesMoveAndAssignment(t *testing.T) { |
| fx, token, reg, created := labelWorld(t, "code-ld-rec-"+c.why, "pi-1", "pi-2") |
| servingEvidence(t, fx, reg, created, "pi-1") |
| editShop(t, fx, c.mut) |
| - wantRefused(t, fx, labelPost(t, fx, token, "pi-1", false), c.why) |
| + a := labelPost(t, fx, token, "pi-1", false) |
| + wantRefused(t, fx, a, c.why) |
| + if want := map[bool]string{true: "pi-2"}[c.why == "coordinated"]; a.CoordinatorBox != want { |
| + t.Fatalf("coordinator_box %q; want %q", a.CoordinatorBox, want) |
| + } |
| + if a.FloorBox != "" || a.FloorRelease != "" || a.Floor != "" { |
| + t.Fatalf("answer %+v; floor fields set off a floor refusal", a) |
| + } |
| if b := boxRow(t, reg, "pi-1"); b.LabelledAt != 0 { |
| t.Fatal("pi-1 was marked") |
| } |
| @@ -320,7 +327,11 @@ func TestLabelDoorFloor(t *testing.T) { |
| fx, token, reg, created := labelWorld(t, "code-ld-floor-box", "pi-1", "pi-2", "pi-3") |
| servingEvidence(t, fx, reg, created, "pi-1") |
| piBeat(t, fx, "pi-3", true, time.Now(), release.StatelessReplicasFloor) // above the label floor, below the record floor |
| - wantRefused(t, fx, labelPost(t, fx, token, "pi-1", false), "floor") |
| + a := labelPost(t, fx, token, "pi-1", false) |
| + wantRefused(t, fx, a, "floor") |
| + if a.FloorBox != "pi-3" || a.FloorRelease != release.StatelessReplicasFloor || a.Floor != release.FleetRecordLabelFloor { |
| + t.Fatalf("answer %+v; want floor_box pi-3 at %s, floor %s", a, release.StatelessReplicasFloor, release.FleetRecordLabelFloor) |
| + } |
| if b := boxRow(t, reg, "pi-1"); b.LabelledAt != 0 { |
| t.Fatal("pi-1 was marked below the floor") |
| } |
| @@ -329,7 +340,11 @@ func TestLabelDoorFloor(t *testing.T) { |
| fx, token, reg, created := labelWorld(t, "code-ld-floor-console", "pi-1", "pi-2") |
| servingEvidence(t, fx, reg, created, "pi-1") |
| fx.srv.consoleBuild = release.StatelessReplicasFloor |
| - wantRefused(t, fx, labelPost(t, fx, token, "pi-1", false), "floor") |
| + a := labelPost(t, fx, token, "pi-1", false) |
| + wantRefused(t, fx, a, "floor") |
| + if a.FloorBox != "console" || a.FloorRelease != release.StatelessReplicasFloor || a.Floor != release.FleetRecordLabelFloor { |
| + t.Fatalf("answer %+v; want floor_box console at %s, floor %s", a, release.StatelessReplicasFloor, release.FleetRecordLabelFloor) |
| + } |
| }) |
| } |