fix(chat): ground diagnosis in pod-level evidence - #43
Merged
Merged
Conversation
The Ask AI planner could only pick aggregate in-memory tools, so failures like CreateContainerConfigError (empty SealedSecret keys) and CrashLoopBackOff (DB-auth crashes) were diagnosed by guesswork instead of observed state. Add read-only evidence tools backed by the typed k8s client: describe_pod (container waiting/terminated state, exit codes, pod events), pod_logs (with previous=true), rollout_status (conditions + ReplicaSets), job_status (conditions + failed count + last pod tail), and secret_keys (metadata only, never values). get_pods now also surfaces the container waiting reason on the summary line. Tighten both prompts to evidence-first diagnosis: planners prefer the evidence tools for failing-workload questions, and the synthesis prompt maps status classes to causes while prohibiting attribution to aggregate health scores without observed evidence. Closes #42
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.
What
The Ask AI engine could only reach aggregate/summarized tools, so diagnosis of
failing workloads (
CrashLoopBackOff,CreateContainerConfigError, stuckrollouts, failed Jobs) was speculative rather than grounded in observed
evidence. This adds read-only, evidence-first tooling plus matching prompt
rules, mirroring the reality discovered in issue #42 (empty SealedSecrets
producing
couldn't find key X in Secret Ycontainer-config errors).Tools added (read-only, typed k8s client, no shell, no writes)
describe_pod— container waiting/terminated state, exit codes, pod eventspod_logs— tail of current or--previous(last-terminated) containerrollout_status— deployment conditions (e.g.ProgressDeadlineExceeded)plus ReplicaSets by revision
job_status— Job conditions (e.g.BackoffLimitExceeded), failed count,and the last failed pod's log tail
secret_keys— Secret data keys only (never values)get_podsnow surfaces the container waiting reason (e.g.CreateContainerConfigErrorwith the missing-key message quoted by events).Prompt changes
failing-workload questions
state to cause classes; never attribute a workload failure to an aggregate
health/security/cost score without observed evidence; state what could not
be verified and which kubectl would reveal it
Tests
New
chat_evidence_tools_test.gocovers each evidence tool (waiting/terminatedstate surfacing, previous-logs, rollout ReplicaSet attribution, Job backoff,
secret key-only output). Full analyzer + workspace suite green via
make test.Closes #42