feat: spill large inputs to disk to prevent IPC frame overflow (#2804)
* feat: spill large inputs to disk to prevent IPC frame overflow
When an input payload exceeds 6 MiB (MAX_INLINE_IPC_SIZE), the parent
serializes it to a file under /tmp/coglet/predictions/{id}/inputs/ and
sends only the file path over the slot socket. The worker reads the file
back, parses it, and deletes it before running the prediction.
This mirrors the existing output-spill mechanism and prevents the 8 MiB
LengthDelimitedCodec frame limit from being exceeded by large inputs.
Key changes:
- protocol.rs: SlotRequest::Predict now has optional input/input_file
fields, prediction_id() accessor, and rehydrate_input() method
- service.rs: build_slot_request() checks size and spills to disk;
prediction dir layout changed to /tmp/coglet/predictions/{id}/
- worker.rs: uses rehydrate_input() with proper failure handling that
sends SlotResponse::Failed instead of silently dropping predictions
- Unified MAX_INLINE_IPC_SIZE constant (was separate input/output consts)
- Integration test with 7 MiB payload via new harness @file curl syntax
* fix: raise HTTP body limit to 100 MiB and fix rustfmt comment alignment
- Axum's default 2 MiB body limit rejected large input payloads with
HTTP 413 before they could reach the spill-to-disk logic. Set
DefaultBodyLimit to 100 MiB on the router.
- Fix pre-existing rustfmt comment alignment in truncate_worker_log tests
that CI's rustfmt version caught.
* Update integration-tests/harness/harness.go
good find
Co-authored-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Michael Dwan <m@dwan.io>
* Potential fix for pull request finding 'Useless assignment to local variable'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
---------
Signed-off-by: Michael Dwan <m@dwan.io>
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Co-authored-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>