From 5494ce54bfa4fd53e9c82e154aa7c47fadc70195 Mon Sep 17 00:00:00 2001 From: mikhailm-coder Date: Thu, 9 Jul 2026 13:53:45 +0200 Subject: [PATCH 1/2] fix: disable agent service auto-restart-on-crash (keep auto-start-on-boot) The installed agent service was set to respawn after a crash/exit on every platform (Windows SCM recovery actions, systemd Restart=on-failure, launchd KeepAlive, upstart/procd/OpenRC respawn). Disable that; keep start-on-boot. - agent-installer.js: pass failureRestart: 0 in both daemon install option builders (macOS LaunchDaemon + Windows/Linux). The existing gating (failureRestart == null || > 0) already honors this on the ~8 gated paths. - service-manager.js: make the macOS LaunchDaemon KeepAlive key honor failureRestart (was hard-coded ), matching every other platform. Auto-start is untouched: Windows start type 0x02, systemd WantedBy/enable, and macOS RunAtLoad all remain in place. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/agent-installer.js | 2 ++ modules/service-manager.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/agent-installer.js b/modules/agent-installer.js index 91580c58b..ba0319dce 100644 --- a/modules/agent-installer.js +++ b/modules/agent-installer.js @@ -1146,6 +1146,7 @@ function createLaunchDaemon(serviceName, companyName, installPath, serviceId, in name: serviceName, target: 'meshagent', startType: 'AUTO_START', + failureRestart: 0, // auto-start on boot, but do not restart on crash/exit parameters: ['--serviceId', serviceId], companyName: companyName }; @@ -1910,6 +1911,7 @@ function installService(params) target: target==null?(process.platform == 'win32' ? 'MeshAgent' : 'meshagent'):target, servicePath: process.execPath, startType: 'AUTO_START', + failureRestart: 0, // auto-start on boot, but do not restart on crash/exit parameters: params, _installer: true }; diff --git a/modules/service-manager.js b/modules/service-manager.js index a97962b2c..27326c3c9 100644 --- a/modules/service-manager.js +++ b/modules/service-manager.js @@ -2977,6 +2977,7 @@ function serviceManager() var stdoutpath = (options.stdout ? ('StandardOutPath\n' + options.stdout + '') : ('StandardOutPath\n/tmp/' + serviceId + '-daemon.log')); var stderrpath = (options.stderr ? ('StandardErrorPath\n' + options.stderr + '') : ('StandardErrorPath\n/tmp/' + serviceId + '-daemon.log')); var autoStart = (options.startType == 'AUTO_START' ? '' : ''); + var keepAlive = ((options.failureRestart == null || options.failureRestart > 0) ? '' : ''); // launchd restart-on-exit // Apply OpenFrame parameters formatting for macOS console.log('[DEBUG service-manager] options.parameters before processing: ' + JSON.stringify(options.parameters)); @@ -3002,7 +3003,7 @@ function serviceManager() plist += ' Disabled\n'; plist += ' \n'; plist += ' KeepAlive\n'; - plist += ' \n'; + plist += (' ' + keepAlive + '\n'); plist += ' Label\n'; plist += (' ' + serviceId + '\n'); plist += (params + '\n'); From 7f69a697bb7bcea654171418d2b80b2237c88c47 Mon Sep 17 00:00:00 2001 From: mikhailm-coder Date: Thu, 9 Jul 2026 14:07:04 +0200 Subject: [PATCH 2/2] feat: log decorated startup marker with version for openframe-client On openframe-mode startup, right after openframe file logging is enabled, emit a decorated line via openframe_printf so openframe-client can parse it: INFO MeshAgent starting (build , self-update version ) tool_id=meshcentral-agent Prints both version markers found in the tree: the build/commit date (the same string used in the HTTP User-Agent) and the integer self-update version. Co-Authored-By: Claude Opus 4.8 (1M context) --- meshcore/agentcore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meshcore/agentcore.c b/meshcore/agentcore.c index 18a934921..6f5ad4a9c 100644 --- a/meshcore/agentcore.c +++ b/meshcore/agentcore.c @@ -5479,6 +5479,8 @@ int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char ** { agentHost->openFrameMode = true; parseCommands = 0; enable_file_logging_simple(); + // Decorated startup marker parsed by openframe-client + openframe_printf("MeshAgent starting (build %s, self-update version %d)\n", SOURCE_COMMIT_DATE, MESH_AGENT_VERSION); } if (strcmp(param[ri], "--openframe-secret") == 0 && ((ri + 1) < paramLen)) {