Skip to content

Conversation

@cfsmp3
Copy link
Contributor

@cfsmp3 cfsmp3 commented Dec 27, 2025

Summary

  • Prevent queue_test() from posting "Tests queued" status when a test has already started or completed

Problem

When multiple GitHub Actions workflows complete for the same commit (e.g., Linux build finishes first, then Windows build finishes later), the webhook handler calls queue_test() for ALL platforms each time. This caused completed tests to have their GitHub status overwritten.

Example from CCExtractor/ccextractor#1916:

Time (UTC) State Description
19:14:09 PENDING Loaded variables...
19:14:16 PENDING Running tests
19:46:02 SUCCESS All tests passed
19:47:20 PENDING Tests queued ❌ (Windows build webhook overwrote!)

The test completed successfully, but then the Windows build webhook triggered and called queue_test(linux) again, overwriting the SUCCESS status with "Tests queued".

Solution

Check if the test already has progress entries before posting "Tests queued". If the test has started or completed, skip the GitHub status update.

if len(platform_test.progress) > 0:
    log.info(f"Test {platform_test.id} already has progress, not posting 'Tests queued' status")
    return

Test plan

  • Pre-existing test failures unchanged (10 failures, 6 errors - same as before)
  • Manual verification of logic

🤖 Generated with Claude Code

cfsmp3 and others added 3 commits December 26, 2025 10:51
Replace cron-based polling with an optional Celery task queue system
for faster, more reliable test execution. This architectural improvement
enables event-driven processing, parallel test execution, and better
retry handling.

New files:
- celery_app.py: Celery application factory with Flask context
- mod_ci/tasks.py: Task definitions (start_test, cleanup, pending check)
- install/celery-worker.service: Systemd service for Celery worker
- install/celery-beat.service: Systemd service for Celery beat scheduler
- tests/test_ci/test_tasks.py: Unit tests for Celery functionality

Modified files:
- requirements.txt: Added celery[redis] and redis packages
- config_sample.py: Added Celery configuration options
- mod_ci/controllers.py: Added trigger_test_tasks(), updated add_test_entry()
- install/installation.md: Added Celery setup documentation

Key features:
- USE_CELERY_TASKS feature flag for gradual migration (default: False)
- Parallel mode: cron continues as fallback during transition
- Three task queues: default, test_execution, maintenance
- Periodic tasks via Celery Beat for cleanup and pending test discovery
- Graceful degradation if Celery unavailable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused 'shared_task' import from celery
- Fix import ordering to satisfy isort checks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When multiple GitHub Actions workflows complete for the same commit,
the webhook handler was calling queue_test() for all platforms, even
if a test had already started or completed. This caused the GitHub
status to be overwritten from "All tests passed" back to "Tests queued".

Timeline of the bug:
1. Linux build completes → queue_test(linux) → "Tests queued"
2. Linux test completes → "All tests passed" (SUCCESS)
3. Windows build completes → queue_test(linux) called again
   → "Tests queued" overwrites the SUCCESS status!

Fix: Check if test already has progress before posting "Tests queued".
If the test has any progress entries, skip the status update.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sonarqubecloud
Copy link

@cfsmp3 cfsmp3 merged commit f05dda1 into master Dec 27, 2025
6 checks passed
@cfsmp3 cfsmp3 deleted the fix/prevent-status-overwrite branch December 27, 2025 20:51
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