diff --git a/changelog.d/fixed-watchdog-credential-missing-boot-grace.md b/changelog.d/fixed-watchdog-credential-missing-boot-grace.md new file mode 100644 index 0000000000..dbe21a54d1 --- /dev/null +++ b/changelog.d/fixed-watchdog-credential-missing-boot-grace.md @@ -0,0 +1 @@ +- Watchdog no longer raises a "CredentialMissing" credential-failure alert (and fleet self-report) for Claude login chrome seen inside the boot grace window (#17573). diff --git a/src/crux/watchdog/reconciler.go b/src/crux/watchdog/reconciler.go index 34fa1a4df0..eb5e643fb2 100644 --- a/src/crux/watchdog/reconciler.go +++ b/src/crux/watchdog/reconciler.go @@ -792,6 +792,12 @@ func (r *Reconciler) reconcileAuth(ctx context.Context, name string, obs Observa // standing operator alert must be cleared. healable := cls.Class == ClassAuthRequired && obs.CredentialProven + // The classifier withheld ClassAuthRequired for login chrome (boot grace). + // For claude the per-agent probe only answers known-absent from that same + // pane signal (AgentAuthState), so CredentialMissing would re-page the + // very sighting the classifier just declined to act on. + loginChromeSuppressed := obs.ShowsLoginPrompt && cls.Class != ClassAuthRequired + if healable { // A login screen over a credential that demonstrably still works is // the token-restart heal's case, not an operator's — the same division @@ -814,7 +820,7 @@ func (r *Reconciler) reconcileAuth(ctx context.Context, name string, obs Observa status = ConditionFalse reason = "PaneShowsLogin" message = cls.Reason - } else if obs.AuthKnown && !obs.AuthAvailable { + } else if obs.AuthKnown && !obs.AuthAvailable && !loginChromeSuppressed { // The manager's owner-aware per-agent credential probe (#4619/#4641) // says the credential file is definitively absent for an agent whose // backend requires interactive auth. diff --git a/src/crux/watchdog/refreshable_credential_test.go b/src/crux/watchdog/refreshable_credential_test.go index 607ac0bb0e..ab2fa67e4f 100644 --- a/src/crux/watchdog/refreshable_credential_test.go +++ b/src/crux/watchdog/refreshable_credential_test.go @@ -188,3 +188,29 @@ func TestAuthHealableClearsAStandingAlert(t *testing.T) { t.Fatal("alert is sticky: it must clear once the credential is usable again, not wait for the pane to stop showing login chrome") } } + +// TestAuthCredentialMissingHonoursLoginBootGrace: the per-agent probe reports +// known-absent for claude only because the pane showed login chrome. Inside +// boot grace the classifier declines that sighting, so the credential-missing +// branch must not raise the alert it was declining (#17573). +func TestAuthCredentialMissingHonoursLoginBootGrace(t *testing.T) { + clock := newFakeClock() + fleet := newFakeFleet("a1") + fleet.setObs("a1", Observation{ + Backend: "claude", SessionExists: true, + Pane: loginPane, ShowsLoginPrompt: true, + StartedAt: clock.Now(), + AuthKnown: true, AuthAvailable: false, + }) + alerter := newFakeAlerter() + r := newTestReconciler(t, fastSettings(), fleet, alerter, clock) + r.Tick(context.Background()) + + auth, _ := FindCondition(r.Conditions("a1"), ConditionAuthenticated) + if auth.Status == ConditionFalse { + t.Fatalf("Authenticated = %+v, want not False inside boot grace", auth) + } + if alerter.has(authAlertID("a1")) { + t.Fatal("paged an operator for login chrome inside boot grace") + } +}