Skip to content

Fix submission status updates - #2669

Merged
Didayolo merged 3 commits into
developfrom
fix/2569-submission-status-retry
Nov 25, 2026
Merged

Didayolo merged 3 commits into
developfrom
fix/2569-submission-status-retry

Conversation

@Didayolo

@Didayolo Didayolo commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Contributors

Original contributors: @hanane-ca @kengorogoro-design

Issues resolved

Upgrade instructions

The instance need to be up-to-date. If only the worker is upgraded but not the instance, it could cause bugs.

Problems

  1. Submissions stuck in an old status (Codabench worker is not robust to submission update fail #2569). If the API fails briefly when the worker sends a status update, the submission can stay stuck, for example in "Running".

  2. "Finished" sent before the scores (Data integrity: score or leaderboard write fails after Finished status #2423). The worker marked a submission as Finished before uploading its scores and output. If the upload then failed, the submission still looked Finished but had no scores. The worker also never checked whether the score upload worked.

  3. "Scoring" sent before the predictions. The same problem existed one step earlier. When the server receives "Scoring", it starts the scoring job right away. That could happen before the predictions were uploaded.

  4. Some updates were retried when they should not be. The worker's main HTTP session retried every PATCH request on server errors (500, 502, 503, 504). Some PATCH requests are not safe to send twice: a repeated "Scoring" can start scoring twice. An earlier version of this description said these requests were sent only once, which was not true.

Changes

Compute worker

Retries

  • The main HTTP session no longer retries PATCH requests. It still retries GET and PUT, and it still retries when the connection cannot be opened (the request never reached the server, so this is safe).
  • Status updates that are safe to repeat (Preparing, Running, Awaiting validation, Finished, Failed) are retried: up to 3 attempts, waiting 1s then 2s, on network errors and HTTP 429, 500, 502, 503 and 504.
  • "Scoring" and other one-off updates are sent only once.

Score upload

  • The score upload is now retried the same way, and its result is checked:
    • Success response → OK.
    • 409 "scores already uploaded" → also OK. This happens when the first attempt reached the server but the response was lost, and the worker tried again.
    • Any other error → the submission is marked Failed, with the error in the message.

New order of steps

  • Scoring step: run the scoring program → upload scores → upload output → Finished.
  • With human in the loop: run → Awaiting validation → human approves → send detailed results → upload scores → upload output → Finished (same as before).
  • Prediction step: run → upload predictions → Scoring, so scoring only starts once the predictions are available. This change is in its own part of the diff and can be removed on its own if needed.
  • If an upload or a status update fails, the submission is marked Failed, never Finished.

Small cleanup

  • The submission secret is hidden in the logs.

API

  • Score upload is all-or-nothing. Scores and the leaderboard update are saved in one database transaction. Before, a crash halfway could leave some scores saved, and every retry was then rejected with 409. The submission is also locked during the upload, so two uploads at the same time cannot both get through.
  • "Best submission" leaderboards. This rule only looked at submissions marked Finished. With the new order, a submission is not Finished yet when its scores arrive, so it was ignored; for a first submission the upload crashed (500). Now the submission being scored is also considered, and so is its parent for multi-task submissions once all the other tasks are done. This also fixes the same problem for human-in-the-loop competitions, which already sent Finished after the scores.

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

@Didayolo

Copy link
Copy Markdown
Member Author

The description says urllib3 doesn’t retry PATCH by default. That's true of the default policy, but the worker's session doesn't use the default: its adapter lists allowed_methods=["PATCH", "GET", "PUT"].

I checked with the urllib3 version in the repo (2.8.0): that policy already retries PATCH on 500–504, on connection errors and on read timeouts, up to 4 attempts. For the allowlisted statuses, the PR therefore swaps 4 attempts in the transport layer for 3 attempts in the app. The one real addition is retrying on 429.

@Didayolo
Didayolo force-pushed the fix/2569-submission-status-retry branch from 0a3ded2 to 9f344f3 Compare November 17, 2026 14:00
@Didayolo Didayolo changed the title fix: retry transient submission status updates (#2588) Fix: retry transient submission status updates (#2588) Nov 24, 2026
* fix: retry transient submission status updates

* fix: bound retries and exclude scoring side effects

* fix: package retry helper in compute worker image
@Didayolo
Didayolo force-pushed the fix/2569-submission-status-retry branch from 9f344f3 to 46c39f3 Compare November 24, 2026 16:03
@Didayolo Didayolo changed the title Fix: retry transient submission status updates (#2588) Fix: retry transient submission status updates Nov 24, 2026
@Didayolo

Didayolo commented Nov 24, 2026 •

Copy link
Copy Markdown
Member Author
  • Upload order: the output is now uploaded first and the scores last, right before FINISHED. The tests check this for both normal and HITL runs, and check that a failed output upload never uploads the scores.

  • Lost SCORING update: it now raises an error, so the submission ends Failed instead of stuck in Running. The tests use separate fake sessions, so they also prove that SCORING doesn't go through the retry path and that a 4xx on Preparing still isn't retried.

  • Multi-task race: a sibling that has uploaded its scores counts as done, and the upload view locks the parent row before the child. The new test gives both children scores and checks that each one's upload sees the parent as a candidate.

@Didayolo Didayolo changed the title Fix: retry transient submission status updates Fix submission status updates Nov 25, 2026
@Didayolo
Didayolo merged commit 9d19648 into develop Nov 25, 2026
3 checks passed
@Didayolo
Didayolo deleted the fix/2569-submission-status-retry branch November 25, 2026 11:53
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.

Codabench worker is not robust to submission update fail Data integrity: score or leaderboard write fails after Finished status

2 participants