Skip to content

🔧 29571 backend [workflows] Allow resume ended workflows#266

Open
andrey-usov wants to merge 1 commit into
masterfrom
backend/workflows/29571__allow_resume_ended_workflows
Open

🔧 29571 backend [workflows] Allow resume ended workflows#266
andrey-usov wants to merge 1 commit into
masterfrom
backend/workflows/29571__allow_resume_ended_workflows

Conversation

@andrey-usov

@andrey-usov andrey-usov commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Problem

POST /workflows/:id/resume only worked for snoozed (DELAYED) workflows. Calling it for a finished workflow (WorkflowStatus.DONE) returned 400 with MSG_PW_0017 (“Completed workflow cannot be changed.”). Users need to bring a completed workflow back to RUNNING via API and the Resume control in the UI.

Fix / Solution

  • Allow POST /workflows/:id/resume for WorkflowStatus.DONE.
  • In force_resume_workflow, remove the completed-workflow guard, clear date_completed, set status to RUNNING, and keep existing delayed-task resume / notification / FORCE_RESUME log behavior.
  • Show the Resume button for finished workflows in WorkflowControlls.
  • Update and extend backend tests for service and API resume paths.

Release notes

Finished workflows can be resumed from the workflow menu and via POST /workflows/:id/resume, returning the workflow to Running without using return-to-task.

Changes

Summary

  • Allow POST /workflows/:id/resume for WorkflowStatus.DONE.
  • Backend: force_resume_workflow clears date_completed and sets RUNNING.
  • Frontend: Resume button for finished workflows.
  • Tests added/updated for service and view resume flows.
  • Manual testing passed (backend API, UI after frontend rebuild).

API

  • POST /workflows/:id/resume accepts finished (DONE) workflows and returns 200 with status=RUNNING and date_completed=null.

Web-client

  • Resume is available for finished workflows in workflow controls (same entry point as snoozed resume).

Test plan

Automated (pytest)

  • src/processes/tests/test_services/test_workflow_action_service.pyforce_resume cases for DONE (including rewritten completed-workflow test).
  • src/processes/tests/test_views/test_workflow/test_resume.py — API resume for DONE workflows.
  • Regression: delayed resume, running no-op, auth/permission, resume_task still rejects completed workflow on Celery path.

Suggested commands:

make test-backend ARGS="src/processes/tests/test_views/test_workflow/test_resume.py -vv"
make test-backend ARGS="src/processes/tests/test_services/test_workflow_action_service.py -k force_resume -vv"

Manual

  • Complete a workflow, call POST /workflows/:id/resume200, workflow Running, date_completed cleared.
  • Rebuild frontend, open a finished workflow — Resume visible and succeeds.

Made with Cursor

Note

Allow resume for completed workflows in addition to snoozed workflows

  • WorkflowActionService.force_resume_workflow previously raised ResumeCompletedWorkflow when called on a completed workflow; it now sets status to RUNNING and clears date_completed instead.
  • The frontend resume control in WorkflowControlls.tsx now enables the Resume button for workflows in Finished status, not only Snoozed.
  • Behavioral Change: resuming a completed workflow no longer errors — callers that expected ResumeCompletedWorkflow to be raised will no longer receive it.
📊 Macroscope summarized 4841730. 2 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

Enable POST /workflows/:id/resume for WorkflowStatus.DONE by clearing
date_completed and returning to RUNNING; show Resume in UI for finished
workflows.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andrey-usov andrey-usov changed the title 29571 Workflows [ Backend, Frontend ] Allow resume for ended workflows 🔧 29571 backend [workflows] Allow resume ended workflows Jul 10, 2026
@andrey-usov andrey-usov requested a review from EBirkenfeld July 10, 2026 12:34
@andrey-usov andrey-usov added the Backend API changes request label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend API changes request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant