add drain mode, handle replication error, filter stalled request

@ericvaandering, could you review and create the new tag?
This includes
 * stalled request filter: #4750
 * ad hoc replication error handing: #4734 
 * drain status propagation: #4552
 * bug fix on agent error number auto refresh
 * force JSlint styling.