container_doctor
container_doctor
¶
In-container health checks via the layered doctor protocol.
Entry point: ContainerDoctor.
ContainerDoctor(project_name, task_id).run(...) collects checks from
terok_sandbox.doctor (network, shield),
terok_executor.doctor (bridges, credentials, env), and adds
terok-level checks (git identity, remote URL). It executes probes
inside the running container via podman exec (under crun) or SSH
(under krun), and optionally applies fixes.
All checks run from the host — the container cannot tamper with the diagnostic process.
ContainerDoctor(project_name, task_id)
dataclass
¶
Layered in-container health-check orchestrator for one task.
Construct with ContainerDoctor(project_name, task_id) and call
:meth:run to execute every probe in sandbox / agent / terok
layers against the running container.
The instance carries the (project_name, task_id) pair that names
the target task; runtime resolution happens inside :meth:run so
the cheap construction is free of subprocess work.
project_name
instance-attribute
¶
Project the task belongs to.
task_id
instance-attribute
¶
Task identifier whose container is probed.
run(*, fix=False, reporter=None, label_prefix='')
¶
Run every layered health check against this task's container.
Probes are executed via podman exec under crun and over the
passt-forwarded SSH transport under krun — whichever booted the
container. Optional fixes run only for checks whose verdict
reports fixable=True.
When reporter is supplied, progress streams line-by-line and
noisy categories (Credential file (...), Phantom token
(...), …) coalesce into a single heading. The returned list
is empty in that case so the caller doesn't re-print.
label_prefix is prepended to every emitted label — used by
the sickbay command to tag multi-task runs with "Task
pid/tid: ".
Source code in src/terok/lib/orchestration/container_doctor.py
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 | |
run_container_doctor(project_name, task_id, *, fix=False, reporter=None, label_prefix='')
¶
Shim around :meth:ContainerDoctor.run for back-compat callers.