Extract timing constants to constants package (gt-795e8)
Added 6 timing constants: - ShutdownNotifyDelay (500ms) - ClaudeStartTimeout (15s) - ShellReadyTimeout (5s) - DefaultDebounceMs (100) - DefaultDisplayMs (5000) - PollInterval (100ms) Updated 7 files to use these constants instead of magic numbers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -459,7 +459,7 @@ func runGracefulShutdown(t *tmux.Tmux, gtSessions []string, townRoot string) err
|
||||
shutdownMsg := "[SHUTDOWN] Gas Town is shutting down. Please save your state and update your handoff bead, then type /exit or wait to be terminated."
|
||||
for _, sess := range gtSessions {
|
||||
// Small delay then send the message
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
time.Sleep(constants.ShutdownNotifyDelay)
|
||||
_ = t.SendKeys(sess, shutdownMsg) // best-effort notification
|
||||
}
|
||||
|
||||
@@ -748,10 +748,10 @@ func runStartCrew(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
// Wait for Claude to start, then prime
|
||||
shells := constants.SupportedShells
|
||||
if err := t.WaitForCommand(sessionID, shells, 15*time.Second); err != nil {
|
||||
if err := t.WaitForCommand(sessionID, shells, constants.ClaudeStartTimeout); err != nil {
|
||||
style.PrintWarning("Timeout waiting for Claude to start: %v", err)
|
||||
}
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
time.Sleep(constants.ShutdownNotifyDelay)
|
||||
if err := t.SendKeys(sessionID, "gt prime"); err != nil {
|
||||
style.PrintWarning("Could not send prime command: %v", err)
|
||||
}
|
||||
@@ -779,7 +779,7 @@ func runStartCrew(cmd *cobra.Command, args []string) error {
|
||||
_ = t.ConfigureGasTownSession(sessionID, theme, rigName, name, "crew")
|
||||
|
||||
// Wait for shell to be ready after session creation
|
||||
if err := t.WaitForShellReady(sessionID, 5*time.Second); err != nil {
|
||||
if err := t.WaitForShellReady(sessionID, constants.ShellReadyTimeout); err != nil {
|
||||
return fmt.Errorf("waiting for shell: %w", err)
|
||||
}
|
||||
|
||||
@@ -790,12 +790,12 @@ func runStartCrew(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// Wait for Claude to start
|
||||
shells := constants.SupportedShells
|
||||
if err := t.WaitForCommand(sessionID, shells, 15*time.Second); err != nil {
|
||||
if err := t.WaitForCommand(sessionID, shells, constants.ClaudeStartTimeout); err != nil {
|
||||
style.PrintWarning("Timeout waiting for Claude to start: %v", err)
|
||||
}
|
||||
|
||||
// Give Claude time to initialize after process starts
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
time.Sleep(constants.ShutdownNotifyDelay)
|
||||
|
||||
// Send gt prime to initialize context
|
||||
if err := t.SendKeys(sessionID, "gt prime"); err != nil {
|
||||
@@ -913,7 +913,7 @@ func startCrewMember(rigName, crewName, townRoot string) error {
|
||||
_ = t.SetCrewCycleBindings(sessionID)
|
||||
|
||||
// Wait for shell to be ready
|
||||
if err := t.WaitForShellReady(sessionID, 5*time.Second); err != nil {
|
||||
if err := t.WaitForShellReady(sessionID, constants.ShellReadyTimeout); err != nil {
|
||||
return fmt.Errorf("waiting for shell: %w", err)
|
||||
}
|
||||
|
||||
@@ -924,12 +924,12 @@ func startCrewMember(rigName, crewName, townRoot string) error {
|
||||
|
||||
// Wait for Claude to start
|
||||
shells := constants.SupportedShells
|
||||
if err := t.WaitForCommand(sessionID, shells, 15*time.Second); err != nil {
|
||||
if err := t.WaitForCommand(sessionID, shells, constants.ClaudeStartTimeout); err != nil {
|
||||
// Non-fatal: Claude might still be starting
|
||||
}
|
||||
|
||||
// Give Claude time to initialize
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
time.Sleep(constants.ShutdownNotifyDelay)
|
||||
|
||||
// Send gt prime to initialize context (non-fatal: session works without priming)
|
||||
_ = t.SendKeys(sessionID, "gt prime")
|
||||
|
||||
Reference in New Issue
Block a user