mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-27 11:20:42 +01:00
The sandbox process-session bridge writes each stdin message to its own remote file. The remote stdin poller reads the files in name order and holds that order only across files it already sees. It cannot know that a file with an earlier name is still on the way. The socket handler fired each stdin write without serialization, so two writes could interleave. Each write runs several execs, so a later stdinEnd file could land before the earlier data file it must follow. The poller then ended the child stdin before the input file landed, and the child exited with no output. Under load this made the streamed-output bridge test deliver an empty stdout instead of the echoed input. Chain the stdin writes so each file lands before the next write starts, which keeps the files in send order. Chain the teardown stdinEnd write too, so it lands after any in-flight input file. Add a regression test that delays the first data file's finalize exec, so the stdinEnd write wins the race, and proves the bridge still delivers the echo. Co-authored-by: Paperclip <noreply@paperclip.ing>