Make diagnostic AI explanations opt-in

This commit is contained in:
juvenal.diaz 2026-11-04 14:28:07 -06:00
parent 07116bdc5b
commit 546acc0b18
6 changed files with 25 additions and 15 deletions

View File

@ -5,8 +5,9 @@
`./jeannie status` defaults to fast mode: it checks current host, cluster,
workload, DNS, registry, and public-route health without log scans, OCI backup
freshness, or an AI response. `./jeannie status --deep` adds those checks,
restart history, inventory/storage checks, and the optional AI hypothesis.
`--no-local-rca` suppresses the hypothesis; `--verbose` implies deep mode. The
restart history, and inventory/storage checks. Add `--ai` to request an
unverified AI hypothesis for status or a doctor. `--no-local-rca` disables it;
`--verbose` implies deep mode. The
report identifies its mode, and fast mode cannot establish backup freshness or
the absence of recent errors. Healing collects deep evidence and rejects an
explicitly supplied fast status report.

View File

@ -5,8 +5,9 @@
`./jeannie status` defaults to fast mode: it checks current host, cluster,
workload, DNS, registry, and public-route health without log scans, OCI backup
freshness, or an AI response. `./jeannie status --deep` adds those checks,
restart history, inventory/storage checks, and the optional AI hypothesis.
`--no-local-rca` suppresses the hypothesis; `--verbose` implies deep mode. The
restart history, and inventory/storage checks. Add `--ai` to request an
unverified AI hypothesis for status or a doctor. `--no-local-rca` disables it;
`--verbose` implies deep mode. The
report identifies its mode, and fast mode cannot establish backup freshness or
the absence of recent errors. Healing collects deep evidence and rejects an
explicitly supplied fast status report.

View File

@ -110,7 +110,7 @@ Cluster Lifecycle
Check Kubernetes/container tooling versions.
Operator View And Reports
status [--fast|--deep] [--all|--details|--verbose|--json] Check current health; --deep includes logs and backups.
status [--fast|--deep] [--ai] [--all|--details|--verbose|--json] Check health; --deep includes logs and backups.
status --heal-plan Build a guarded self-heal plan from status.
status --heal Dry-run auto-eligible self-heal actions.
scorecard Compact pass/warn/fail operator scorecard.

View File

@ -2420,9 +2420,6 @@ status_report() {
fi
if [[ "${requested_mode}" == deep || -n "${heal_mode}" || "${REPORT_UI_VERBOSE}" == true ]]; then
JEANNIE_STATUS_MODE=deep
else
# Fast status reports deterministic health without waiting for a model.
local REPORT_UI_LOCAL_RCA=false
fi
if [[ -n "${heal_mode}" ]]; then
@ -2438,11 +2435,11 @@ status_report() {
((REPORT_UI_FAILURES == 0)) || cascade_status=1
report_ui_render "Jeannie Status" >"${status_json}"
report_ui_cleanup
if [[ "${heal_mode}" == "plan" ]]; then
"${REPO_ROOT}/scripts/heal" plan --status-json "${status_json}" --ai
else
"${REPO_ROOT}/scripts/heal" apply --status-json "${status_json}" --ai
local -a heal_args=("${heal_mode}" --status-json "${status_json}")
if truthy "${REPORT_UI_LOCAL_RCA:-false}"; then
heal_args+=(--ai)
fi
"${REPO_ROOT}/scripts/heal" "${heal_args[@]}"
rm -f "${status_json}"
return "${cascade_status}"
fi

View File

@ -3,7 +3,7 @@
REPORT_UI_ONLY="${REPORT_UI_ONLY:-problems}"
REPORT_UI_DETAILS=false
REPORT_UI_JSON=false
REPORT_UI_LOCAL_RCA="${REPORT_UI_LOCAL_RCA:-true}"
REPORT_UI_LOCAL_RCA="${REPORT_UI_LOCAL_RCA:-false}"
# shellcheck disable=SC2034
REPORT_UI_VERBOSE=false
REPORT_UI_ROWS_FILE=""
@ -16,7 +16,8 @@ Report UI flags:
--all Show ok, informational, skip, warning, and failing items.
--details Show the compact report plus detail fields.
--json Print structured JSON.
--no-local-rca Do not ask the local AI gateway for the focused RCA summary.
--ai Ask the local AI gateway for an unverified explanation.
--no-local-rca Disable the AI explanation, including when enabled by environment.
--verbose Use the older full diagnostic output when supported.
EOF
}
@ -40,6 +41,10 @@ report_ui_parse_args() {
REPORT_UI_JSON=true
shift
;;
--ai)
REPORT_UI_LOCAL_RCA=true
shift
;;
--no-local-rca)
REPORT_UI_LOCAL_RCA=false
shift
@ -253,7 +258,7 @@ report_ui_render() {
"${REPO_ROOT}/scripts/report-render" "${args[@]}" <"${REPORT_UI_ROWS_FILE}"
if [[ "${REPORT_UI_JSON}" != "true" ]] && truthy "${REPORT_UI_LOCAL_RCA:-true}"; then
if [[ "${REPORT_UI_JSON}" != "true" ]] && truthy "${REPORT_UI_LOCAL_RCA:-false}"; then
report_ui_local_rca "${title}"
fi
}

View File

@ -35,6 +35,12 @@ class StatusModeTests(unittest.TestCase):
self.assertEqual(result.returncode, 0)
self.assertIn("mode=deep ai=false", result.stdout)
def test_ai_is_opt_in_for_either_mode(self):
for mode in ("--fast", "--deep"):
result = self.run_status(mode, "--ai")
self.assertEqual(result.returncode, 0)
self.assertIn("ai=true", result.stdout)
def test_conflicting_modes_are_rejected(self):
self.assertNotEqual(self.run_status("--fast", "--deep").returncode, 0)
self.assertNotEqual(self.run_status("--fast", "--heal").returncode, 0)