diff --git a/cmd/doctor.go b/cmd/doctor.go index 9cb802a..145da3f 100644 --- a/cmd/doctor.go +++ b/cmd/doctor.go @@ -289,8 +289,8 @@ type doctorScope struct { // Agents merge user-level configuration into every project, so a hook or MCP // server defined in the user scope genuinely applies to this project. Reporting // it MISS because the project file does not repeat it describes the file layout -// rather than the effective configuration. When every scope fails, the first -// scope's failure is reported, since that is the one the user is expected to fix. +// rather than the effective configuration. When every scope fails, the failure +// reported is chosen by the rule described below rather than by scope order. func checkScopedFile(label string, scopes []doctorScope, validate func(string) error, failures *int) { // When every scope fails, prefer reporting one that exists but is wired up // wrong over one whose file is simply absent: the former is the user's @@ -327,7 +327,7 @@ func checkScopedFile(label string, scopes []doctorScope, validate func(string) e return } - *failures++ + (*failures)++ switch { case misconfigured != nil: fmt.Printf("MISS %s: %s (%v)\n", label, misconfigured.path, misconfiguredErr) diff --git a/watch/control_events_test.go b/watch/control_events_test.go index 1f1620e..26c85c6 100644 --- a/watch/control_events_test.go +++ b/watch/control_events_test.go @@ -58,8 +58,10 @@ func TestControlEventBurstTriggersOneRefresh(t *testing.T) { } waitForWatchCondition(t, 5*time.Second, func() bool { return refreshes.Load() >= 1 }) - // Let any further coalesced refreshes land before counting. - time.Sleep(500 * time.Millisecond) + // Let any further refresh land before counting. Derived from the coalescing + // window so this stays correct if the window changes; several multiples so a + // slow CI machine does not read a late second refresh as a pass. + time.Sleep(5 * controlRefreshWindow) if got := refreshes.Load(); got != 1 { t.Fatalf("control event burst caused %d refreshes, want 1", got)