Pass Holmes diagnostic evidence as context file
Homelab Main / validate (push) Failing after 2m3s Details
Homelab Main / running-update (push) Has been skipped Details
Homelab Main / debian-ops (push) Has been skipped Details

This commit is contained in:
juvenal.diaz 2026-11-14 13:27:47 -06:00
parent 52f7c51111
commit 552f4be1ad
3 changed files with 11 additions and 5 deletions

View File

@ -90,6 +90,8 @@ The focused Kubernetes repair prompt includes the repository's
the evidence needed before considering a normal pod recreation after a storage
reconnect. This is guidance for Holmes, not enforcement of its actions; its
host-level Bash permissions remain unchanged.
Detailed evidence and the skill are passed as a Holmes context file so mount
paths containing brackets are not interpreted as terminal markup.
If Holmes records no tool calls, Doctor marks the investigation incomplete even
when the model prints what looks like a tool request as ordinary text. A tool
call record alone does not prove that a repair was made or succeeded.

View File

@ -157,7 +157,8 @@ doctor_focus_holmes_fix() {
cat "${REPORT_UI_ROWS_FILE}"
printf '\nHomelab skill: use only when its stated conditions match the observed evidence.\n'
cat "${REPO_ROOT}/infra/ai-stack/holmes-skills/k3s-stale-volume/SKILL.md"
} >"${artifact}/holmes-prompt.txt"
} >"${artifact}/holmes-context.txt"
printf 'Investigate and repair Kubernetes application %s using the supplied context file. Follow its procedure and report the outcome.\n' "${item}" >"${artifact}/holmes-prompt.txt"
record_change_journal "doctor-holmes-k8s-repair" "${item}"
echo "Holmes is authorized to execute commands to repair ${item}; its Bash tool has host-level access."
if ! timeout "${LAB_HOLMES_REPAIR_TIMEOUT_SECONDS:-900}" env KUBECONFIG="${KUBECONFIG_PATH}" \
@ -166,6 +167,7 @@ doctor_focus_holmes_fix() {
OPENAI_API_BASE="${OPENAI_BASE_URL:-http://127.0.0.1:20128/v1}" OPENAI_API_KEY="${key}" \
python3 "${REPO_ROOT}/scripts/doctor-holmes-interactive.py" "${artifact}/conversation.json" -- \
"${bin}" ask --config "${config}" --prompt-file "${artifact}/holmes-prompt.txt" \
--file "${artifact}/holmes-context.txt" \
--api-key "${key}" --model "${model}" --fast-model "${fast}" \
--max-steps "${LAB_HOLMES_REPAIR_MAX_STEPS:-30}" --fast-mode --interactive --bash-always-allow --json-output-file "${artifact}/conversation.json" \
>"${artifact}/holmes-output.txt" 2>"${artifact}/holmes-error.txt"; then

View File

@ -33,7 +33,7 @@ class DoctorFocusTests(unittest.TestCase):
"echo 'attempted repair'\nread -r line\n[ \"$line\" = /exit ]\n")
binary.chmod(0o755)
rows = root / "rows"
rows.write_text("warn\tKubernetes apps\tn8n\tUnavailable\n")
rows.write_text("warn\tKubernetes apps\tn8n\tUnavailable\t/dev/sda1[/openebs/volume]\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",
@ -49,9 +49,11 @@ doctor_focus_holmes_fix n8n'''
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())
self.assertIn("five whys", (artifact / "holmes-prompt.txt").read_text())
self.assertIn("K3s stale local-volume mount", (artifact / "holmes-prompt.txt").read_text())
self.assertIn("Distinguish I/O errors from permissions", (artifact / "holmes-prompt.txt").read_text())
self.assertIn("five whys", (artifact / "holmes-context.txt").read_text())
self.assertIn("K3s stale local-volume mount", (artifact / "holmes-context.txt").read_text())
self.assertIn("Distinguish I/O errors from permissions", (artifact / "holmes-context.txt").read_text())
self.assertIn("/dev/sda1[/openebs/volume]", (artifact / "holmes-context.txt").read_text())
self.assertNotIn("[/openebs/volume]", (artifact / "holmes-prompt.txt").read_text())
self.assertIn("does not prove end-to-end", (artifact / "report.txt").read_text())
def test_holmes_repair_rejects_text_only_tool_request(self):