fix: increase respawn idle timeout to 10s and use consistently

- Change default idleTimeoutMs from 5s to 10s
- Use configured idle timeout for all step completion checks
- Ensures each step (update, /clear, /init) waits properly until idle

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-19 12:24:50 +01:00
co-authored by Claude Opus 4.5
parent cebc7cfe25
commit 30142d046f
+6 -6
View File
@@ -52,7 +52,7 @@ export interface RespawnEvents {
}
const DEFAULT_CONFIG: RespawnConfig = {
idleTimeoutMs: 5000, // 5 seconds of no activity after prompt
idleTimeoutMs: 10000, // 10 seconds of no activity after prompt
updatePrompt: 'update all the docs and CLAUDE.md',
interStepDelayMs: 1000, // 1 second between steps
enabled: true,
@@ -316,7 +316,7 @@ export class RespawnController extends EventEmitter {
private checkUpdateComplete(data: string): void {
// Update is complete when we see the prompt again after working
if (this.promptDetected && !this.workingDetected) {
// Wait a bit more to make sure it's truly done
// Wait to make sure it's truly done (use configured idle timeout)
this.clearIdleTimer();
this.idleTimer = setTimeout(() => {
if (this.promptDetected && !this.workingDetected) {
@@ -331,7 +331,7 @@ export class RespawnController extends EventEmitter {
this.completeCycle();
}
}
}, 3000); // 3 second verification
}, this.config.idleTimeoutMs); // Use configured idle timeout
}
}
@@ -349,7 +349,7 @@ export class RespawnController extends EventEmitter {
}
private checkClearComplete(data: string): void {
// Clear is fast, just wait for prompt
// Clear is fast, but wait for prompt and verify idle
if (this.CLEAR_COMPLETE_PATTERN.test(data) || this.promptDetected) {
this.clearIdleTimer();
this.idleTimer = setTimeout(() => {
@@ -361,7 +361,7 @@ export class RespawnController extends EventEmitter {
} else {
this.completeCycle();
}
}, 1000); // 1 second for clear
}, this.config.idleTimeoutMs); // Use configured idle timeout
}
}
@@ -389,7 +389,7 @@ export class RespawnController extends EventEmitter {
this.emit('stepCompleted', 'init');
this.completeCycle();
}
}, 3000); // 3 second verification for init
}, this.config.idleTimeoutMs); // Use configured idle timeout
}
}