Fix EPIPE error in agentd pi adapter - stdout closed prematurely

t-541·WorkTask·
·
·
·agentd.hs
Created2 weeks ago·Updated2 weeks ago

Description

Edit

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.

Timeline (8)

🔄[human]Open → InProgress2 weeks ago
💬[human]2 weeks ago

Updated readPiOutput to use ByteString.hGetLine with lenient UTF-8 decode and EOF-safe error handling to avoid premature stdout close/EPIPE.

🔄[human]InProgress → Done2 weeks ago
🔄[human]Done → InProgress2 weeks ago
💬[human]2 weeks ago

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

🔄[human]InProgress → Done2 weeks ago