Skip to content

refactor(xiaoyi): refactor connection to dual WebSocket & fix unusable channel#5274

Merged
rayrayraykk merged 1 commit into
agentscope-ai:mainfrom
hongxicheng:xiaoyi
Jun 17, 2026
Merged

refactor(xiaoyi): refactor connection to dual WebSocket & fix unusable channel#5274
rayrayraykk merged 1 commit into
agentscope-ai:mainfrom
hongxicheng:xiaoyi

Conversation

@hongxicheng

@hongxicheng hongxicheng commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Refactor the XiaoYi channel from a single WebSocket connection to a
dual-connection architecture (primary domain + backup IP), and align
the A2A protocol with the official @ynhcj/xiaoyi-channel plugin.

Changes

Connection Refactor

  • Extract XiaoYiConnection class to encapsulate a single WebSocket
    link (connect, heartbeat, receive, send)
  • Connect to both primary (hag.cloud.huawei.com) and backup
    (116.63.174.231) endpoints in parallel
  • Session-aware message routing: replies go to the server that
    delivered the request, with automatic fallback
  • Reconnect only triggers when both connections are down

A2A Protocol Alignment

  • Override _on_process_completed (instead of the legacy
    _run_process_loop) to send status-update(completed) +
    artifact-update(final=true) — fixes the "running" state stuck
    issue on XiaoYi App
  • Init message includes msgDetail with agentId and hostname
  • Heartbeat includes msgDetail with millisecond timestamp
  • All artifact-update messages set lastChunk: true to match
    official plugin behavior

Configuration Simplification

  • Remove user-configurable ws_url / ws_url_backup from backend
    config (XiaoYiConfig), frontend form (ChannelDrawer), and
    TypeScript types — the endpoints are fixed SaaS URLs hardcoded
    as constants
  • Users only need to configure ak, sk, and agent_id
  • Doctor connectivity now probes both fixed endpoints

Cleanup

  • Remove unused _run_process_loop override (legacy non-queue path)
  • Remove _default_backup_url() helper
  • Remove DEFAULT_WS_URL / DEFAULT_WS_URL_BACKUP from
    __init__.py exports (internal constants)

Related Issue: Fixes #1911 #3840

Security Considerations: [If applicable, e.g. channel auth, env/config handling]

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Core / Backend (app, agents, config, providers, utils, local_models)
  • Console (frontend web UI)
  • Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
  • Skills
  • CLI
  • Documentation (website)
  • Tests
  • CI/CD
  • Scripts / Deploy

Checklist

  • I ran pre-commit run --all-files locally and it passes
  • If pre-commit auto-fixed files, I committed those changes and reran checks
  • I ran tests locally (pytest or as relevant) and they pass
  • Documentation updated (if needed)
  • Ready for review

For Channel Changes (DingTalk, Feishu, QQ, Console, etc.)

  • I ran ./scripts/check-channels.sh (or ./scripts/check-channels.sh --changed) and it passes
  • Contract test exists in tests/contract/channels/test_<channel>_contract.py (REQUIRED)
  • Contract test implements create_instance() with proper channel initialization
  • All 19 contract verification points pass (see tests/contract/channels/__init__.py)
  • Optional: Unit tests in tests/unit/channels/test_<channel>.py for complex internal logic

Testing

[How to test these changes]

Local Verification Evidence

pre-commit run --all-files
# paste summary result

pytest
# paste summary result

Additional Notes

[Optional: any other context]

@github-actions

Copy link
Copy Markdown

Welcome to QwenPaw! 🐾

Hi @hongxicheng, this is your 123rd Pull Request.

📋 About PR Template

To help maintainers review your PR faster, please make sure to include:

  • Description - What this PR does and why
  • Type of Change - Bug fix / Feature / Breaking change / Documentation / Refactoring
  • Component(s) Affected - Core / Console / Channels / Skills / CLI / Documentation / Tests / CI/CD / Scripts
  • Checklist:
    • Run and pass pre-commit run --all-files
    • Run and pass relevant tests (pytest or as applicable)
    • Update documentation if needed
  • Testing - How to test these changes
  • Local Verification Evidence:
    pre-commit run --all-files
    # paste summary result
    
    pytest
    # paste summary result

Complete PR information helps speed up the review process. You can edit the PR description to add these details.

🙌 Join Developer Community

Thanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page:
https://qwenpaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.

@rayrayraykk rayrayraykk merged commit f987262 into agentscope-ai:main Jun 17, 2026
23 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in QwenPaw Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

小艺

2 participants