fix(gateway): fail fast when gateway detects systemd conflict on startup#829
Open
octo-patch wants to merge 1 commit intoValueCell-ai:mainfrom
Open
fix(gateway): fail fast when gateway detects systemd conflict on startup#829octo-patch wants to merge 1 commit intoValueCell-ai:mainfrom
octo-patch wants to merge 1 commit intoValueCell-ai:mainfrom
Conversation
When the openclaw gateway binary is already managed by systemd it emits "already running under systemd; waiting 5000ms before retrying startup" to stderr and loops internally. ClawX previously classified the resulting process exit as a transient error and retried the startup sequence (up to 3 attempts in the orchestrator, then up to 10 via the reconnect manager), producing a long visible retry storm with no recovery path. Detect this signal in startup-recovery and return 'fail' immediately so the manager surfaces a clear error state on the first attempt. Also downgrade the log level for the message to 'debug' in startup-stderr so the short window before the process exits does not flood the log. Fixes ValueCell-ai#695
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 #695
Problem
When the openclaw gateway binary detects it is already managed by systemd, it emits
already running under systemd; waiting 5000ms before retrying startupto stderr and retries internally. ClawX classified the resulting process exit as a transient startup error, so the startup orchestrator retried the sequence up to 3 times per attempt and the reconnect manager retried up to 10 more times — producing a long, frustrating retry storm with no recovery.Solution
startup-recovery.ts: AddedSYSTEMD_CONFLICT_PATTERNS,isSystemdConflictSignal, andhasSystemdConflictSignal.getGatewayStartupRecoveryActionnow returns'fail'immediately when any startup stderr line matches the systemd conflict pattern, short-circuiting the retry loop.startup-stderr.ts: Classifiedalready running under systemdmessages asdebuglevel so the brief log window before the process exits does not flood the log with repeated warnings.Testing
Added 6 new unit tests covering:
isSystemdConflictSignalpositive/negative cases (including case-insensitive matching)hasSystemdConflictSignalwith mixed stderr linesgetGatewayStartupRecoveryActionreturns'fail'on systemd conflict even when the error would otherwise qualify as transientgetGatewayStartupRecoveryActionstill returns'retry'for transient errors without the systemd signalAll 11 tests in
gateway-startup-recovery.test.tspass.