Skip to content

Fail predictions when output uploads fail - #3197

Merged
michaeldwan merged 2 commits into
mainfrom
md/fix-output-upload
Oct 16, 2026
Merged

michaeldwan merged 2 commits into
mainfrom
md/fix-output-upload

Conversation

@michaeldwan

Copy link
Copy Markdown
Contributor

Coglet can report status: "succeeded" with output: null after a file upload times out or the upload server rejects it. Failed uploads can also disappear from otherwise successful list outputs.

In crates/coglet/src/orchestrator.rs, upload tasks return their errors to prediction completion. Any failed upload or upload task marks the prediction failed with an error. Cancellation aborts pending uploads and preserves the canceled status.

Uploads also include X-Prediction-Id, so Director handles them through its normal upload path rather than its legacy redirect fallback. The 25-second timeout and retry policy are unchanged.

Regression tests exercise HTTP rejection and the real 25-second timeout through the orchestrator event loop against a local upload server. They also cover partial list output, cancellation, and successful uploads.

Propagate output-upload and upload-task errors to the prediction so a
missing output can't be reported as a successful result. Cancellation
aborts in-flight uploads and retains the canceled status.

Send X-Prediction-Id on uploads so Director uses its normal upload path.
Keep the existing 25-second request timeout.
@michaeldwan
michaeldwan requested a review from a team as a code owner October 15, 2026 17:57
@ask-bonk

ask-bonk Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

I've completed a thorough review of PR #3197. Let me summarize my analysis:

Changes reviewed:

  • crates/coglet/src/orchestrator.rs (+361/-52): Upload tasks now return Result<(), String> wrapped in AbortOnDropHandle; the Done handler propagates upload errors to set_failed, aborts uploads on cancellation via a biased select, and the no-uploads sync path now checks is_canceled() before set_succeeded. Also adds X-Prediction-Id header to uploads and a distinct timeout error message.
  • Cargo.toml/Cargo.lock: tokio-util gains the rt feature (needed for AbortOnDropHandle); lock change is consistent.

Key correctness checks I verified:

  • Upload failure → set_failed (with no URL/token leak via without_url()), and partial list outputs no longer silently succeed. ✓
  • Cancellation: the biased select on cancel_token.cancelled() aborts in-flight uploads (dropping the join_all drops the AbortOnDropHandles) and preserves the canceled status; the is_canceled() check in the sync path correctly handles the case where the orchestrator's cancel handler already removed+aborted the uploads before Done arrives. ✓
  • Ordering: upload tasks append output before returning Ok, and the join task awaits all handles before set_succeeded, so no race with take_outputs. ✓
  • Poisoned-mutex edge cases all funnel through try_lock_prediction, which sets failed. ✓
  • No API/schema/IPC protocol changes; tests are deterministic (the 25s real-timeout test is slow but bounded and exercises the intended behavior).

I found no actionable defects in the logic, error handling, or tests.

LGTM

github run

The cancellation regression requires an in-flight upload connection to
close before its request timeout, catching detached upload tasks even
when the prediction reports canceled.

Update Rustls to 0.23.46 to resolve the security advisories blocking CI.
@ask-bonk

ask-bonk Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@michaeldwan
michaeldwan added this pull request to the merge queue Oct 16, 2026
Merged via the queue into main with commit d2b13a0 Oct 16, 2026
45 checks passed
@michaeldwan
michaeldwan deleted the md/fix-output-upload branch October 16, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants