Disable agent service auto-restart (keep auto-start); log decorated startup version marker#63
Conversation
…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 <true/>), 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) <noreply@anthropic.com>
On openframe-mode startup, right after openframe file logging is enabled, emit a decorated line via openframe_printf so openframe-client can parse it: <ts> INFO MeshAgent starting (build <SOURCE_COMMIT_DATE>, self-update version <MESH_AGENT_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) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds an OpenFrame-decorated startup log marker in agentcore.c printed when --openframe-mode is enabled. In agent-installer.js, sets failureRestart:0 for AUTO_START services in both LaunchDaemon and legacy install paths; service-manager.js makes the launchd KeepAlive plist value conditional on this option instead of always true. ChangesStartup Marker and Service Restart Behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant AgentInstaller
participant ServiceManager
participant LaunchdPlist
AgentInstaller->>ServiceManager: installService(options: {startType: AUTO_START, failureRestart: 0})
ServiceManager->>ServiceManager: keepAlive = failureRestart null or >0 ? true : false
ServiceManager->>LaunchdPlist: write KeepAlive = keepAlive
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Two independent changes to the OpenFrame MeshAgent:
Disable the installed agent service's auto-restart-on-crash, while keeping auto-start-on-boot. Previously the agent daemon was configured to respawn after any crash/exit on every platform (Windows SCM recovery actions, systemd
Restart=on-failure, launchdKeepAlive, upstart/procd/OpenRCrespawn). It now starts on boot but is not restarted if it exits or crashes.Log a decorated startup marker with the version on agent startup, so the line is parseable by
openframe-client.Improvements
failureRestart: 0in both daemon install option-builders inmodules/agent-installer.js(macOS LaunchDaemon + Windows/Linux). The existing gatingfailureRestart == null || failureRestart > 0already honors this on all ~8 platform paths (Windows FailureActions, systemd, upstart, procd, OpenRC, SysV, BSD rc, pseudo-daemon).KeepAlivekey honorfailureRestartinmodules/service-manager.js(it was hard-coded<true/>), matching every other platform.0x02, systemdWantedBy=multi-user.target+systemctl enable, and macOSRunAtLoadall remain.meshcore/agentcore.c(inMeshAgent_AgentMode, right after openframe file logging is enabled) viaopenframe_printf, printing both version markers found in the tree — the build/commit date (SOURCE_COMMIT_DATE, same string used in the HTTP User-Agent) and the integer self-update version (MESH_AGENT_VERSION):Scope note
"Auto-restart disabled" is scoped to the agent daemon — the only persistent service a normal agent install creates. Two other
installServicecall sites are intentionally left as-is: the transient macOS message-box helper (a throwaway LaunchAgent that already usesKeepAlive false) andmeshcmd's ownMicroLMS/MeshCommanderservice (a separate CLI tool, only installed via an explicitmeshcmd ... install).Task
No linked ticket.
Summary by CodeRabbit
New Features
Bug Fixes