Pi agent encounters EPIPE when trying to write final output because readPiOutput closes stdout handle before pi finishes flushing. The monitor thread detects process exit and cleans up handles before pi has finished writing all events. Need to ensure pi's stdout is fully drained before closing the handle.
Added grace-period reading loop: keep stdout open after agent_end with timeout-based polling; only stop after grace period, preventing early pipe close/EPIPE. Tests: bild --test Omni/Agentd/Daemon.hs
Updated readPiOutput to use ByteString.hGetLine with lenient UTF-8 decode and EOF-safe error handling to avoid premature stdout close/EPIPE.