fix(tmux): add debounce delay between paste and Enter
Fixes race condition where Enter key arrives before paste is fully processed, causing workers to sit idle at prompts. - SendKeys now uses 100ms default debounce - New SendKeysDebounced allows configurable delay - Inject scales delay 100-500ms based on message size Closes: gt-w3bu 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -228,6 +228,7 @@ func (m *Manager) Capture(polecat string, lines int) (string, error) {
|
||||
}
|
||||
|
||||
// Inject sends a message to a polecat session.
|
||||
// Uses a longer debounce delay for large messages to ensure paste completes.
|
||||
func (m *Manager) Inject(polecat, message string) error {
|
||||
sessionID := m.sessionName(polecat)
|
||||
|
||||
@@ -239,7 +240,14 @@ func (m *Manager) Inject(polecat, message string) error {
|
||||
return ErrSessionNotFound
|
||||
}
|
||||
|
||||
return m.tmux.SendKeys(sessionID, message)
|
||||
// Use longer debounce for large messages (spawn context can be 1KB+)
|
||||
// Scale delay based on message size: 100ms base + 50ms per KB
|
||||
debounceMs := 100 + (len(message)/1024)*50
|
||||
if debounceMs > 500 {
|
||||
debounceMs = 500 // Cap at 500ms
|
||||
}
|
||||
|
||||
return m.tmux.SendKeysDebounced(sessionID, message, debounceMs)
|
||||
}
|
||||
|
||||
// StopAll terminates all sessions for this rig.
|
||||
|
||||
Reference in New Issue
Block a user