Files
gastown/internal/session/names_test.go
aleiby 31bd120077 fix(startup): unify agent startup with beacon + instructions in CLI prompt (#977)
All agents now receive their startup beacon + role-specific instructions via
the CLI prompt, making sessions identifiable in /resume picker while removing
unreliable post-startup nudges.

Changes:
- Rename FormatStartupNudge → FormatStartupBeacon, StartupNudgeConfig → BeaconConfig
- Remove StartupNudge() function (no longer needed)
- Remove PropulsionNudge() and PropulsionNudgeForRole() functions
- Update deacon, witness, refinery, polecat managers to include beacon in CLI prompt
- Update boot to inline beacon (can't import session due to import cycle)
- Update daemon/lifecycle.go to include beacon via BuildCommandWithPrompt
- Update cmd/deacon.go to include beacon in startup command
- Remove redundant StartupNudge and PropulsionNudge calls from all startup paths

The beacon is now part of the CLI prompt which is queued before Claude starts,
making it more reliable than post-startup nudges which had timing issues.
SessionStart hook runs gt prime automatically, so PropulsionNudge was redundant.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:08:57 -08:00

109 lines
2.4 KiB
Go

package session
import (
"testing"
)
func TestMayorSessionName(t *testing.T) {
// Mayor session name is now fixed (one per machine), uses HQ prefix
want := "hq-mayor"
got := MayorSessionName()
if got != want {
t.Errorf("MayorSessionName() = %q, want %q", got, want)
}
}
func TestDeaconSessionName(t *testing.T) {
// Deacon session name is now fixed (one per machine), uses HQ prefix
want := "hq-deacon"
got := DeaconSessionName()
if got != want {
t.Errorf("DeaconSessionName() = %q, want %q", got, want)
}
}
func TestWitnessSessionName(t *testing.T) {
tests := []struct {
rig string
want string
}{
{"gastown", "gt-gastown-witness"},
{"beads", "gt-beads-witness"},
{"foo", "gt-foo-witness"},
}
for _, tt := range tests {
t.Run(tt.rig, func(t *testing.T) {
got := WitnessSessionName(tt.rig)
if got != tt.want {
t.Errorf("WitnessSessionName(%q) = %q, want %q", tt.rig, got, tt.want)
}
})
}
}
func TestRefinerySessionName(t *testing.T) {
tests := []struct {
rig string
want string
}{
{"gastown", "gt-gastown-refinery"},
{"beads", "gt-beads-refinery"},
{"foo", "gt-foo-refinery"},
}
for _, tt := range tests {
t.Run(tt.rig, func(t *testing.T) {
got := RefinerySessionName(tt.rig)
if got != tt.want {
t.Errorf("RefinerySessionName(%q) = %q, want %q", tt.rig, got, tt.want)
}
})
}
}
func TestCrewSessionName(t *testing.T) {
tests := []struct {
rig string
name string
want string
}{
{"gastown", "max", "gt-gastown-crew-max"},
{"beads", "alice", "gt-beads-crew-alice"},
{"foo", "bar", "gt-foo-crew-bar"},
}
for _, tt := range tests {
t.Run(tt.rig+"/"+tt.name, func(t *testing.T) {
got := CrewSessionName(tt.rig, tt.name)
if got != tt.want {
t.Errorf("CrewSessionName(%q, %q) = %q, want %q", tt.rig, tt.name, got, tt.want)
}
})
}
}
func TestPolecatSessionName(t *testing.T) {
tests := []struct {
rig string
name string
want string
}{
{"gastown", "Toast", "gt-gastown-Toast"},
{"gastown", "Furiosa", "gt-gastown-Furiosa"},
{"beads", "worker1", "gt-beads-worker1"},
}
for _, tt := range tests {
t.Run(tt.rig+"/"+tt.name, func(t *testing.T) {
got := PolecatSessionName(tt.rig, tt.name)
if got != tt.want {
t.Errorf("PolecatSessionName(%q, %q) = %q, want %q", tt.rig, tt.name, got, tt.want)
}
})
}
}
func TestPrefix(t *testing.T) {
want := "gt-"
if Prefix != want {
t.Errorf("Prefix = %q, want %q", Prefix, want)
}
}