carlos / platform Public

region HA: cold-wake placement works in the home region

P1b-3a's wakeSnapshot refused an empty own placement, so placement was
never usable on home-region boxes (CARLOS_REGION unset), where every
born-HA host lives. Setting CARLOS_REGION to work around it would
unscope every home record from the box. An empty placement is now the
home placement scope, matched exactly against peers like any other.
Region, data bucket, secrets key, capability and freshness still
decline toward Base when missing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 5602ac3e06b9b8a08122d1716cb4e9bf34e8d7f9 parent 1a9c752
2 files changed, +34 −3
  • internal/edge/wakeplacement.go +4 −2
  • internal/edge/wakeplacement_test.go +30 −1

Intent

Human

<paseo-system version="1" kind="agent-message" source-agent-id="0f39318c-0ba2-460c-9717-b97d0d681e91" message-id="8c116e64-9207-4472-9701-63dc37a5272d"> From platform-6e: the dev console box sophie (i-05498eada6f0afd23, kass) is unreachable since about 06:41Z. TLS to platform.dev.carlosframework.com times out, and SSM commands sit Pending. The serial console shows the kernel OOM-killed carlos-edge&apos;s supervise process, which held 452 MB RSS plus about 370 MB swap on a 1 GB t4g.micro. CPU climbed from 06:21Z. There are two stuck SSM commands at 06:46:21Z and 06:46:43Z (&apos;classic-inspect&apos;), which aren&apos;t mine. Is this yours, and is anyone already on it? I&apos;m not restarting anything. Reply to platform-6e (paseo send 0f39318c). </paseo-system>

diff --git a/internal/edge/wakeplacement.go b/internal/edge/wakeplacement.go
index 01f98883b..bccaab728 100644
--- a/internal/edge/wakeplacement.go
+++ b/internal/edge/wakeplacement.go
@@ -129,8 +129,10 @@ func (m *homeMap) wakeSnapshot(rt registry.Route, now time.Time) boxchoice.WakeS
p := decodeWakePlacement(own)
out.LocalDenied = p.localDenied
out.Region = own.Region
- // A non-empty own placement is deliberate: missing identity declines toward Base.
- if own.Region == "" || own.Placement == "" || own.DataBucket == "" || own.SecretsKeyFP == "" || !p.compatible(now) {
+ // Missing identity declines toward Base. An empty placement is not missing
+ // identity: it is the home region's placement scope (CARLOS_REGION unset,
+ // published by omission), and peers must still match it exactly below.
+ if own.Region == "" || own.DataBucket == "" || own.SecretsKeyFP == "" || !p.compatible(now) {
return out
}
out.Usable = true
diff --git a/internal/edge/wakeplacement_test.go b/internal/edge/wakeplacement_test.go
index d1f2bd90a..498c247c8 100644
--- a/internal/edge/wakeplacement_test.go
+++ b/internal/edge/wakeplacement_test.go
@@ -91,7 +91,7 @@ func TestWakeSnapshotCompatibility(t *testing.T) {
})
}
wantWakeRefs(t, wakeMap(t, wakeFile("self"), wakeFile("peer")), "peer", "self")
- for _, field := range []string{"data_bucket", "secrets_key_fp", "region", "placement", "generation", "capabilities", "hibernation_configured"} {
+ for _, field := range []string{"data_bucket", "secrets_key_fp", "region", "generation", "capabilities", "hibernation_configured"} {
t.Run("own-missing-"+field, func(t *testing.T) {
own := wakeFile("self")
delete(own, field)
@@ -114,6 +114,35 @@ func TestWakeSnapshotCompatibility(t *testing.T) {
}
}
+// TestWakeSnapshotHomePlacement pins the home region: its boxes run with
+// CARLOS_REGION unset, so their files omit "placement". That is a placement
+// scope of its own, matched exactly, not missing identity.
+func TestWakeSnapshotHomePlacement(t *testing.T) {
+ home := func(ref string) map[string]any {
+ f := wakeFile(ref)
+ delete(f, "placement")
+ return f
+ }
+ explicitEmpty := home("peer")
+ explicitEmpty["placement"] = ""
+ wantWakeRefs(t, wakeMap(t, home("self"), home("peer")), "peer", "self")
+ wantWakeRefs(t, wakeMap(t, home("self"), explicitEmpty), "peer", "self")
+ // A placed box and a home box are different scopes, in both directions.
+ wantWakeRefs(t, wakeMap(t, home("self"), wakeFile("peer")), "self")
+ placedSelf := wakeMap(t, wakeFile("self"), home("peer"))
+ if s := placedSelf.wakeSnapshot(wakeRoute, wakeNow); !s.Usable || !reflect.DeepEqual(wakeRefs(s), []string{"self"}) {
+ t.Fatalf("placed self took a home peer: %+v", s)
+ }
+ // Everything else still declines toward Base for a home box.
+ for _, field := range []string{"data_bucket", "secrets_key_fp", "region", "capabilities"} {
+ own := home("self")
+ delete(own, field)
+ if s := wakeMap(t, own, home("peer")).wakeSnapshot(wakeRoute, wakeNow); s.Usable {
+ t.Fatalf("home box missing %s usable: %+v", field, s)
+ }
+ }
+}
+
func TestWakeSnapshotRequiresSigningKey(t *testing.T) {
for _, key := range [][]byte{nil, {}, []byte("cached-key")} {
m := wakeMap(t, wakeFile("self"), wakeFile("peer"))