agent: Fix error handling in map_supervised_sockets