Observer health can stay green through an outage: empty stores count as success, and reply text containing "Invalid API key" is treated as an auth failure
Environment: claude-mem 13.28.0 (also seen in 13.25.1), Linux, CLAUDE_MEM_PROVIDER=claude, Claude subscription via the CLI login, observer claude-haiku-4-5-20251001, Claude Code 2.1.283.
Two small defects in worker-service.cjs. Both make observer-health.json misreport what the observer is doing. Related: #4150 (auth failures that never reach observer-health) and #3606 (plan-18, observer response pipeline).
1. A store with zero observations resets the failure streak and clears the quota cooldown
After storeObservations, the success path runs unconditionally:
h.info("DB",`STORED | ... | obsCount=${R.observationIds.length} | ... | summaryId=${R.summaryId||"none"}` ...)
...
vQ(), e.currentProvider&&hee(e.currentProvider);vQ() sets consecutiveFailures=0 and lastSuccessAt, and hee() deletes the provider's quota cooldown. Both run when obsCount=0 and there is no summary.
Observed effect (13.25.1, 2026-09-26): two observer-health.json snapshots taken 11 hours apart show the same pattern. A quota probe got one reply that parsed as valid with zero observations (success at 06:11:26.6Z, again at 17:02:40.9Z), which reset the streak to 0. About 2.5 s later the next rate-limit event aborted the session and the streak went back to 1. So consecutiveFailures stayed low and failingSinceAt kept moving forward, and a health check that alerts at 3 consecutive failures stayed quiet during the day. Between 2026-09-26 06:11Z and 2026-09-27 17:52Z the DB gained 29,717 tool_uses rows but almost no observations.
Expected: only a store with at least one observation or a summary counts as success. An empty store leaves both the streak and the cooldown unchanged.
2. Any observer reply that contains the phrase "Invalid API key" throws an auth error
In the SDK response loop:
if(typeof R=="string"&&R.includes("Invalid API key"))throw new Error("Invalid API key: check your API key configuration in ~/.claude-mem/settings.json or ~/.claude-mem/.env");R is the observer model's reply text. When the observed session is itself about authentication (debugging a login, or reading claude-mem's own logs), the observer quotes the phrase in its summary. The worker then throws before storing, classifies the error as auth_invalid, and the batch is discarded. observer-health.json recorded this twice (2026-09-27 18:06:56Z and 18:16:58Z) while real calls on the same login kept succeeding.
Expected: detect auth failures from the SDK or CLI error result (status 401/403, error type, exit reason), not from a substring of the model's reply text.
Source: thedotmack/claude-mem