Skip to content

fix(channels): surface channel error status in selector#2169

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
honor2030:fix/channel-selector-error-status
May 19, 2026
Merged

fix(channels): surface channel error status in selector#2169
senamakel merged 1 commit into
tinyhumansai:mainfrom
honor2030:fix/channel-selector-error-status

Conversation

@honor2030
Copy link
Copy Markdown
Contributor

@honor2030 honor2030 commented May 19, 2026

Summary

  • Surface error channel connection states in the Channels selector instead of falling back to Disconnected
  • Keep connected and connecting ahead of error so healthy/in-progress modes still win
  • Add a regression test covering an errored Telegram auth mode with no connected/connecting modes

Closes #2141

Test Plan

  • PATH="/opt/homebrew/opt/node@24/bin:/opt/homebrew/bin:$PATH" pnpm debug unit src/components/channels/__tests__/ChannelSelector.test.tsx
  • PATH="/opt/homebrew/opt/node@24/bin:/opt/homebrew/bin:$PATH" pnpm --filter openhuman-app format:check
  • PATH="/opt/homebrew/opt/node@24/bin:/opt/homebrew/bin:$PATH" pnpm --filter openhuman-app compile

Notes

  • Used Node 24 because the default local node v16.13.1 cannot run this repo's Corepack/pnpm (URL.canParse is unavailable).

Summary by CodeRabbit

  • Bug Fixes

    • Improved accuracy of channel connection status detection by prioritizing connection states more intelligently across multiple connections.
  • Tests

    • Added test coverage for error state handling in channel connections to ensure proper error label visibility.

Review Change Stack

@honor2030 honor2030 requested a review from a team May 19, 2026 03:23
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c19a1ab4-b9e9-4463-aa73-2c46256ded3c

📥 Commits

Reviewing files that changed from the base of the PR and between a719d78 and 303b50b.

📒 Files selected for processing (2)
  • app/src/components/channels/ChannelSelector.tsx
  • app/src/components/channels/__tests__/ChannelSelector.test.tsx

📝 Walkthrough

Walkthrough

ChannelSelector determines a channel's displayed status by collecting connection statuses from all modes and selecting the best match according to a defined priority order (connected, connecting, error, disconnected), replacing hardcoded checks. A test case verifies error states now surface correctly.

Changes

Channel Error State Visibility

Layer / File(s) Summary
Status priority ordering
app/src/components/channels/ChannelSelector.tsx
ChannelConnectionStatus type is imported and CHANNEL_STATUS_PRIORITY array is added, defining the ordered precedence (connected, connecting, error, disconnected) for channel status aggregation.
Best-status aggregation
app/src/components/channels/ChannelSelector.tsx
Status selection logic collects all connection statuses, filters to valid ChannelConnectionStatus values, and finds the first match in CHANNEL_STATUS_PRIORITY order, falling back to disconnected.
Error state test coverage
app/src/components/channels/__tests__/ChannelSelector.test.tsx
Test imports are updated to include store utilities, and a new test seeding telegram connection status with error state verifies the Telegram tab renders Error label and omits Disconnected.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A priority queue, oh what a sight,
Error states rising, now shining so bright,
No more disguised as simply disconnected,
The channel's true health is now truly detected! ✨

🚥 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 describes the main change: fixing the channel selector to surface error status instead of falling back to disconnected.
Linked Issues check ✅ Passed The PR implementation meets all primary objectives: updates channel status aggregation to prioritize connected→connecting→error→disconnected [#2141], and adds regression test case for error state.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing ChannelSelector to surface error status; no unrelated modifications detected in the component or its tests.
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.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@graycyrus graycyrus left a comment

Choose a reason for hiding this comment

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

Walkthrough

Clean bug fix that surfaces error channel connection states in the selector instead of silently falling back to Disconnected. The refactor from chained .find() calls to a priority-array lookup is a nice readability win and makes it trivial to adjust priority ordering later. Test covers the exact scenario from #2141.

File Change Description
ChannelSelector.tsx Bug fix + refactor Add CHANNEL_STATUS_PRIORITY array, replace chained .find() with priority-based lookup that includes error
ChannelSelector.test.tsx New test Seed Telegram bot_token in error state, verify Error badge renders instead of Disconnected

LGTM — well-scoped fix that matches the issue's acceptance criteria. The status aggregation logic is channel-agnostic so the Telegram test implicitly covers Discord too. All CI green, coverage gate passing.

@senamakel senamakel merged commit 669b77d into tinyhumansai:main May 19, 2026
26 checks passed
CodeGhost21 pushed a commit to CodeGhost21/openhuman that referenced this pull request May 22, 2026
…#2169)

Co-authored-by: honor2030 <11687299+honor2030@users.noreply.github.com>
AusAgentSmith pushed a commit to AusAgentSmith/openhuman that referenced this pull request May 23, 2026
…#2169)

Co-authored-by: honor2030 <11687299+honor2030@users.noreply.github.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.

Channel selector hides channel error state and falls back to Disconnected

4 participants