Warn when launch timeout is set below the recommended minimum - #1000
Open
om7057 wants to merge 2 commits into
Open
Warn when launch timeout is set below the recommended minimum#1000om7057 wants to merge 2 commits into
om7057 wants to merge 2 commits into
Conversation
SSHConnector.doCheckLaunchTimeoutSeconds only rejected negative or non-numeric values. A small but positive value, for example 1 second, passed validation silently even though it is known to make agent connections flaky, since it does not leave enough time for the SSH handshake and remoting handshake to complete. This adds a warning, not an error, when the value is positive but below the plugin's own default of 60 seconds, so the behavior of existing configurations with an intentionally low timeout is not changed. The value itself is not modified. The check lives in SSHConnector rather than SSHLauncher because SSHLauncher's own config.jelly delegates rendering of this field to SSHConnector's config.jelly and descriptor, so this single check already covers both the SSHConnector and SSHLauncher configuration UIs. Fixes jenkinsci#899
There was a problem hiding this comment.
Pull request overview
This PR improves configuration-time validation for SSH agent launch timeouts by warning (rather than failing) when users enter a positive timeout below the plugin’s recommended minimum (the default 60s), addressing flakiness reported in #899 while preserving existing runtime behavior.
Changes:
- Add a
FormValidation.Kind.WARNINGwhenlaunchTimeoutSecondsis positive but belowDEFAULT_LAUNCH_TIMEOUT_SECONDS. - Add a localized warning message for the new validation outcome.
- Add a focused regression test suite covering warning/ok/error cases for the launch timeout field.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/hudson/plugins/sshslaves/SSHConnector.java | Adds a warning for low positive launch timeout values during descriptor form validation. |
| src/main/resources/hudson/plugins/sshslaves/Messages.properties | Adds the new i18n message used for the low-timeout warning. |
| src/test/java/hudson/plugins/sshslaves/SSHConnectorTest.java | Adds regression tests covering the new warning behavior and existing error/ok cases. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Makes the Stapler binding for this parameter explicit rather than relying on retained debug parameter names, matching the other doCheck methods in this file. Suggested by review.
Author
|
Applied in 5497fa2, thanks for the catch. |
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.
Fixes #899
SSHConnector.doCheckLaunchTimeoutSecondsonly rejected negative or non-numeric values. A small but positive value, for example 1 second, passed validation silently even though it is known to make agent connections flaky, since it does not leave enough time for the SSH handshake and the remoting handshake to complete.This adds a warning, not an error, when the value is positive but below the plugin's own default of 60 seconds (
SSHLauncher.DEFAULT_LAUNCH_TIMEOUT_SECONDS). The behavior of existing configurations that intentionally use a low timeout is not changed, and the value itself is not modified, only a warning is shown on the configuration page.I deliberately did not enforce a hard floor by clamping the value, since
SSHLauncherTest.timeoutAndRetrySettingsalready asserts that an explicit value like 39 seconds is honored exactly, and other tests confirm only non-positive values fall back to the default. Silently overriding a user-supplied value below 60 would have broken that existing, intentional behavior.The check lives in
SSHConnectorrather thanSSHLauncher.SSHLauncher's ownconfig.jellyonly renders thehostfield directly and delegates rendering of every other field, includinglaunchTimeoutSeconds, toSSHConnector'sconfig.jellyand descriptor via<st:include page="config.jelly" class="${descriptor.sshConnectorClass}"/>. So this single check inSSHConnector.DescriptorImplalready covers both theSSHConnector-based cloud connector UI and theSSHLauncher-based permanent agent UI.Testing done
Added
SSHConnectorTestwith 7 cases covering: below minimum (warning), at minimum (ok), above minimum (ok), blank (ok), negative (error), not a number (error), and zero (ok, since zero is handled separately by falling back to the default elsewhere and should not also warn here).Ran the full existing test suite locally on JDK 25 (matching this repo's linux CI leg): all passing, including
SSHLauncherTest.timeoutAndRetrySettingswhich confirms this change does not alter the existing timeout value behavior. Also verified./mvnw spotless:checkpasses clean.Submitter checklist