agent: rework UnitStatePublisher with complete coverage