agentd: close log handle properly when pi crashes

t-562·WorkTask·
·
·
·Omni/Agent.hs
Created1 week ago·Updatedyesterday

Description

Edit

When pi crashes (e.g. due to EROFS or other errors), agentd's Haskell-side log reader loop continues trying to write to the closed handle. This spams journalctl with hundreds of identical 'hPutStr: illegal operation (handle is closed)' errors. Fix: detect when the pi process has exited and close/stop the log reader loop cleanly. The reader should catch the IOException from the closed handle and terminate gracefully.

Timeline (4)

🔄[human]Open → InProgressyesterday
🔄[human]InProgress → Reviewyesterday
💬[human]yesterday

Fixed in b697c45: readPiOutput/readPiStderr use IORef to track log handle health. After first write failure, all future writes are skipped. Also stops reading on broken pipe.