Repository navigation
fix: The form in the loop body will not pause the outer layer #8222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's my review of the diff:
Issues / Observations
1. Behavior change may break existing callers
Previously,
Signal.BREAKandSignal.FORMwere handled identically (complete withStatus.SUCCESS). NowFORMcompletes with an extrasignal=Signal.FORMargument. Check thatself.complete()actually accepts asignalkeyword — if not defined or if it doesn't propagate the signal upstream correctly, this will raiseTypeErroror silently drop the signal. Confirm the signature and downstream handling of the propagated signal.2. Duplicated
run_timecomputationThe line:
is now duplicated in both branches. Consider factoring it out before the branch, or into a small helper, to reduce drift risk.
3.
Signal.FORMpropagation must be handled by parentThe comment says "propagate interrupt upward, pause parent workflow, resume at position after user submit." Verify:
on_completehandler actually inspects the child's returnedsignal(e.g.,wf_manage.result.signalor wherevercomplete(..., signal=...)stores it).positionso resumption works. If no such resume mechanism exists yet, the new behavior will complete the loop body but not actually pause/resume — it could silently end the loop iteration instead.4.
Status.SUCCESSfor a "paused/awaiting form" state is semantically questionableCompleting with
Status.SUCCESSwhile emittingSignal.FORMconflates "finished successfully" with "interrupted awaiting input." Consider a distinct status (e.g.,Status.PAUSED/Status.AWAITING_FORM) to make the state explicit and avoid mistaking it for a normal completion in metrics/logging.5. Idempotency / repeated submission
If the parent re-invokes the loop body after form submission, ensure
start_timeandrun_timeare not double-counted (run_time is rewritten each time — likely fine, but confirmstart_timeisn't reset on resume).6. Missing test coverage note
This is a control-flow change for interruptions. Ensure tests cover: BREAK path unchanged, FORM path sets the propagated signal, and the parent resumes via
position.7. Minor: readability
An
elifchain would read more clearly than sequentialif ... returnblocks when all conditions are mutually exclusive signals:Summary
Main risks: (a)
complete(signal=...)must exist and be consumed by the parent; (b) the resume-at-position machinery must actually exist, otherwise FORM interruption won't work as intended; (c) usingSUCCESSfor a paused state is misleading. Validate these before merging.