Skip to content

fix(cli): classifyGatewayStatus no longer misclassifies "Not connected"#1288

Merged
cv merged 2 commits intomainfrom
cv/fix-classify-gateway-not-connected
Apr 2, 2026
Merged

fix(cli): classifyGatewayStatus no longer misclassifies "Not connected"#1288
cv merged 2 commits intomainfrom
cv/fix-classify-gateway-not-connected

Conversation

@cv
Copy link
Copy Markdown
Contributor

@cv cv commented Apr 2, 2026

Summary

The classifyGatewayStatus regex matched "Not connected" as connected because \bConnected\b matches the substring. This was partially fixed in #1268 (added Disconnected guard) but "Not connected" still slipped through.

Fix:

  • Move unavailable-pattern check before connected check
  • Use strict line-anchored regex: /^\s*(?:Status:\s*)?Connected\s*$/im
  • Add regression tests for "Status: Not connected" → inactive

This fix was intended for #1268 but the auto-merge squashed before the commit landed.

Fixes #1279.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved gateway connection status detection to handle edge cases and properly classify various status formats, ensuring more accurate connection state reporting.
  • Tests

    • Added test coverage for additional gateway status variations.

Move the unavailable-pattern check before the connected check, and use
a strict line-anchored regex (/^\s*(?:Status:\s*)?Connected\s*$/im) so
"Not connected", "Disconnected", and other substrings no longer match.

Add regression tests for "Status: Not connected" and bare "Connected".

Fixes #1279.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0cc5b4fe-0727-4c50-83bf-264bbe431579

📥 Commits

Reviewing files that changed from the base of the PR and between c3fd887 and 9ff4d10.

📒 Files selected for processing (2)
  • src/lib/runtime-recovery.test.ts
  • src/lib/runtime-recovery.ts

📝 Walkthrough

Walkthrough

The changes fix a bug where gateway status strings containing "Not connected" were misclassified as "connected". The regex pattern for detecting a connected state is now stricter, requiring the word "Connected" to appear alone (optionally prefixed with "Status:") rather than as part of a larger phrase, with corresponding test coverage.

Changes

Cohort / File(s) Summary
Gateway Status Classification Bug Fix
src/lib/runtime-recovery.ts, src/lib/runtime-recovery.test.ts
Updated classifyGatewayStatus to use stricter regex /^\s*(?:Status:\s*)?Connected\s*$/im that matches only when "Connected" appears alone (not within "Not connected"). Added regression test cases for "Status: Not connected""inactive" and "Connected""connected".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A gateway once fibbed 'bout its health and state,
"Not connected" pretended it was great!
A rabbit fixed the regex, precise and clean,
Now true is true, and false is clearly seen! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main fix: preventing misclassification of 'Not connected' by the classifyGatewayStatus function.
Linked Issues check ✅ Passed The PR successfully implements all objectives from issue #1279: stricter connected regex, unavailable check priority, and regression tests for edge cases.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the classifyGatewayStatus function and adding regression tests, with no unrelated modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cv/fix-classify-gateway-not-connected

Comment @coderabbitai help to get the list of available commands and usage tips.

@cv cv enabled auto-merge (squash) April 2, 2026 00:53
Copy link
Copy Markdown
Contributor

@ericksoa ericksoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix for #1279. LGTM.

@cv cv merged commit b999c0e into main Apr 2, 2026
8 checks passed
laitingsheng pushed a commit that referenced this pull request Apr 2, 2026
…d" (#1288)

## Summary

The `classifyGatewayStatus` regex matched "Not connected" as connected
because `\bConnected\b` matches the substring. This was partially fixed
in #1268 (added Disconnected guard) but "Not connected" still slipped
through.

Fix:
- Move unavailable-pattern check before connected check
- Use strict line-anchored regex: `/^\s*(?:Status:\s*)?Connected\s*$/im`
- Add regression tests for "Status: Not connected" → inactive

This fix was intended for #1268 but the auto-merge squashed before the
commit landed.

Fixes #1279.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved gateway connection status detection to handle edge cases and
properly classify various status formats, ensuring more accurate
connection state reporting.

* **Tests**
  * Added test coverage for additional gateway status variations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lakamsani pushed a commit to lakamsani/NemoClaw that referenced this pull request Apr 4, 2026
…d" (NVIDIA#1288)

## Summary

The `classifyGatewayStatus` regex matched "Not connected" as connected
because `\bConnected\b` matches the substring. This was partially fixed
in NVIDIA#1268 (added Disconnected guard) but "Not connected" still slipped
through.

Fix:
- Move unavailable-pattern check before connected check
- Use strict line-anchored regex: `/^\s*(?:Status:\s*)?Connected\s*$/im`
- Add regression tests for "Status: Not connected" → inactive

This fix was intended for NVIDIA#1268 but the auto-merge squashed before the
commit landed.

Fixes NVIDIA#1279.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved gateway connection status detection to handle edge cases and
properly classify various status formats, ensuring more accurate
connection state reporting.

* **Tests**
  * Added test coverage for additional gateway status variations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants