fix: Add startup delay before nudging newly spawned polecats (gt-1dbcp)
Claude needs ~2 seconds to initialize before it can process nudges. Without this delay, the initial "Work slung" message would arrive before Claude was ready, causing the SessionStart hook not to fire. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/gastown/internal/beads"
|
||||
@@ -13,6 +14,10 @@ import (
|
||||
"github.com/steveyegge/gastown/internal/tmux"
|
||||
)
|
||||
|
||||
// claudeStartupDelay is how long to wait for Claude to start before nudging.
|
||||
// This fixes gt-1dbcp: polecat auto-start doesn't process initial nudge.
|
||||
const claudeStartupDelay = 2 * time.Second
|
||||
|
||||
var slingCmd = &cobra.Command{
|
||||
Use: "sling <bead-or-formula> [target]",
|
||||
GroupID: GroupWork,
|
||||
@@ -176,6 +181,12 @@ func runSling(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
targetAgent = spawnInfo.AgentID()
|
||||
targetPane = spawnInfo.Pane
|
||||
|
||||
// Wait for Claude to start up before nudging (fixes gt-1dbcp)
|
||||
if targetPane != "" {
|
||||
fmt.Printf("Waiting for Claude to initialize...\n")
|
||||
time.Sleep(claudeStartupDelay)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Slinging to an existing agent
|
||||
@@ -531,6 +542,12 @@ func runSlingFormula(args []string) error {
|
||||
}
|
||||
targetAgent = spawnInfo.AgentID()
|
||||
targetPane = spawnInfo.Pane
|
||||
|
||||
// Wait for Claude to start up before nudging (fixes gt-1dbcp)
|
||||
if targetPane != "" {
|
||||
fmt.Printf("Waiting for Claude to initialize...\n")
|
||||
time.Sleep(claudeStartupDelay)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Slinging to an existing agent
|
||||
|
||||
Reference in New Issue
Block a user