Skip to content

Conversation

victorges
Copy link
Member

What does this pull request do? Explain your changes. (required)
This pull request introduces an early-exit mechanism during Docker container startup. It prevents the orchestrator from indefinitely waiting for a runner container to become available if it is killed or exits immediately after being launched, allowing for faster detection of failures and subsequent recovery/relaunch attempts.

Specific updates (required)

  • ai/worker/docker.go: Modified dockerWaitUntilRunning to detect and return an error immediately if the container enters a terminal state (e.g., exited, dead, removing) or fails with a non-zero exit code or error without restarting.
  • ai/worker/docker_test.go: Added new unit tests to validate the fail-fast behavior for containers that are exited, dead, or created with a non-zero exit code.

How did you test each of these updates (required)
New unit tests were added to ai/worker/docker_test.go to specifically cover the fail-fast scenarios. These tests mock the Docker client to simulate container inspections returning exited, dead, or created with a non-zero exit code. The tests assert that dockerWaitUntilRunning correctly returns an error in these situations, preventing an indefinite wait. All tests in ai/worker were run locally and passed.

Does this pull request close any open issues?

Checklist:


Open in Cursor Open in Web

Copy link

cursor bot commented Oct 2, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions github-actions bot added go Pull requests that update Go code AI Issues and PR related to the AI-video branch. labels Oct 2, 2025
@victorges victorges marked this pull request as ready for review October 2, 2025 19:07
@victorges victorges changed the title Fix orchestrator runner stall on startup docker: Fix orchestrator runner stall on startup Oct 2, 2025
@victorges victorges changed the title docker: Fix orchestrator runner stall on startup docker: Fix stall when container stopped during creation Oct 2, 2025
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 31.70967%. Comparing base (1bc682a) to head (df1704f).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
ai/worker/docker.go 76.92308% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3769         +/-   ##
===================================================
+ Coverage   31.68993%   31.70967%   +0.01974%     
===================================================
  Files            158         158                 
  Lines          47564       47588         +24     
===================================================
+ Hits           15073       15090         +17     
- Misses         31603       31609          +6     
- Partials         888         889          +1     
Files with missing lines Coverage Δ
ai/worker/docker.go 69.68174% <76.92308%> (+0.53096%) ⬆️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7dff847...df1704f. Read the comment docs.

Files with missing lines Coverage Δ
ai/worker/docker.go 69.68174% <76.92308%> (+0.53096%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@victorges victorges force-pushed the cursor/fix-orchestrator-runner-stall-on-startup-641b branch from acee2a4 to df1704f Compare October 2, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Issues and PR related to the AI-video branch. go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants