fix(pods): heal pods by image ID, not tag, so rebuilt images roll out (#186)

setup.sh rebuilds the pod image under the same tag (localhost/agentbbs-pod:latest).
hasImage compared only the tag, so every existing pod looked current and kept the
old image forever: the "Use c0mpute network" launcher (#183) and any Claude Code
or Codex updates never reached existing members. Now an idle pod whose image ID
differs from the tag's current ID is recreated (home volume kept). Unknown IDs
still never trigger a heal.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-11-30 04:02:09 -08:00 • committed by GitHub
parent 82bc5ba4fc
commit 3f2c8047e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 47 additions and 5 deletions

View file

@ -35,3 +35,21 @@ func TestPublicHTMLMountCreatesAndMaps(t *testing.T) {
t.Fatalf("expected %q to be a created directory, err=%v", wantHost, err)
}
}
func TestSameImage(t *testing.T) {
cases := []struct {
gotName, gotID, wantName, wantID string
want bool
}{
{"localhost/agentbbs-pod:latest", "62a86171b60a", "localhost/agentbbs-pod:latest", "dc18f4df01f5", false}, // rebuilt under the same tag
{"localhost/agentbbs-pod:latest", "dc18f4df01f5", "agentbbs-pod:latest", "sha256:dc18f4df01f5", true},
{"docker.io/library/ubuntu:24.04", "abc", "localhost/agentbbs-pod:latest", "abc", false}, // different image
{"localhost/agentbbs-pod:latest", "", "localhost/agentbbs-pod:latest", "dc18", true}, // unknown id: no heal
{"localhost/agentbbs-pod:latest", "dc18", "localhost/agentbbs-pod:latest", "", true},
}
for _, c := range cases {
if got := sameImage(c.gotName, c.gotID, c.wantName, c.wantID); got != c.want {
t.Errorf("sameImage(%q,%q,%q,%q) = %v, want %v", c.gotName, c.gotID, c.wantName, c.wantID, got, c.want)
}
}
}