Dev#23
Merged
Merged
Conversation
Introduce watchdog and improved task lifecycle handling: add active task tracking, per-task timeout resolution (payload key `timeout_minutes`), default/max timeouts, and a watchdog that cancels overdue tasks. Register watchdog from TaskManager. Propagate task contexts so downloads and script execution honor task timeouts. Add graceful subprocess shutdown by setting cmd.WaitDelay (30s) on macOS, Linux and Windows executors so processes have time to exit after cancellation. Implement restart context support: new restartctx package for atomic pending_restart.json handling, write/clear logic in agent-update and a new reboot-device native handler that records restart context before rebooting. Polling now handles restart context on startup and marks the triggering task as success so planned restarts are not treated as interrupted failures. Other changes: minor refactors and registration of activeRunning map with synchronization to manage cancels. (Also removes an extraneous spreadsheet file.)
Add a large suite of unit tests for httpx, sanitize, task executor, native task handlers (agent-update, reboot-device, sync-inventory, sync-software), registry and polling restart logic. Introduce injectable function variables to improve testability and avoid OS/network side effects: checkAndApplyFn, rebootFn, collectSysInfoFn, updateAgentInfoFn, sendSoftwareFn, getSoftwareListFn. Update sync handlers to use the injected functions and adjust polling to report retryable tasks before resetting old failures. Various helper tests added to exercise timeout, cancellation, restart-context and concurrency edge cases.
|
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.


No description provided.