Skip to content

Fix M8: ensure FINISHED status only after successful score upload#2424

Open
hanane-ca wants to merge 1 commit into
codalab:developfrom
hanane-ca:fix/m8-finished-must-have-scores
Open

Fix M8: ensure FINISHED status only after successful score upload#2424
hanane-ca wants to merge 1 commit into
codalab:developfrom
hanane-ca:fix/m8-finished-must-have-scores

Conversation

@hanane-ca

@hanane-ca hanane-ca commented Jun 17, 2026

Copy link
Copy Markdown

Reviewers

@codalab/maintainers

Description

Fixes a data integrity bug where submissions could be marked as Finished without having scores or outputs uploaded.

Problem: The compute worker set the submission status to FINISHED before uploading scores and outputs. If the upload failed (network error, timeout, API failure), the submission remained Finished with no data.

Root cause: Status update and result upload were decoupled in the workflow.

Solution:

  1. Reorder operations: upload scores and outputs before setting FINISHED status
  2. Add retry logic to score upload (3 attempts with exponential backoff)
  3. Add HTTP status validation and explicit timeouts

Code changes:

  • compute_worker/compute_worker.py:

    • Moved _update_status(FINISHED) to run_wrapper() after successful uploads
    • Enhanced push_scores() with retry logic (3 attempts, exponential backoff, HTTP validation, 30s timeout)
    • Cleaned up inline comments per Codabench guidelines
  • tests/k6/:

    • Integration test suite to verify integrity invariant
    • All test documentation included

Issues this PR resolves

Fixes #2423

Background

This fix addresses a submission lifecycle bug discovered during the EEG Foundation Challenge incident analysis:

  • Data fingerprint: "finished-but-no-score reports" in production
  • Impact: Data integrity violations where submissions showed Finished status but had no results
  • Root cause: Fire-and-forget upload pattern after status update

The fix ensures the invariant: status == Finished ⟹ scores exist

Checklist for hand testing

  • Create a competition with scoring program
  • Submit 10 scoring submissions
  • Verify all Finished submissions have scores
  • Optional: Simulate network failure during score upload to verify retry logic

Relevant files for testing

Integration test suite in tests/k6/:

  • test_m8_finished_has_scores.js — K6 test script
  • run_m8_test.sh — Test orchestrator
  • README_finished_has_scores.md — Test documentation

Run tests:

cd tests/k6
./run_m8_test.sh

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 Didayolo self-requested a review June 18, 2026 09:28
@Didayolo Didayolo self-assigned this Jun 18, 2026
…e upload

Problem:
- compute_worker set status to FINISHED before uploading scores
- If push_scores() failed (network, timeout, API error), submission
  stayed Finished with no scores → data integrity violation

Solution:
- Move _update_status(FINISHED) to AFTER push_scores() and push_output()
- Add retry logic to push_scores() with 3 attempts and exponential backoff
- Add HTTP status validation and explicit 30s timeout

Changes:
- compute_worker/compute_worker.py:
  * Removed _update_status(FINISHED) from start() method
  * Added _update_status(FINISHED) after successful uploads in run_wrapper()
  * Enhanced push_scores() with retry logic and error handling
  * Cleaned up comments to be code-focused (removed M8 references)

- tests/k6/:
  * test_m8_finished_has_scores.js: K6 test for integrity invariant
  * run_m8_test.sh: Bash test orchestrator
  * README_finished_has_scores.md: Test documentation
  * All test files cleaned up (removed M8 references per guidelines)

Test validates:
- finished_without_scores == 0 (integrity invariant)
- conservation_rate == 100% (all submissions terminal)

Fixes codalab#2423
@hanane-ca hanane-ca force-pushed the fix/m8-finished-must-have-scores branch from 487fb00 to 24b3ce0 Compare June 19, 2026 08:08
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.

Data integrity: score or leaderboard write fails after Finished status

3 participants