Add channel health diagnostics and gateway recovery fixes (#855)

This commit is contained in:
Lingxuan Zuo
2026-04-15 13:51:02 +08:00
committed by GitHub
Unverified
parent 6acd8acf5a
commit 1f39d1a8a7
22 changed files with 1868 additions and 52 deletions

View File

@@ -63,4 +63,42 @@ describe('channel runtime status helpers', () => {
),
).toBe('error');
});
it('returns degraded when gateway health is degraded', () => {
expect(
computeChannelRuntimeStatus(
{ running: true, connected: false, linked: false },
{ gatewayHealthState: 'degraded' },
),
).toBe('degraded');
});
it('keeps runtime error higher priority than degraded overlay', () => {
expect(
computeChannelRuntimeStatus(
{ running: true, lastError: 'bot token invalid' },
{ gatewayHealthState: 'degraded' },
),
).toBe('error');
});
it('degrades channel summary when gateway health is degraded', () => {
expect(
pickChannelRuntimeStatus(
[{ connected: false, running: false }],
undefined,
{ gatewayHealthState: 'degraded' },
),
).toBe('degraded');
});
it('keeps summary error higher priority than degraded gateway health', () => {
expect(
pickChannelRuntimeStatus(
[{ connected: false, running: false }],
{ error: 'channel bootstrap failed' },
{ gatewayHealthState: 'degraded' },
),
).toBe('error');
});
});