Fix: /handoff regression - use respawn-pane with direct claude command

Three related fixes:

1. lifecycle.go: Use gt mail delete instead of gt mail read to prevent
   lifecycle requests from accumulating.

2. handoff.go: Return exec claude command for respawn-pane instead of
   gt crew at which tries to attach to existing session.

3. handoff.md skill: Work without --cycle and -m flags, send mail separately.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-23 00:23:18 -08:00
parent 441bafe7a8
commit a5a37f5d63
3 changed files with 26 additions and 17 deletions

View File

@@ -152,27 +152,28 @@ func resolveRoleToSession(role string) (string, error) {
}
}
// buildRestartCommand creates the gt command to restart a session.
// buildRestartCommand creates the command to run when respawning a session's pane.
// This needs to be the actual command to execute (e.g., claude), not a session attach command.
func buildRestartCommand(sessionName string) (string, error) {
// For respawn-pane, we run claude directly. The SessionStart hook will run gt prime.
// Use exec to ensure clean process replacement.
claudeCmd := "exec claude --dangerously-skip-permissions"
switch {
case sessionName == "gt-mayor":
return "gt may at", nil
return claudeCmd, nil
case sessionName == "gt-deacon":
return "gt dea at", nil
return claudeCmd, nil
case strings.Contains(sessionName, "-crew-"):
// gt-<rig>-crew-<name>
// The attach command can auto-detect from cwd, so just use `gt crew at`
return "gt crew at", nil
return claudeCmd, nil
case strings.HasSuffix(sessionName, "-witness"):
// gt-<rig>-witness
return "gt wit at", nil
return claudeCmd, nil
case strings.HasSuffix(sessionName, "-refinery"):
// gt-<rig>-refinery
return "gt ref at", nil
return claudeCmd, nil
default:
return "", fmt.Errorf("unknown session type: %s (try specifying role explicitly)", sessionName)