test: add "error" event tests

One of them is currently failing...
agent: add a sync-guard for passing back an "error" on the first tick

Makes the failing test pass...