carlos / platform Public

group close-lost: say when the member's edges record is published

close-lost now lists control/edges/ once after its group and EC2
checks (journaled; a failed listing refuses and leaves the transaction
open). If the lost member's record is still listed it records
edges_published and names the record. It never deletes it: the boxes'
termination recovery owns retirement (agreed with 8a3d302). Spec V20.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev dd18ce53e964f676eeceeb75b95606790b3e4318 parent 6d2ae9f
6 files changed, +111 −11
  • docs/superpowers/specs/2026-11-09-group-roll-verb-design.md +1 −0
  • internal/grouproll/probe_test.go +3 −3
  • internal/grouproll/roll.go +41 −2
  • internal/grouproll/roll_test.go +62 −3
  • internal/grouproll/text.go +1 −0
  • internal/grouproll/text_test.go +3 −3

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
index 78ea8b7fe..649057ab9 100644
--- a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
+++ b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
@@ -380,6 +380,7 @@ build to it.
| V17 | Every provider call is made once (`--cli-read-timeout`, retries 1) | Reads (the describes, caller identity, HeadBucket, S3 GET and list) are retried while AWS throttles them: four calls at most, about 1, 2 and 4 s apart, jittered; any other failure and the last throttle fail closed as before. Writes and box sessions are never retried. Bare `carlos system group`, its -h and an unknown verb print the group's help | Step-3 dev W4 2026-11-10: the group describe refused under ASG throttling (8a3d302) |
| V18 | A request that gets no response is one failed call | A read whose request got no response at all (the SDK's RequestSendError: a reset or EOF on a reused connection, no call in CloudTrail) is retried as a throttle is (V17's budget); a timeout is not, and stays one bound. A failure to get credentials (AssumeRole, SSO), throttled or unanswered, is never retried, so no credential call repeats. Writes and sessions are never retried | G5 release 1, dev, 2026-11-11: the post-prepare group describe failed in 14 ms with no CloudTrail call; resume closed it (8a3d302) |
| V19 | The provider observation names one launch template version; any other pinned version refuses `observation` | The observation carries across a re-pin that changes only user data (§7.1). A launch template version other than the observation's, with the same template id and name, is accepted when the two versions' launch template data are identical once UserData is removed; anything else refuses `observation` as before | G5 release 1, 2026-11-11: every release's re-pin left the next roll needing a pin-back (Paul approved option b, 11-11) |
+| V20 | close-lost reads the group and EC2 only | After the group and EC2 checks, close-lost lists `control/edges/` once (journaled, like the floor's listing; a failure refuses and leaves the transaction open). If the member's edges record is still listed it records `edges_published: true` and says so, naming the record. It never deletes it: the boxes' termination recovery retires it once every host naming the member is settled, and a drain does not wait for a member whose departure the box has enrolled | #1192, dev IE 2026-11-17: a member closed with close-lost kept its edges record (its departure was held by a trashed app's host) and the next drain failed waiting on it (8a3d302: report, never delete) |
Not deviations, recorded so nobody "fixes" them in the port: the drain-rerun
backoff and the TakeHost `wake_timeout` follow-ups from the held build stay
diff --git a/internal/grouproll/probe_test.go b/internal/grouproll/probe_test.go
index 3ca950383..724dd691b 100644
--- a/internal/grouproll/probe_test.go
+++ b/internal/grouproll/probe_test.go
@@ -441,16 +441,16 @@ func TestProbeCloseLost(t *testing.T) {
checkClosed := func(t *testing.T, h *harness, tx string) {
t.Helper()
must(t, closeLost(h, tx))
- if h.activeTx() != "" || !reflect.DeepEqual(h.f.ops(), []string{"group", "ec2_instance"}) {
+ if h.activeTx() != "" || !reflect.DeepEqual(h.f.ops(), []string{"group", "ec2_instance", "edges_list"}) {
t.Fatalf("calls %v", h.f.ops())
}
j := h.txJournal(tx)
rows := j.Rows()
var kinds []string
- for _, r := range rows[len(rows)-6:] {
+ for _, r := range rows[len(rows)-8:] {
kinds = append(kinds, r["kind"].(string))
}
- if !reflect.DeepEqual(kinds, []string{"intent", "response", "intent", "response", "lost-member-closed", "done"}) {
+ if !reflect.DeepEqual(kinds, []string{"intent", "response", "intent", "response", "intent", "response", "lost-member-closed", "done"}) {
t.Fatalf("rows %v", kinds)
}
closed, _ := j.Last("lost-member-closed", nil)
diff --git a/internal/grouproll/roll.go b/internal/grouproll/roll.go
index edcf5afe0..388bef1b5 100644
--- a/internal/grouproll/roll.go
+++ b/internal/grouproll/roll.go
@@ -1586,8 +1586,18 @@ func (e *Engine) closeLost(ctx context.Context) error {
if evidence.IID != iid || (evidence.State != "terminated" && evidence.State != "not-found") {
return refuse("close_lost_refused")
}
- if _, err := e.event("lost-member-closed", map[string]any{"iid": iid, "group": groupMap(g),
- "describe": instanceMap(evidence), "attended_by": e.attended}); err != nil {
+ // #1192 (V20): the member's edges record is retired by the boxes'
+ // termination recovery, never by this verb. Say whether it is still
+ // published, so the operator knows that recovery still owes it.
+ ref, published, err := e.lostEdgesPublished(ctx)
+ if err != nil {
+ return err
+ }
+ closed := map[string]any{"iid": iid, "group": groupMap(g), "describe": instanceMap(evidence), "attended_by": e.attended}
+ if ref != "" {
+ closed["edges_published"] = published
+ }
+ if _, err := e.event("lost-member-closed", closed); err != nil {
return err
}
if _, err := e.event("done", map[string]any{"outcome": "failed-member-lost"}); err != nil {
@@ -1597,8 +1607,37 @@ func (e *Engine) closeLost(ctx context.Context) error {
return err
}
e.say("close-lost", Text("lost_closed"))
+ if published {
+ e.say("close-lost", Text("lost_edges_published", "key", "control/edges/"+ref+".json"))
+ }
if _, err := os.Lstat(e.s.DivergencePath()); err == nil {
e.say("close-lost", Text("divergence_retained", "path", e.s.DivergencePath()))
}
return nil
}
+
+// lostEdgesPublished is close-lost's one read of control/edges/ (#1192,
+// V20): ref is the member's box reference from the validated row ("" when
+// the transaction never validated one, and then nothing is read), and
+// published whether its edges record is still listed.
+func (e *Engine) lostEdgesPublished(ctx context.Context) (string, bool, error) {
+ valid, ok := e.last("validated", nil)
+ if !ok {
+ return "", false, nil
+ }
+ identity, _ := valid["identity"].(map[string]any)
+ ref, _ := identity["box_ref"].(string)
+ if !EdgesKey.MatchString("control/edges/" + ref + ".json") {
+ return "", false, nil
+ }
+ keys, err := e.edgesList(ctx)
+ if err != nil {
+ return "", false, err
+ }
+ for _, k := range keys {
+ if m := EdgesKey.FindStringSubmatch(k); m != nil && m[1] == ref {
+ return ref, true, nil
+ }
+ }
+ return ref, false, nil
+}
diff --git a/internal/grouproll/roll_test.go b/internal/grouproll/roll_test.go
index 4200caf89..1b2c05814 100644
--- a/internal/grouproll/roll_test.go
+++ b/internal/grouproll/roll_test.go
@@ -1930,16 +1930,16 @@ func (h *harness) checkClosed(t *testing.T, tx string) {
if err := h.closeLost(tx); err != nil {
t.Fatal(err)
}
- if h.activeTx() != "" || !reflect.DeepEqual(h.f.ops(), []string{"group", "ec2_instance"}) {
+ if h.activeTx() != "" || !reflect.DeepEqual(h.f.ops(), []string{"group", "ec2_instance", "edges_list"}) {
t.Fatalf("calls %v", h.f.ops())
}
j := h.txJournal(tx)
rows := j.Rows()
var kinds []string
- for _, r := range rows[len(rows)-6:] {
+ for _, r := range rows[len(rows)-8:] {
kinds = append(kinds, r["kind"].(string))
}
- if !reflect.DeepEqual(kinds, []string{"intent", "response", "intent", "response", "lost-member-closed", "done"}) {
+ if !reflect.DeepEqual(kinds, []string{"intent", "response", "intent", "response", "intent", "response", "lost-member-closed", "done"}) {
t.Fatalf("rows %v", kinds)
}
closed, _ := j.Last("lost-member-closed", nil)
@@ -1961,6 +1961,65 @@ func (h *harness) checkClosed(t *testing.T, tx string) {
if !strings.Contains(h.out.String(), Text("lost_closed")) {
t.Fatal("not said")
}
+ // #1192 (V20): the lost member's edges record is still listed here, and
+ // close-lost says so, naming it, without touching it.
+ ref := h.f.boxes[fakeIID]["box_ref"].(string)
+ if closed["edges_published"] != true || !strings.Contains(h.out.String(), Text("lost_edges_published", "key", "control/edges/"+ref+".json")) {
+ t.Fatalf("edges_published %v; out %s", closed["edges_published"], h.out.String())
+ }
+ if len(h.f.writes) != 0 {
+ t.Fatalf("writes %v", h.f.writes)
+ }
+}
+
+// #1192 (V20): a lost member whose edges record is already retired closes
+// with edges_published false and no line about it; a failed listing
+// refuses and leaves the transaction open, like a failed describe.
+func TestCloseLostEdgesRecord(t *testing.T) {
+ t.Run("retired", func(t *testing.T) {
+ h := newHarness(t, 2)
+ tx := h.seedLost()
+ ref := h.f.boxes[fakeIID]["box_ref"].(string)
+ h.f.intercept = func(op string, _ map[string]any, _ bool, perform func() (any, error)) (any, error) {
+ r, err := perform()
+ if op != "edges_list" || err != nil {
+ return r, err
+ }
+ var keep []string
+ for _, k := range r.([]string) {
+ if k != "control/edges/"+ref+".json" {
+ keep = append(keep, k)
+ }
+ }
+ return keep, nil
+ }
+ must(t, h.closeLost(tx))
+ closed, _ := h.txJournal(tx).Last("lost-member-closed", nil)
+ if closed["edges_published"] != false || strings.Contains(h.out.String(), "edges record") {
+ t.Fatalf("edges_published %v; out %s", closed["edges_published"], h.out.String())
+ }
+ })
+ t.Run("listing fails", func(t *testing.T) {
+ h := newHarness(t, 2)
+ tx := h.seedLost()
+ h.f.before = func(op string, _ map[string]any) error {
+ if op == "edges_list" {
+ return Uncertain{Key: "api"}
+ }
+ return nil
+ }
+ if err := h.closeLost(tx); err == nil {
+ t.Fatal("close-lost closed with an unread edges listing")
+ }
+ if h.activeTx() != tx {
+ t.Fatalf("active %q", h.activeTx())
+ }
+ for _, k := range []string{"lost-member-closed", "done"} {
+ if _, ok := h.txJournal(tx).Last(k, nil); ok {
+ t.Fatalf("%s recorded", k)
+ }
+ }
+ })
}
// test_close_lost_terminated_preserves_flags_and_status.
diff --git a/internal/grouproll/text.go b/internal/grouproll/text.go
index 0164a7842..7181baa52 100644
--- a/internal/grouproll/text.go
+++ b/internal/grouproll/text.go
@@ -26,6 +26,7 @@ var text = map[string]string{
"close-lost": "Close an active transaction after confirming that its member is gone. Record failure.",
"close_lost_refused": "The member must be absent from the exact group and either terminated or absent from EC2.",
"lost_closed": "Transaction closed with outcome failed-member-lost. This does not record recovery.",
+ "lost_edges_published": "The member's edges record {key} is still published. Termination recovery on the remaining boxes retires it; drains do not wait for the member once a box has recorded its departure.",
"divergence_retained": "Provider divergence flag retained: {path}",
"abandoned": "Transaction abandoned before any group write intent.",
"abandon_refused": "A write intent exists. Use resume, rollback or return.",
diff --git a/internal/grouproll/text_test.go b/internal/grouproll/text_test.go
index cab9b7478..ae1f1e883 100644
--- a/internal/grouproll/text_test.go
+++ b/internal/grouproll/text_test.go
@@ -18,9 +18,9 @@ func TestTextRendersEveryKey(t *testing.T) {
// another region than the group, 2026-11-10), and remote_said (the
// member's own refusal, 2026-11-11); bucket_region, remote_said and the
// fixed remove_minimum approved in copy review 2026-11-11 (Paul,
- // unchanged).
- if len(text) != 147 {
- t.Fatalf("text has %d keys, want the 139 approved plus 8", len(text))
+ // unchanged), and lost_edges_published (#1192, 2026-11-17).
+ if len(text) != 148 {
+ t.Fatalf("text has %d keys, want the 139 approved plus 9", len(text))
}
for key, raw := range text {
var args []string