Repository navigation
Harden execution-scoped nested workflow authority - #296
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens nested-workflow authority resolution by moving caching and coordination into a dedicated per-execution scope, ensuring correct behaviour under environment reuse and concurrent child lookups while tightening for_each fail-fast policy validation.
Changes:
- Introduces
WorkflowExecutionScopeand threads it through workflow execution so nested-workflow authority resolution is cached per top-level run (and shared with nested children) instead of living on reusable environments. - Adds per-key single-flight locking to avoid duplicate concurrent authority loads for the same nested-workflow key while allowing unrelated keys to proceed concurrently.
- Rejects invalid
workflow_control.for_eachcombinations (stop_on_error=truewithsuccess_policy=allow_partial) before attempting child definition resolution, with tests and manual documentation updated accordingly.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/backend/test_nested_workflow_actor_authority.py | Adds regressions for execution-scope caching, single-flight concurrency, and environment reuse across top-level runs. |
| tests/backend/test_control_flow_actions.py | Adds a regression ensuring invalid for_each policy combinations fail before child lookup. |
| src/backend/workflows/engine.py | Creates/owns a per-run WorkflowExecutionScope and propagates it through action execution paths. |
| src/backend/workflows/durable/subworkflow_actions.py | Passes execution scope into nested workflow definition resolution and nested executor runs. |
| src/backend/workflows/durable/nested_workflow_authority.py | Switches caching/locking from environment-local to execution-scope single-flight per cache key. |
| src/backend/workflows/durable/durable_executor.py | Establishes an execution scope for durable runs and propagates it into state execution. |
| src/backend/workflows/durable/control_flow_actions.py | Validates for_each policy earlier and propagates execution scope to nested runs/resolution. |
| src/backend/workflows/action_registry.py | Defines WorkflowExecutionScope and plumbs optional scope through WorkflowActionRequest and ActionRegistry.execute. |
| docs/engineering/von_workflow_language_manual.md | Documents the strengthened for_each contract for stop_on_error and partial success. |
| def test_nested_resolution_single_flights_concurrent_same_key( | ||
| monkeypatch, | ||
| ) -> None: | ||
| import src.backend.workflows.durable.registry_factory as registry_factory |
| def test_reused_environment_rechecks_authority_for_each_top_level_run( | ||
| monkeypatch, | ||
| ) -> None: | ||
| import src.backend.workflows.durable.registry_factory as registry_factory |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up hardening for JVNAUTOSCI-2592 after PR #295.
This change:
workflow_control.for_eachconfigurations that combinestop_on_error=truewithsuccess_policy=allow_partialbefore child lookup;Validation:
git diff --checkpassed.The unrelated untracked
uv.lockis not included.