Skip to content

doctor

doctor

Agent-level container health checks.

Contributes domain-specific checks to the layered doctor protocol (terok_sandbox.doctor): socat bridge liveness, credential file integrity in shared mounts, and phantom token / base URL verification.

The checks are returned as :class:DoctorCheck specs — probe commands + evaluate callables — that the top-level orchestrator (terok sickbay) executes inside containers via podman exec.

agent_doctor_checks(roster, *, proxy_port=None)

Return agent-level health checks for in-container diagnostics.

Parameters:

Name Type Description Default
roster AgentRoster

The loaded agent roster.

required
proxy_port int | None

Credential proxy TCP port. Required for base URL checks; if None, base URL checks are skipped.

None

Returns:

Type Description
list[DoctorCheck]

List of :class:DoctorCheck instances ready for orchestration.

Source code in src/terok_agent/doctor.py
def agent_doctor_checks(
    roster: AgentRoster,
    *,
    proxy_port: int | None = None,
) -> list[DoctorCheck]:
    """Return agent-level health checks for in-container diagnostics.

    Args:
        roster: The loaded agent roster.
        proxy_port: Credential proxy TCP port. Required for base URL checks;
            if ``None``, base URL checks are skipped.

    Returns:
        List of :class:`DoctorCheck` instances ready for orchestration.
    """
    checks: list[DoctorCheck] = [
        _make_ssh_bridge_check(),
        _make_gh_proxy_bridge_check(),
    ]
    checks.extend(_make_credential_file_checks(roster))
    checks.extend(_make_phantom_token_checks(roster))
    if proxy_port is not None:
        checks.extend(_make_base_url_checks(roster, proxy_port))
    return checks