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.
|
// getManager returns the address of our lifecycle manager.
|
||||||
|
// For polecats and refineries, it detects the rig from context.
|
||||||
func getManager(role Role) string {
|
func getManager(role Role) string {
|
||||||
switch role {
|
switch role {
|
||||||
case RoleMayor, RoleWitness:
|
case RoleMayor, RoleWitness:
|
||||||
return "deacon/"
|
return "deacon/"
|
||||||
case RolePolecat, RoleRefinery:
|
case RolePolecat, RoleRefinery:
|
||||||
// Would need rig context to determine witness address
|
// Detect rig from current directory context
|
||||||
// For now, use a placeholder pattern
|
rig := detectRigFromContext()
|
||||||
return "<rig>/witness"
|
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:
|
case RoleCrew:
|
||||||
return "human" // Crew is human-managed
|
return "human" // Crew is human-managed
|
||||||
default:
|
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.
|
// sendHandoffMail updates the pinned handoff bead for the successor to read.
|
||||||
func sendHandoffMail(role Role, townRoot string) error {
|
func sendHandoffMail(role Role, townRoot string) error {
|
||||||
// Build handoff content
|
// Build handoff content
|
||||||
|
|||||||
Reference in New Issue
Block a user