Skip to content

fix(cli): classifyGatewayStatus misclassifies "Not connected" as connected #1279

@ericksoa

Description

@ericksoa

Bug

classifyGatewayStatus in src/lib/runtime-recovery.ts matches "Status: Not connected" as connected because \bConnected\b matches and the Disconnected guard doesn't catch it.

if (/\bConnected\b/i.test(clean) && !/\bDisconnected\b/i.test(clean)) {
  return { state: "connected", reason: "ok" };
}

This is a pre-existing bug from the original JS code. The TS migration in #1268 partially improved it (added the Disconnected guard) but "Not connected" still slips through.

Fix

Use a stricter match — e.g., check unavailable patterns first, then use /^\s*(?:Status:\s*)?Connected\s*$/im for the connected check. Add a regression test for "Status: Not connected"inactive.

Found by

CodeRabbit review on #1268.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions