Why: parallel groups dropped a hold, HITL timeouts were unused, the planner failed closed on any model error, and event sequence numbers restarted at 1. Evidence: GOWORK=off go test -count=1 -race ./squad/ ./squadintent/ ./store/ ./platform/ passed, including TestR2ExpiredDecisionUsesCancel, TestR2IntentStepSkipsRoleRegistry, TestR2PlannerFallsBackAndCapsSteps, TestR2TaskFileUsesLatestBlackboard, TestR2FanoutCancelDoesNotPanic, TestR2EventSeqContinuesAfterRestart, TestR2JournalModeWAL, and TestR2GateReloadSeesNewIntent. Impact: a failed or held parallel sibling cancels the rest; expired requests synthesize cancel or fail; the intent gate follows Registry.Reload. Refs: Q6, Q10, Q11, Q12, Q13, Q17, Q18, Q19, I9 Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
648 B
Go
28 lines
648 B
Go
package store
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"agent-squad/squad"
|
|
)
|
|
|
|
func TestR2EventSeqContinuesAfterRestart(t *testing.T) {
|
|
dir := t.TempDir()
|
|
run := "run_1"
|
|
path := filepath.Join(dir, "runs", run)
|
|
if err := os.MkdirAll(path, 0o755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := os.WriteFile(filepath.Join(path, "events.jsonl"), []byte("{\"seq\":7,\"type\":\"phase\"}\n"), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
sink := NewFileEventSink(dir, nil)
|
|
sink.Emit(squad.Event{Type: "phase", RunID: run, Text: "next"})
|
|
sink.Close()
|
|
if got := lastEventSeq(filepath.Join(path, "events.jsonl")); got != 8 {
|
|
t.Fatalf("seq %d", got)
|
|
}
|
|
}
|