Skip to content

Conversation

@rmcdaniel
Copy link
Contributor

@rmcdaniel rmcdaniel commented Jul 11, 2025

This PR adds support for “continue as new” workflows, updating core classes, model relations, and tests to enable workflows to restart with new input through a ContinuedWorkflow marker.

  • Introduces WorkflowContinuedStatus and a Continues trait to emit a ContinuedWorkflow and transition to the continued state.
  • Updates Workflow, WorkflowStub, and StoredWorkflow to handle active/continued workflows, plus new root/active relations.
  • Adds fixtures and feature tests for continue-as-new, and adjusts CI/env settings to account for failed queue tables.

@rmcdaniel rmcdaniel requested a review from Copilot July 12, 2025 03:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/States/WorkflowContinuedStatus.php Adds new continued status class
src/Traits/Continues.php Implements continueAsNew() logic and promise marker
src/Models/StoredWorkflow.php Adds continuedWorkflows relation and root/active methods
src/Workflow.php Handles ContinuedWorkflow in handle()
src/WorkflowStub.php Routes calls to the active workflow instance
tests/Fixtures/TestContinueAsNewWorkflow.php New fixture for continue-as-new workflow
tests/Feature/ContinueAsNewWorkflowTest.php Feature test validating continue-as-new behavior
tests/Unit/States/WorkflowStatusTest.php Updates state config test to include continued status
tests/TestCase.php Registers failed queue table migration
tests/.env.unit, tests/.env.feature Defines QUEUE_FAILED_DRIVER=null
.github/workflows/php.yml Exports QUEUE_FAILED_DRIVER in CI and adds log artifact
Comments suppressed due to low confidence (1)

.github/workflows/php.yml:78

  • Quoting "null" makes it a string in the CI environment. Remove the quotes so that the runner interprets it as a true null value.
        QUEUE_FAILED_DRIVER: "null"

@travisaustin
Copy link

It seems that this works well if continueAsNew() is called from a "root" workflow, but not from a child workflow. If continueAsNew() is used in a child workflow, the child workflow completes successfully but the calling worklow is never dispatched again to continue it's processing.

@travisaustin
Copy link

I found a solution and created #248. I don't know if this is how you'd prefer to do it, but this seems to work. I also haven't written any tests for it, but maybe this will be helpful for you.

@rmcdaniel
Copy link
Contributor Author

Thanks! I will get some time to review this tonight. For the most part, I want to follow Temporal's established patterns to maximize compatibility between the two but we can deviate a little if it makes sense. I'm trying to figure out if Temporal supports continueAsNew with child workfllows but it doesn't look like it.

@travisaustin
Copy link

Ah, that's interesting that Temporal has that constraint. I appreciate your looking into it.

fix: child workflows that call continueAsNew were not dispatching parent workflow at completion
@rmcdaniel
Copy link
Contributor Author

@travisaustin I merged in your PR with some changes in the placement of your logic. Everything seems to be working for child workflows as well now.

@travisaustin
Copy link

Hey @rmcdaniel! Thanks again for adding this.

Is there any chance you'll include this in an upcoming release?

@rmcdaniel
Copy link
Contributor Author

@travisaustin Yes sir! I'll try to get it out this weekend.

@rmcdaniel rmcdaniel merged commit f18ab4b into master Aug 31, 2025
2 checks passed
@rmcdaniel rmcdaniel deleted the feature/continue-as-new branch August 31, 2025 12:46
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.

3 participants