test(agent-setup): read only complete lines from the opencode plugin log

Merged
SA
4h ago
+1-1

The opencode tui plugin test polls a log its child process is still appending to. A read can land mid-line, and JSON.parse on the partial last line throws (seen on #9980's CI: reports a failed turn with its error message, JSON Parse error: Unexpected EOF).

read() now drops the text after the last newline, so it parses only complete lines; waitFor keeps polling until the line is finished. 95/95 pass locally.


Summary by cubic

Fixes the opencode tui plugin test so it stops failing on partial log lines. The test polls a log the child process is still appending to, and a read could land mid-line, making JSON.parse throw on the incomplete last line (seen once on #9980's CI). read() now drops the text after the last newline, parses only complete lines, and waitFor keeps polling until the final line is written.

Summary by CodeRabbit

  • Tests
    • Improved notification log handling in automated tests to preserve meaningful whitespace while ignoring an empty line at the end.