feat(cron): enable WeChat as a supported delivery channel (#789)
This commit is contained in:
committed by
GitHub
Unverified
parent
97d29ab23c
commit
3021ad5089
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
getGatewayStartupRecoveryAction,
|
||||
hasInvalidConfigFailureSignal,
|
||||
isInvalidConfigSignal,
|
||||
shouldAttemptConfigAutoRepair,
|
||||
@@ -50,3 +51,62 @@ describe('gateway startup recovery heuristics', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getGatewayStartupRecoveryAction', () => {
|
||||
const configInvalidStderr = ['Config invalid', 'Run: openclaw doctor --fix'];
|
||||
const transientError = new Error('Gateway process exited before becoming ready (code=1)');
|
||||
|
||||
it('returns repair on first config-invalid failure', () => {
|
||||
const action = getGatewayStartupRecoveryAction({
|
||||
startupError: transientError,
|
||||
startupStderrLines: configInvalidStderr,
|
||||
configRepairAttempted: false,
|
||||
attempt: 1,
|
||||
maxAttempts: 3,
|
||||
});
|
||||
expect(action).toBe('repair');
|
||||
});
|
||||
|
||||
it('returns retry when repair was attempted but error is still transient', () => {
|
||||
const action = getGatewayStartupRecoveryAction({
|
||||
startupError: transientError,
|
||||
startupStderrLines: configInvalidStderr,
|
||||
configRepairAttempted: true,
|
||||
attempt: 1,
|
||||
maxAttempts: 3,
|
||||
});
|
||||
expect(action).toBe('retry');
|
||||
});
|
||||
|
||||
it('returns retry for transient errors after successful repair (no config signal)', () => {
|
||||
const action = getGatewayStartupRecoveryAction({
|
||||
startupError: transientError,
|
||||
startupStderrLines: ['Gateway process exited (code=1, expected=no)'],
|
||||
configRepairAttempted: true,
|
||||
attempt: 1,
|
||||
maxAttempts: 3,
|
||||
});
|
||||
expect(action).toBe('retry');
|
||||
});
|
||||
|
||||
it('returns fail when max attempts exceeded even for transient errors', () => {
|
||||
const action = getGatewayStartupRecoveryAction({
|
||||
startupError: transientError,
|
||||
startupStderrLines: [],
|
||||
configRepairAttempted: false,
|
||||
attempt: 3,
|
||||
maxAttempts: 3,
|
||||
});
|
||||
expect(action).toBe('fail');
|
||||
});
|
||||
|
||||
it('returns fail for non-transient, non-config errors', () => {
|
||||
const action = getGatewayStartupRecoveryAction({
|
||||
startupError: new Error('Unknown fatal error'),
|
||||
startupStderrLines: [],
|
||||
configRepairAttempted: false,
|
||||
attempt: 1,
|
||||
maxAttempts: 3,
|
||||
});
|
||||
expect(action).toBe('fail');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user