fix: validate timeouts and clean up cancellation - #16
Merged
Salil Das (sadlilas) merged 1 commit intoAug 18, 2026
Merged
Conversation
Generated with Amplifier Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Salil Das (sadlilas)
force-pushed
the
fix/timeout-validation-cancellation
branch
from
August 18, 2026 03:41
996002f to
6797e95
Compare
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.
Summary
1..3600range, with schema bounds and a milliseconds hintCancelledErrorIncident class
A value such as
1200000, intended as milliseconds, was previously accepted as 1,200,000 seconds (nearly 14 days). That could leave a command running far beyond the caller's intent. The tool now rejects values outside1..3600seconds and suggests the plausible seconds value when an oversized integer looks like milliseconds.Cleanup behavior and platform limits
Foreground timeout and cancellation now use the same bounded cleanup path. On Unix, the command process group is terminated and reaped. On Linux, cleanup additionally walks
/procbefore signaling to find descendants that escaped the original process group viasetsid().Detached-descendant discovery is necessarily best-effort and Linux-specific: it depends on
/procand a preserved PPID chain at snapshot time. Other Unix platforms still receive process-group cleanup, but cannot use this Linux/procfallback; Windows retains main-process cleanup behavior.Verification
Related delegate watchdog: microsoft/amplifier-foundation#298. The delegate-side watchdog and this tool-side validation/cleanup provide defense in depth.