Fix race condition in AgentListener

Signed-off-by: John Tuley <jtuley@pivotallabs.com>