157 lines
10 KiB
Markdown
157 lines
10 KiB
Markdown
# Focused Jeannie doctor
|
|
|
|
Use the same inventory areas as `status`, selecting one at a time:
|
|
|
|
```sh
|
|
./jeannie doctor oci
|
|
./jeannie doctor rpi
|
|
./jeannie doctor opi5
|
|
./jeannie doctor debian
|
|
./jeannie doctor cluster
|
|
```
|
|
|
|
The doctor reuses the selected area's status checks and adds focused
|
|
diagnostics for the OCI edge, RPi, Debian, and cluster. It does not offer an
|
|
all-area mode. Each device view checks OS kernel, uptime/load, available memory,
|
|
root filesystem usage and systemd state as well as its services. Orange Pi
|
|
also reports its selected K3s checks. Remote OS checks use inventory SSH access.
|
|
Existing `doctor-edge`, `doctor-gitea`, `doctor-rpi`, `doctor-cluster`, and
|
|
`doctor-k8s` remain available for their specialized investigations.
|
|
|
|
To investigate one item, copy its full check name from status, or provide an
|
|
Argo CD application name or Compose project/service:
|
|
|
|
```sh
|
|
./jeannie doctor cluster gitea-runner --details
|
|
./jeannie doctor gitea-runner
|
|
./jeannie doctor homelab-gitea/gitea
|
|
./jeannie doctor debian --item homelab-gitea/gitea --details
|
|
./jeannie remote doctor rpi --item homelab-rpi-services/pihole --ai
|
|
```
|
|
|
|
Matching is exact and case-insensitive. A short Compose service name is
|
|
accepted only when unambiguous. Jeannie collects the area's snapshots before
|
|
selecting the item; it reports an error if the name cannot be resolved. For a
|
|
selected Compose container it reads state, restart count, exit code and health;
|
|
for an Argo CD application it reads health, operation and unhealthy resource
|
|
status and deployment replica counts. An item without a scope is looked up in
|
|
Argo CD and the inventoried Compose hosts. If any source is unavailable, or a
|
|
name is ambiguous, specify its scope explicitly. It does not fetch container environment variables or Kubernetes
|
|
Secret contents. Remote Compose checks require noninteractive SSH and sudo.
|
|
|
|
Use `--ai` to request an evidence-validated Holmes explanation, or
|
|
`--no-local-rca` to disable it. AI is enabled by default for a selected item,
|
|
and is off by default for a whole host or cluster scope. It does not perform
|
|
repairs. `--json` returns structured evidence without AI output. These are
|
|
read-only checks; any suggested remediation should be reviewed separately.
|
|
|
|
For a selected Kubernetes application, Doctor also reads up to five pods selected
|
|
by each deployment's simple match-label selector and the latest pod events.
|
|
For each selected pod it identifies the controller, up to three PVCs, and their
|
|
bound PV names and local or host paths without reading application secrets.
|
|
For a container in CrashLoopBackOff with a previous restart, it also requests
|
|
bounded previous-container logs, and reports when those logs are unavailable.
|
|
For a pod on the configured native K3s control-plane node, it also attempts a
|
|
read-only SSH query of `/data` and the pod's mount identities. This helps identify
|
|
old pod bind mounts after the underlying storage is remounted. Missing SSH or
|
|
mount evidence does not establish that storage is healthy.
|
|
It extracts status, wait reasons, and bounded event messages without dumping
|
|
pod specs. Unsupported selectors or failed reads are reported as unknown.
|
|
When AI is enabled, focused Doctor invokes Holmes with the selected profile
|
|
and this evidence, forbids Bash execution with `--bash-always-deny`, instructs
|
|
Holmes not to call tools, and validates the citations and read-only command
|
|
against the collected report. A single fenced JSON response is accepted; invalid
|
|
JSON is retried once, with both responses preserved. A syntactically valid answer
|
|
that fails evidence validation is rejected without retry. Failed or rejected Holmes answers leave the
|
|
deterministic evidence available. Private evidence and logs are stored under the
|
|
Doctor K8s artifact directory. Other Holmes toolsets and credentials must still
|
|
be restricted independently; logs and event messages may contain sensitive details.
|
|
Redaction is best effort, not a guarantee, and
|
|
the configured OmniRoute model can be external. The dedicated Gitea runner
|
|
text report remains deterministic and does not invoke Holmes.
|
|
|
|
To let Holmes investigate and attempt to repair a Kubernetes application, use
|
|
`./jeannie doctor cluster n8n --fix` on the Debian CLI. This checks the pinned
|
|
cluster context, records a change journal entry, enables Holmes tools and
|
|
automatically allows Bash commands. **Holmes has the Debian user's host-level
|
|
permissions**, including any passwordless sudo access; this is not a sandbox or
|
|
an application-scoped permission boundary. Its actions can change the cluster
|
|
or host. Repair mode uses Holmes's interactive path on a pseudo-terminal and
|
|
ends the session after Holmes saves its first response. Holmes is asked for a
|
|
diagnosis, an evidence-based five whys analysis,
|
|
the repair, validation and recommendations, marking unsupported causes as
|
|
unknown. Doctor saves its output, errors and a report in a private artifact
|
|
directory, then independently checks the selected application's Argo CD health
|
|
and sync. A failed or unavailable check returns a failure; Healthy and Synced
|
|
does not establish end-to-end health or confirm the root cause. This mode is
|
|
unavailable through the remote API and does not accept JSON output.
|
|
The repair invocation uses Holmes fast mode to skip TodoWrite planning and
|
|
requests investigation tools directly; the model may still fail to call tools.
|
|
The focused Kubernetes repair prompt includes the repository's
|
|
`infra/ai-stack/holmes-skills/k3s-stale-volume/SKILL.md` procedure. It describes
|
|
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.
|
|
When a completed response records exactly zero tool calls, Doctor retries once
|
|
with the same evidence and retains both conversations. Failed, timed-out, or
|
|
unreadable conversations are not retried because actions may have occurred.
|
|
The independent post-repair identity and application check retries twice on
|
|
failure, then reports unknown if it still cannot obtain evidence.
|
|
Repair mode defaults to 30 model steps, a 900-second timeout and a 2048 MiB
|
|
per-tool memory limit; `LAB_HOLMES_REPAIR_MAX_STEPS`,
|
|
`LAB_HOLMES_REPAIR_TIMEOUT_SECONDS` and `LAB_HOLMES_REPAIR_TOOL_MEMORY_MB`
|
|
override these limits. These are limits, not a guarantee that Holmes will
|
|
complete or that every tool can run within them.
|
|
When `LAB_HOLMES_MODEL` selects `ollama_chat/...`, repair mode starts a
|
|
temporary loopback proxy that translates a single JSON tool request, optionally
|
|
in one Markdown JSON fence, into
|
|
an OpenAI-style tool call only if the requested name and arguments pass the
|
|
tool's supplied JSON Schema. Other responses are passed through. It uses the
|
|
Holmes pipx Python environment for `jsonschema`; override that interpreter with
|
|
`LAB_HOLMES_ADAPTER_PYTHON`. The proxy buffers model output before streaming it
|
|
to Holmes. Doctor exposes only the Bash tool to the local model, to reduce
|
|
tool-selection errors; Bash still has host-level access. This compatibility layer does not establish that a model's proposed
|
|
actions are correct; repair mode still allows host-level Bash commands.
|
|
If the initial model answer is prose and no tool has run, the adapter makes one
|
|
additional request with a shorter prompt. It forwards the reply only if it is
|
|
one schema-valid Bash call containing a single read-only `kubectl get` command.
|
|
It does not invent a call from the prose or force a tool after tool history
|
|
exists. Subsequent Holmes actions retain the permissions described above.
|
|
If a final response only copies or summarizes a Kubernetes resource after a
|
|
tool call, without a full diagnosis, mitigation and validation, the adapter
|
|
asks once for the next read-only PVC or PV check using names in the evidence.
|
|
Only a schema-valid, single `kubectl get` call is forwarded, and a named PVC or
|
|
PV must match the corresponding name in the collected mapping.
|
|
If the model immediately repeats an identical Bash command, the adapter asks it
|
|
once to continue using the previous result. If it repeats again, Doctor stops
|
|
the investigation and reports it as incomplete rather than rerunning it.
|
|
|
|
For native K3s on the Orange Pi, `doctor opi5` collects the K3s service state,
|
|
data and runtime mount identities, USB ext4 candidates and recent storage
|
|
errors. If it detects a stale read-only mount whose device disappeared, it
|
|
offers `./jeannie doctor opi5 --repair-k3s`. That explicit local CLI action
|
|
checks the selected profile, pinned cluster identity, exclusive runtime and
|
|
operation locks, and requires failed or inactive K3s and one unmounted USB
|
|
ext4 partition. Before stopping private K3s workloads, it mounts the candidate
|
|
read-only with journal replay disabled and checks its K3s CA against the pinned
|
|
identity. It then unmounts the stale mounts without force, remounts the SSD,
|
|
verifies the CA and bind mount, starts K3s, and checks the live cluster identity.
|
|
It does not format a disk, run filesystem repair, or recreate the cluster.
|
|
If any mount is busy or a check fails, recovery stops; the report identifies the
|
|
last failure and further investigation is needed. A healthy K3s API does not
|
|
prove application health. The local runtime repair is refused through the API.
|
|
|
|
The Gitea runner has a specific diagnosis: it compares the live Argo CD
|
|
revision and Deployment with the committed zero-replica configuration, then
|
|
checks the Debian runner service. If the installed host service is inactive,
|
|
the report proposes a specific start command and asks before executing it in
|
|
an interactive terminal. A noninteractive or remote invocation never applies
|
|
that mitigation; it prints the command for a human to review. A running
|
|
systemd service alone does not prove runner registration or job execution.
|
|
The deterministic runner report does not request an AI explanation.
|