bug(checkpoints): never hang on Read-Host in non-interactive RMM runs#100
Closed
Gumbees wants to merge 1 commit into
Closed
bug(checkpoints): never hang on Read-Host in non-interactive RMM runs#100Gumbees wants to merge 1 commit into
Gumbees wants to merge 1 commit into
Conversation
… session Symptom: the aging script started under NinjaRMM and hung with no output. That is Read-Host waiting for input that never comes -- reached because the RMM-mode gate (`if ($env:RMM -ne "1")`) evaluated the run as interactive (e.g. the preset variable wasn't seen as "1" by the deployed copy). Harden the gate to also require an interactive session: `if ($env:RMM -ne "1" -and [Environment]::UserInteractive)`. NinjaRMM runs scripts non-interactively (UserInteractive = $false), so a missing/renamed RMM variable now falls through to RMM mode with safe defaults instead of hanging. A real interactive tech run still prompts. Applied to both checkpoint scripts. No other logic/exit-code changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, push a new commit or reopen this pull request to trigger a review.
Contributor
Author
|
Superseded by #105, which removes the $env:RMM variable entirely and gates purely on [Environment]::UserInteractive (the final form of this change). |
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.
Problem (observed in production)
Run Windows Hyper-V Checkpoint Agingstarted under NinjaRMM (Variables:rmm = 1) and hung with no output — never finished.No output before the hang = it reached
Read-Hostand is waiting for keyboard input that never arrives in an unattended RMM session. It got there because the RMM-mode gateif ($env:RMM -ne "1")didn't evaluate as RMM mode (the deployed copy isn't seeing the preset as"1").Fix
Require an interactive session before ever prompting:
NinjaRMM runs scripts non-interactively (
[Environment]::UserInteractiveis$false), so even if the RMM variable is missing/renamed/not seen, the script now falls through to RMM mode and completes instead of blocking. A genuine interactive run by a tech still prompts. Applied to both checkpoint scripts. No other logic or exit-code changes.Your earlier run did read
$env:RMM = 1and completed, so the copy hanging now is very likely a stale version in the NinjaOne Script Library, notmain. After merging, update both scripts in NinjaOne → Scripting → Library frommain— otherwise the old hanging copy keeps running.Testing
[Parser]::ParseFileclean on both.🤖 Generated with Claude Code