Skip to content

Set workflow services stuck in running state to finished#6337

Merged
6543 merged 3 commits into
woodpecker-ci:mainfrom
samoli:fix_workflow_stuck_running
Mar 30, 2026
Merged

Set workflow services stuck in running state to finished#6337
6543 merged 3 commits into
woodpecker-ci:mainfrom
samoli:fix_workflow_stuck_running

Conversation

@samoli
Copy link
Copy Markdown
Contributor

@samoli samoli commented Mar 28, 2026

When a workflow includes service steps, the workflow and pipeline status is permanently stuck as "running" in the database after all steps had finished.

completeChildrenIfParentCompleted was called after UpdateWorkflowStatusToDone, so the status calculation still saw service steps as running. The in-memory step state also wasn't updated after the database update.

The fix moves child completion before the status calculation and syncs the in-memory state so WorkflowStatus sees the finalized step states.

I think this bug was possibly introduced in #6011

samoli added 2 commits March 28, 2026 09:44
When a workflow includes service steps, the workflow and pipeline status is permanently stuck as "running" in the database after all steps had finished.

completeChildrenIfParentCompleted was called after UpdateWorkflowStatusToDone, so the status calculation still saw service steps as running. The in-memory step state also wasn't updated after the database update.

The fix moves child completion before the status calculation and syncs the in-memory state so WorkflowStatus sees the finalized step states.

I think this bug was introduced in the refactoring in woodpecker-ci#6011
Copy link
Copy Markdown
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this pull has good ideas.

but the bug you wana fixed is already adressed in #6320

I would say we let it open till that one is merged and then check again if it's needed :)

@6543 6543 added the blocked something external is blocking it label Mar 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 28, 2026

Codecov Report

❌ Patch coverage is 40.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.14%. Comparing base (e31a6bc) to head (b3c296e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
server/rpc/rpc.go 40.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6337      +/-   ##
==========================================
+ Coverage   34.12%   34.14%   +0.01%     
==========================================
  Files         423      423              
  Lines       28460    28466       +6     
==========================================
+ Hits         9712     9719       +7     
+ Misses      17862    17859       -3     
- Partials      886      888       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@samoli
Copy link
Copy Markdown
Contributor Author

samoli commented Mar 28, 2026

Ah nice, didn’t see that. Thanks.

I’ll test again when #6320 is merged.

@6543 6543 added the bug Something isn't working label Mar 28, 2026
@6543
Copy link
Copy Markdown
Member

6543 commented Mar 30, 2026

ok now the refactoring is merged and i finished #6320 ... this works in the same domain but it looks like it solves something different 😅

@6543 6543 removed the blocked something external is blocking it label Mar 30, 2026
@6543
Copy link
Copy Markdown
Member

6543 commented Mar 30, 2026

well #6263 should make it so the final done is only returned once the detached/services did report back there status.

still this here is a nice bugfix, fixing it now and harden the server later on :)

@6543 6543 enabled auto-merge (squash) March 30, 2026 13:11
@6543 6543 changed the title Fix workflow with services stuck in running state Set workflow services stuck in running state to finished Mar 30, 2026
@6543 6543 added the server label Mar 30, 2026
@6543 6543 merged commit 855eae1 into woodpecker-ci:main Mar 30, 2026
7 checks passed
This was referenced Mar 30, 2026
@woodpecker-bot woodpecker-bot mentioned this pull request Apr 15, 2026
1 task
@woodpecker-bot woodpecker-bot mentioned this pull request Apr 27, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants