fix(JDWLABS-464): verify drift-scan verdicts against Prometheus before escalating - #392
Merged
Merged
Conversation
…alating The hourly drift scan escalated whatever Holmes returned as an ISSUE. The local model has claimed pending pods with none Pending and reported lifetime restart counts on months-old pods as spikes, and both went straight to the alert relay. Each ISSUE line now names a category and concrete evidence, and the job re-checks the category with a fixed PromQL query (pending >5m, >=3 restarts in the last hour, node memory >90%, cert-manager expiry <30d). Only claims Prometheus confirms are escalated; a rejected claim is logged as one JSON line (event=drift-scan-verify) so the false-positive rate is observable. An unreachable Prometheus escalates the claim unverified rather than suppressing it. Unlabelled claims are checked against every category. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B6FWEmAs2beQvKnX4LwWN2
jdwlabs-root
previously approved these changes
Aug 31, 2026
count=$(truth "$query") ran under sh -ec; a partial/malformed 200 response makes jq fail, which aborted the whole verification loop instead of falling back to the unverified outcome the rest of the script already handles.
jdwlabs-root
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ClusterDriftDetected(fingerprintdrift-scan-20260829) fired from the hourlyholmes-drift-scanCronJob inai-srewithVERDICT: ISSUE: Pending pods detected in the cluster.while the cluster had zero Pending pods (scheduler_pending_pods0, nophase=Pendingpods, no events). The job forwarded whatever Holmes returned straight to the alert relay, so an LLM false positive became a page.Today's runs show the same class of error in another category: all three of this morning's jobs escalated "restart spikes" that were lifetime restart counts (7-9) on pods that are weeks old, with
increase(kube_pod_container_status_restarts_total[1h])at 0 across the cluster.Fix
Scope: the CronJob manifest only (
tenants/platform/services/holmes/postInstall/drift-scan-cronjob.yaml).VERDICT: ISSUE: <category>: <summary> (evidence: <names and metric values>)line with<category>from a fixed set, and must not report conditions it could not check.VERDICT: ISSUE:line is parsed for its category and re-checked against Prometheus with a fixed PromQL query using the same threshold given to the model. Only claims Prometheus confirms are escalated; the alert description gains aGround truth:section with the query result.{"event":"drift-scan-verify","category":...,"outcome":confirmed|rejected|unverified,"groundTruth":...,"claim":...}; a run where nothing is confirmed logs the count and exits 0.unverifiedrather than dropped. An unlabelled claim (model ignores the format) is checked against all four categories combined rather than dropped.Evidence
sh -nandshellcheck -s shon the extracted script: clean.yamllint tenants/ bootstrap/,kubeconform -strict,check-image-pins.py,check-orphaned-manifests.py: pass.platform-kube-prometheus-s-prometheus) and return a scalar; the metrics exist (certmanager_certificate_expiration_timestamp_secondshas 7 series, min expiry 49d).outcome=rejected, groundTruth=0, exit 0, no relay POSTVERDICT: ISSUE: Pending pods...->category=unknown, rejectedVERDICT: CLEAN-> clean exitconfirmed, groundTruth=3, relay payload built withGround truth:appendedoutcome=unverified, escalatedai-sretomonitoringis allowed by the namespace's existingallow-all-egresspolicy; Holmes itself already uses the same Prometheus URL.Left for a human
drift-scan-verifylines show the model and the queries disagreeing on definitions rather than facts.🤖 Generated with Claude Code
https://claude.ai/code/session_01B6FWEmAs2beQvKnX4LwWN2