Clarify incomplete Holmes mitigations
This commit is contained in:
parent
0fa9a7bcd7
commit
b9347cf5c8
|
|
@ -218,11 +218,13 @@ doctor_focus_holmes_fix() {
|
|||
printf 'Holmes investigation, five whys and attempted mitigation (model-generated; verify claims):\n'
|
||||
cat "${artifact}/holmes-output.txt"
|
||||
if [[ -f "${artifact}/holmes-retry-output.txt" ]]; then printf '\nHolmes retry:\n'; cat "${artifact}/holmes-retry-output.txt"; fi
|
||||
printf '\nHolmes execution: '
|
||||
if ((status)); then echo 'incomplete, failed or timed out; changes may already have occurred'; else echo 'completed'; fi
|
||||
printf '\nHolmes session: '
|
||||
if ((status)); then echo 'incomplete, failed or timed out; changes may already have occurred'; else echo 'finished; tool use does not establish that a mitigation was applied'; fi
|
||||
if [[ "${tool_status}" != observed ]]; then echo 'No completed Holmes tool calls were recorded; no tool-based investigation is confirmed.'; fi
|
||||
printf '\nIndependent post-repair Argo CD check: %s\n' "${validation}"
|
||||
cat "${artifact}/validation.txt"
|
||||
if [[ "${validation}" == unhealthy ]]; then echo 'No successful mitigation confirmed: the application remains unhealthy.'; fi
|
||||
if [[ "${validation}" == unknown ]]; then echo 'Mitigation result unknown: the application could not be independently checked.'; fi
|
||||
printf 'This checks Argo CD health and sync only; it does not prove end-to-end functionality or the root cause.\n'
|
||||
} >"${artifact}/report.txt"
|
||||
cat "${artifact}/report.txt"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ doctor_focus_application_fetch() { printf '%s' '{"metadata":{"name":"n8n"},"stat
|
|||
doctor_focus_holmes_fix n8n'''
|
||||
result = subprocess.run(["bash", "-c", code, "test", str(DOCTOR)], env=env, capture_output=True, text=True, check=True)
|
||||
self.assertIn("attempted repair", result.stdout)
|
||||
self.assertIn("tool use does not establish that a mitigation was applied", result.stdout)
|
||||
self.assertIn("Independent post-repair Argo CD check: healthy", result.stdout)
|
||||
artifact = next((root / "artifacts").glob("repair.*"))
|
||||
self.assertIn("application n8n", (artifact / "holmes-prompt.txt").read_text())
|
||||
|
|
@ -146,6 +147,29 @@ doctor_focus_holmes_fix n8n'''
|
|||
result = subprocess.run(["bash", "-c", code, "test", str(DOCTOR)], env=env, capture_output=True, text=True)
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("Independent post-repair Argo CD check: unknown", result.stdout)
|
||||
self.assertIn("Mitigation result unknown", result.stdout)
|
||||
|
||||
def test_completed_tool_use_does_not_claim_unhealthy_app_fixed(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
binary = root / "jeannie-holmes"
|
||||
binary.write_text("#!/bin/sh\nwhile [ $# -gt 0 ]; do if [ \"$1\" = --json-output-file ]; then shift; printf '%s' '{\"tool_calls\":[{}]}' > \"$1\"; break; fi; shift; done\nread -r line\n")
|
||||
binary.chmod(0o755)
|
||||
rows = root / "rows"
|
||||
rows.write_text("warn\tKubernetes apps\tn8n\tUnavailable\n")
|
||||
env = os.environ.copy()
|
||||
env.update(PATH=f"{root}:{env.get('PATH', '')}", REPO_ROOT=str(ROOT), HOME=str(root),
|
||||
REPORT_UI_ROWS_FILE=str(rows), KUBECONFIG_PATH="/tmp/test-kubeconfig",
|
||||
LAB_AI_STACK_TOOLS_ENV_FILE=str(root / "missing"), LAB_HOLMES_CONFIG_FILE=str(root / "missing-config"),
|
||||
LAB_DOCTOR_K8S_ARTIFACT_DIR=str(root / "artifacts"))
|
||||
code = '''source "$1"
|
||||
cluster_context_require() { :; }
|
||||
record_change_journal() { :; }
|
||||
doctor_focus_application_fetch() { printf '%s' '{"metadata":{"name":"n8n"},"status":{"health":{"status":"Progressing"},"sync":{"status":"Synced"}}}'; }
|
||||
doctor_focus_holmes_fix n8n'''
|
||||
result = subprocess.run(["bash", "-c", code, "test", str(DOCTOR)], env=env, capture_output=True, text=True)
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("No successful mitigation confirmed", result.stdout)
|
||||
|
||||
def test_holmes_retries_invalid_json_once_and_preserves_outputs(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
|
|
|
|||
Loading…
Reference in New Issue