feat: pass Graph client timeout through Connect-Maester - #2098
Conversation
… avoid false positives with MD double newline fix
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…local dev testings without risk of committing to repo
… Invoke-Maester before Discov ery & Invoke
…owed range, working on calls)
…econds and cross reference in FAQ
…/github.com/blindzero/maester into fix/2079-longrunning-clienttimeoutparameter
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesMicrosoft Graph client timeout
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to The PR adds an optional, run-scoped Graph timeout override while preserving existing defaults and restoring the prior timeout afterward. Documentation and tests are included, and no actionable merge-blocking risk remains beyond normal checks and review. Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant MaesterCaller
participant ConnectMaester
participant ConnectMgGraph
MaesterCaller->>ConnectMaester: provide optional ClientTimeout
ConnectMaester->>ConnectMgGraph: forward ClientTimeout when supplied
ConnectMgGraph-->>ConnectMaester: establish Graph connection
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@website/docs/configuration/overview.md`:
- Line 92: Update the GraphRequestTimeoutSeconds entry in the configuration
table to use complete sentences and explicitly document that accepted values
range from 1 to 3600 seconds, while retaining the existing override guidance for
Invoke-Maester.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e50ad7dc-ad97-4122-b2a6-f177bdb60e9d
📒 Files selected for processing (6)
.gitignorepowershell/public/Invoke-Maester.ps1powershell/tests/functions/Invoke-Maester.Tests.ps1tests/maester-config.jsonwebsite/docs/configuration/overview.mdwebsite/docs/faq.md
There was a problem hiding this comment.
Pull request overview
Adds a configurable Microsoft Graph request timeout to address failures in long-running Maester tests that can exceed the Graph SDK’s default 300s timeout, with support for config-based defaults and an Invoke-Maester CLI override.
Changes:
- Introduces
-GraphRequestTimeoutSecondsonInvoke-Maesterand applies it viaSet-MgRequestContext -ClientTimeout. - Adds
GlobalSettings.GraphRequestTimeoutSeconds(default 300) to the maintests/maester-config.json, with override behavior covered by new unit tests. - Updates website documentation (FAQ + configuration overview) and ignores
tests/Custom/maester-config.jsonto prevent committing org-specific overrides.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
website/docs/faq.md |
Documents how to resolve Graph timeout failures using the new parameter or custom config. |
website/docs/configuration/overview.md |
Lists GraphRequestTimeoutSeconds as an available global setting. |
tests/maester-config.json |
Adds the new setting to the default config template with a default of 300 seconds. |
powershell/tests/functions/Invoke-Maester.Tests.ps1 |
Adds unit tests covering precedence and validation behavior for the timeout setting. |
powershell/public/Invoke-Maester.ps1 |
Implements the new parameter and resolves/validates config + parameter precedence before running tests. |
.gitignore |
Prevents committing tests/Custom/maester-config.json (user/org-specific overrides). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…onds Parameter Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…pmessage Co-authored-by: Sam Erde <20478745+SamErde@users.noreply.github.com>
…message for value between 1 - 3600
|
@blindzero thank you for raising this PR, really appreciate the work done here. Given our imminent re-write in Maester 3.0, I want to avoid adding too much complexity to Invoke-Maester. So I have switched to a simpler workaround using Connect-Maester and passing the ClientTimeout directly. The ideal config I want to have is for the timeout to be defined at a per test level and then we can have the Maester 3.0 engine dynamically setting the timeout on an as-needed basis. Would you be able to test the latest PR and let me know if that solves your current issue with the timeout? |
|
Going ahead and merging since I haven't heard back in a few days. |
📑 Description
Closes #2079
Long-running tests can exceed the Microsoft Graph PowerShell SDK's default HTTP client timeout. This PR adds an optional
-ClientTimeoutparameter toConnect-Maesterand forwards it directly toConnect-MgGraph.Callers that manage their own Graph connection, including those using
Invoke-Maester -SkipGraphConnect, can use the native SDK parameter directly:Behavior
-ClientTimeoutis omitted,Connect-MgGraphuses its existing SDK default.maester-config.jsontimeout setting.Invoke-Maesterdoes not read or mutate the global Graph request context.Invoke-MgGraphRequestdoes not expose a per-request timeout.✅ Checks
Connect-Maestertests: 11 passedmainSummary by CodeRabbit
New Features
ClientTimeoutsetting to configure Microsoft Graph request timeouts when connecting.Documentation