Merge pull request #1692 from entireio/fix-investigate-picker-parallel-flake · Entire

Merge pull request #1692 from entireio/fix-investigate-picker-parallel-flake

21c1aba→main·

Soph·1w ago·1 file·+8 added/-2 removed

investigate: fix flaky picker tests racing on global override

Changes

1

32 unmodified lines

33
34
35
36
37
38
39
40
37
41
42
43
40 unmodified lines

84
85
86
87
88
89
90
91
85
92
93
94

32 unmodified lines

// TestRunInvestigateConfigPicker_FiltersNonInstalled verifies that an
// agent with a spawner but no hooks installed is filtered out.
// Not parallel: installs a process-global picker-form override
// (SetPickerFormFnForTest). Running it in parallel with another override-
// installing test lets one clobber the other's override mid-run — see the
// contract on pickerFormOverride in picker.go.
func TestRunInvestigateConfigPicker_FiltersNonInstalled(t *testing.T) {
    t.Parallel()
    cleanup := investigate.SetPickerFormFnForTest(func(_ context.Context, eligible []investigate.AgentChoice, picks *[]string, maxTurns, quorum *int) error {
        // Capture eligible into picks for assertion via the cfg.Agents.
        names := make([]string, 0, len(eligible))
40 unmodified lines

}
}

// Not parallel: installs a process-global picker-form override
// (SetPickerFormFnForTest), which must not run concurrently with another
// override-installing test — see the contract on pickerFormOverride in
// picker.go.
func TestRunInvestigateConfigPicker_QuorumExceedsAgents(t *testing.T) {
    t.Parallel()
    cleanup := investigate.SetPickerFormFnForTest(func(_ context.Context, eligible []investigate.AgentChoice, picks *[]string, maxTurns, quorum *int) error {
        _ = eligible
        *picks = []string{"agent-a"}

Mcmd/entire/cli/investigate/picker_test.go+8/-2