pub fn initialize_process_runtime() {
    let _ = rustls::crypto::ring::default_provider().install_default();

    // Install a global panic hook so that any panic in a spawned task
    // is logged with a full backtrace before the process exits.  Without
    // this hook, panics are silent (or print a brief message to stderr)
    // which makes root-causing crashes difficult.
    let default_hook = std::panic::take_hook();
    std::panic::set_hook(Box::new(move |info| {
        // Use tracing so the panic appears in the same log stream as everything else.
        tracing::error!(
            panic.payload = ?info.payload(),
            panic.location = ?info.location(),
            "FATAL: process panicked — collecting backtrace"
        );
        // Print a compact backtrace to stderr as well (backtrace is not
        // captured by tracing).
        let backtrace = std::backtrace::Backtrace::capture();
        if backtrace.status() == std::backtrace::BacktraceStatus::Captured {
            eprintln!("FATAL panic backtrace:\n{}", backtrace);
        }
        // Delegate to the default hook which prints the panic message and
        // optionally the RUST_BACKTRACE-based backtrace.
        default_hook(info);
    }));
}