Fix EPIPE error in agentd pi adapter - stdout closed prematurely

t-541·WorkTask·
·
·
·agentd.hs
Created2 months ago·Updated2 months ago·pipeline runs →

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 months ago
💬[human]2 months 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 months ago
🔄[human]Done → InProgress2 months ago
💬[human]2 months 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 months ago