'connection' is at least mentioned in the API doc (http://rexify.org/docs/api/1.3/rex/commands.pm.html#connection) but 'task' is not.
Plus, it appears that task->user is never set, and task->name is not updated when the task has been launched via needs() -- in this case it still reports dependee's name.