feat(patrol): add backoff test formula and fix await-signal

Add mol-backoff-test formula for integration testing exponential backoff
with short intervals (2s base, 10s max) to observe multiple cycles quickly.

Fix await-signal to use --since 1s when subscribing to activity feed.
Without this, historical events would immediately wake the signal,
preventing proper timeout and backoff behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/jack
2026-01-17 04:45:24 -08:00
committed by Steve Yegge
parent 576e73a924
commit 3f724336f4
3 changed files with 194 additions and 2 deletions

View File

@@ -237,8 +237,10 @@ func calculateEffectiveTimeout(idleCycles int) (time.Duration, error) {
// waitForActivitySignal starts bd activity --follow and waits for any output.
// Returns immediately when a line is received, or when context is canceled.
func waitForActivitySignal(ctx context.Context, workDir string) (*AwaitSignalResult, error) {
// Start bd activity --follow
cmd := exec.CommandContext(ctx, "bd", "activity", "--follow")
// Start bd activity --follow --since 1s
// The --since flag ensures we only wait for NEW events, not historical ones.
// Without this, the feed would immediately return old activity and never timeout.
cmd := exec.CommandContext(ctx, "bd", "activity", "--follow", "--since", "1s")
cmd.Dir = workDir
stdout, err := cmd.StdoutPipe()