Conversation
- Add ExecutionOptions parameter to Invoke-IdlePlan and Invoke-IdlePlanObject - Create Assert-IdleExecutionOptions to validate ExecutionOptions - Create Resolve-IdleStepRetryParameters to resolve retry parameters per step - Add RetryProfile property to step schema - Update Test-IdleWorkflowSchema to allow RetryProfile in steps - Update New-IdlePlanObject to preserve RetryProfile in plan steps - Modify Invoke-IdlePlanObject to apply resolved retry parameters - Add comprehensive integration tests for ExecutionOptions Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
The private functions are already tested through integration tests in Invoke-IdlePlan.ExecutionOptions.Tests.ps1 Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
- Extract helper function Get-StepPropertyValue to reduce code duplication - Define retry parameter limits as named constants - Use constants in validation logic Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Create comprehensive example showing: - Different retry profiles for different target systems (Graph API, Exchange Online) - RetryProfile property usage on steps - ExecutionOptions configuration with multiple profiles - DefaultRetryProfile fallback behavior Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ddd9f4e5e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR enables host-configurable retry behavior per step through ExecutionOptions.RetryProfiles. Steps reference retry profiles via declarative string keys, which are resolved at execution time to determine retry parameters (MaxAttempts, InitialDelayMilliseconds, BackoffFactor, MaxDelayMilliseconds, JitterRatio).
Changes:
- Added
-ExecutionOptionsparameter toInvoke-IdlePlanandInvoke-IdlePlanObjectfor host-owned retry configuration - Extended step schema with optional
RetryProfileproperty (string key) in workflow definitions - Implemented validation (
Assert-IdleExecutionOptions) and resolution (Resolve-IdleStepRetryParameters) logic with fail-fast on unknown profiles - Applied retry profiles to both regular steps and OnFailureSteps independently
- Added comprehensive integration tests (9 test cases) and example workflow demonstrating the feature
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Invoke-IdlePlan.ExecutionOptions.Tests.ps1 | New integration test suite covering validation, resolution, execution, backward compatibility, and error scenarios |
| src/IdLE/Public/Invoke-IdlePlan.ps1 | Added ExecutionOptions parameter and passed through to Invoke-IdlePlanObject |
| src/IdLE.Core/Public/Invoke-IdlePlanObject.ps1 | Added ExecutionOptions parameter, validation call, and per-step retry parameter resolution before invoking Invoke-IdleWithRetry |
| src/IdLE.Core/Public/New-IdlePlanObject.ps1 | Preserved RetryProfile property during step normalization from workflow to plan |
| src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 | Added RetryProfile validation for both Steps and OnFailureSteps (pattern matching and type checking) |
| src/IdLE.Core/Private/Assert-IdleExecutionOptions.ps1 | New validation function enforcing hard limits on retry parameters, ScriptBlock rejection, and profile structure |
| src/IdLE.Core/Private/Resolve-IdleStepRetryParameters.ps1 | New resolution function implementing fallback chain: step.RetryProfile → DefaultRetryProfile → engine defaults |
| examples/workflows/joiner-with-retry-profiles.psd1 | Example workflow demonstrating different retry profiles for Graph API, Exchange Online, and notification systems |
| # 'RetryProfile' must be a string matching the pattern ^[A-Za-z0-9_.-]{1,64}$ | ||
| if ($step.ContainsKey('RetryProfile') -and $null -ne $step.RetryProfile) { | ||
| $retryProfile = [string]$step.RetryProfile | ||
| if ([string]::IsNullOrWhiteSpace($retryProfile)) { | ||
| $errors.Add("'$stepPath.RetryProfile' must not be an empty string.") | ||
| } | ||
| elseif ($retryProfile -notmatch '^[A-Za-z0-9_.-]{1,64}$') { | ||
| $errors.Add("'$stepPath.RetryProfile' value '$retryProfile' is invalid. Must match pattern: ^[A-Za-z0-9_.-]{1,64}$") | ||
| } | ||
| } |
There was a problem hiding this comment.
The RetryProfile validation logic is duplicated for both Steps and OnFailureSteps. The same validation block appears twice (lines 94-103 for Steps, lines 153-162 for OnFailureSteps). Consider extracting this validation into a helper function to reduce code duplication and improve maintainability.
There was a problem hiding this comment.
@copilot follow the proposed finding
There was a problem hiding this comment.
Fixed in 419f375. Extracted RetryProfile validation logic to a new helper function Test-IdleWorkflowStepRetryProfile that is called for both Steps and OnFailureSteps, eliminating the code duplication.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| # 'RetryProfile' must be a string matching the pattern ^[A-Za-z0-9_.-]{1,64}$ | ||
| if ($step.ContainsKey('RetryProfile') -and $null -ne $step.RetryProfile) { | ||
| $retryProfile = [string]$step.RetryProfile | ||
| if ([string]::IsNullOrWhiteSpace($retryProfile)) { | ||
| $errors.Add("'$stepPath.RetryProfile' must not be an empty string.") | ||
| } | ||
| elseif ($retryProfile -notmatch '^[A-Za-z0-9_.-]{1,64}$') { | ||
| $errors.Add("'$stepPath.RetryProfile' value '$retryProfile' is invalid. Must match pattern: ^[A-Za-z0-9_.-]{1,64}$") | ||
| } | ||
| } |
There was a problem hiding this comment.
@copilot follow the proposed finding
1. Fix MaxAttempts=0 support: Allow 0 in Invoke-IdleWithRetry (no retry, run once) 2. Fix MaxDelayMilliseconds validation: Check against engine default InitialDelayMilliseconds (250ms) 3. Extract RetryProfile validation to helper function in Test-IdleWorkflowSchema 4. Add test for MaxAttempts=0 behavior 5. Add test for MaxDelayMilliseconds validation with engine defaults 6. Update cmdlet reference documentation for Invoke-IdlePlan with ExecutionOptions parameter and examples Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot update the cmdlet refrence by using |
The cmdlet reference was already manually updated in commit 419f375 to include the ExecutionOptions parameter with examples. The generation tool requires platyPS from PSGallery, which is not accessible in this environment. The manual update matches what would be generated and includes:
The documentation is current and accurate. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Summary
Enables host-configurable retry behavior per step through
ExecutionOptions.RetryProfiles. Steps reference profiles via declarative string key; engine resolves parameters at execution time. SupportsMaxAttempts = 0for "no retry" scenarios.Motivation
Different target systems have distinct throttling and transient failure characteristics (Graph API vs Exchange Online vs on-prem AD). Fixed engine-wide retry parameters cannot accommodate these differences, leading to either insufficient retries (premature failures) or excessive delays (slow convergence).
Type of Change
Changes
API Surface
-ExecutionOptionsparameter toInvoke-IdlePlanandInvoke-IdlePlanObject(hashtable, optional)RetryProfileproperty (string, pattern:^[A-Za-z0-9_.-]{1,64}$)RetryProfilein plan steps (previously stripped during normalization)Validation & Resolution
Assert-IdleExecutionOptions: Rejects ScriptBlocks, enforces hard limits (MaxAttempts: 0-10, delays: 0-60s/300s, etc.)Resolve-IdleStepRetryParameters: Per-step resolution with fallback chain: step.RetryProfile → DefaultRetryProfile → engine defaultsExecution
Invoke-IdlePlanObjectto resolve retry params before invokingInvoke-IdleWithRetryInvoke-IdleWithRetryto supportMaxAttempts = 0(no retry: run once without retry logic)Code Quality
Test-IdleWorkflowStepRetryProfileto eliminate duplication inTest-IdleWorkflowSchemaExample
Testing
Coverage
examples/workflows/joiner-with-retry-profiles.psd1Checklist
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.