pub async fn teardown(
mcp_arcs: Vec<Arc<McpClient>>,
network: Option<NetworkInterceptor>,
container: Container,
store: &SessionStore,
sid: &SessionId,
final_exit: i32,
)Expand description
Cleanup tail. Order: MCP shutdowns (so their podman exec pipes drain
before the container goes away) -> container stop -> session finalize.
Each step’s failure is logged but never propagated; the caller’s outcome
owns the process exit code.
Callers must drop any Arc<McpClient> clones (e.g. tool adapters) and
the agent before invoking this – otherwise Arc::try_unwrap returns
Err and the explicit shutdown is skipped in favor of Drop.