fix(handoff): Use actual rig name in lifecycle messages (gt-6vks)
The getManager() function was returning a literal "<rig>/witness" string for polecats and refineries instead of substituting the actual rig name. This caused LIFECYCLE messages to be sent to "@<rig>/witness" instead of proper addresses like "@gastown/witness". Fix: - Add detectRigFromContext() to extract rig from current directory - Update getManager() to use detected rig name - Fallback to deacon/ if rig detection fails (safety) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -222,14 +222,20 @@ func preFlightChecks() error {
|
||||
}
|
||||
|
||||
// getManager returns the address of our lifecycle manager.
|
||||
// For polecats and refineries, it detects the rig from context.
|
||||
func getManager(role Role) string {
|
||||
switch role {
|
||||
case RoleMayor, RoleWitness:
|
||||
return "deacon/"
|
||||
case RolePolecat, RoleRefinery:
|
||||
// Would need rig context to determine witness address
|
||||
// For now, use a placeholder pattern
|
||||
return "<rig>/witness"
|
||||
// Detect rig from current directory context
|
||||
rig := detectRigFromContext()
|
||||
if rig == "" {
|
||||
// Fallback if rig detection fails - this shouldn't happen
|
||||
// in normal operation but is better than a literal placeholder
|
||||
return "deacon/"
|
||||
}
|
||||
return rig + "/witness"
|
||||
case RoleCrew:
|
||||
return "human" // Crew is human-managed
|
||||
default:
|
||||
@@ -237,6 +243,22 @@ func getManager(role Role) string {
|
||||
}
|
||||
}
|
||||
|
||||
// detectRigFromContext determines the rig name from the current directory.
|
||||
func detectRigFromContext() string {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
townRoot, err := workspace.FindFromCwd()
|
||||
if err != nil || townRoot == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
ctx := detectRole(cwd, townRoot)
|
||||
return ctx.Rig
|
||||
}
|
||||
|
||||
// sendHandoffMail updates the pinned handoff bead for the successor to read.
|
||||
func sendHandoffMail(role Role, townRoot string) error {
|
||||
// Build handoff content
|
||||
|
||||
Reference in New Issue
Block a user