From 714b09fa246223fd5191d13828239da171785576 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 28 Sep 2026 10:29:01 +0200 Subject: [PATCH] fix(ssh): never disable the SSH command timeout SSH_COMMAND_TIMEOUT=0 (or an invalid value) removed the time limit of every remote command, and imports could then be marked stale while still running. Use the default of 3600 seconds for values that are not positive. Co-Authored-By: Claude Opus 5.5 --- config/constants.php | 5 +- tests/Feature/SshCommandTimeoutConfigTest.php | 47 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/SshCommandTimeoutConfigTest.php diff --git a/config/constants.php b/config/constants.php index 83b8b22301..6bc8885be2 100644 --- a/config/constants.php +++ b/config/constants.php @@ -1,5 +1,8 @@ [ 'version' => env('COOLIFY_VERSION') ?: '4.4', @@ -79,7 +82,7 @@ return [ 'mux_orphan_reap_enabled' => env('SSH_MUX_ORPHAN_REAP_ENABLED', false), // false = dry-run, only log orphans 'connection_timeout' => 10, 'server_interval' => 20, - 'command_timeout' => env('SSH_COMMAND_TIMEOUT', 3600), + 'command_timeout' => $sshCommandTimeout > 0 ? $sshCommandTimeout : 3600, 'max_retries' => env('SSH_MAX_RETRIES', 3), 'retry_base_delay' => env('SSH_RETRY_BASE_DELAY', 2), // seconds 'retry_max_delay' => env('SSH_RETRY_MAX_DELAY', 30), // seconds diff --git a/tests/Feature/SshCommandTimeoutConfigTest.php b/tests/Feature/SshCommandTimeoutConfigTest.php new file mode 100644 index 0000000000..1bbeb188f0 --- /dev/null +++ b/tests/Feature/SshCommandTimeoutConfigTest.php @@ -0,0 +1,47 @@ +toBe(3600); +})->with([ + 'not set' => null, + 'zero' => '0', + 'negative' => '-5', + 'not a number' => 'never', +]); + +it('keeps a positive SSH command timeout', function () { + expect(sshCommandTimeoutFromEnv('7200'))->toBe(7200); +});