mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
Replace personal paths, user IDs, and names with generic placeholders. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
5.2 KiB
5.2 KiB
Channels Testing Guide
How to test channel integrations end-to-end.
Credentials
- Telegram bot:
@qwencod_test_1_bot(远弟) - Bot token env var:
TELEGRAM_BOT_TOKEN - Bot token file:
/path/to/telegram/.env - Telegram user ID:
<your-user-id> - WeChat credentials:
~/.qwen/channels/weixin/account.json
Before testing
Important: Stop any running service first. Duplicate instances cause duplicate responses.
# Stop the service if running
qwen channel stop
# Or check status first
qwen channel status
# If processes are stuck (e.g. from manual kill -9), clean up manually
pkill -9 -f "cli.js --acp"
pkill -9 -f "channel start"
rm -f ~/.qwen/channels/service.pid ~/.qwen/channels/sessions.json
Sending messages via Bot API (no bot process needed)
# Source the token
export TELEGRAM_BOT_TOKEN=$(grep TELEGRAM_BOT_TOKEN /path/to/telegram/.env | cut -d= -f2)
# Send a message (replace YOUR_CHAT_ID with your Telegram user ID)
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-H "Content-Type: application/json" \
-d '{"chat_id": "YOUR_CHAT_ID", "text": "Hello from the bot!"}'
Starting channels
export TELEGRAM_BOT_TOKEN=$(grep TELEGRAM_BOT_TOKEN /path/to/telegram/.env | cut -d= -f2)
cd /path/to/qwen-code
npm run bundle
# Single channel
node dist/cli.js channel start my-telegram
# All channels (shared bridge)
node dist/cli.js channel start
Settings config: ~/.qwen/settings.json under channels.*.
Checking registered commands
curl -s "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getMyCommands" | python3 -m json.tool
Test scenarios
1. Slash commands (shared across all channels)
Start the service, then send on Telegram or WeChat:
| Command | Expected |
|---|---|
/help |
List of all commands |
/status |
"Session: none, Access: ..." |
/clear |
"No active session to clear." (or "Session cleared." if active) |
/reset |
Same as /clear (alias) |
/new |
Same as /clear (alias) |
2. Basic text round-trip
- Start the bot
- Send any text (e.g. "hello")
- Bot should respond via the agent
/statusshould now show "Session: active"
3. Multi-turn conversation
- Send "my name is Alice"
- Send "what is my name?"
- Agent should remember "Alice" from same session
4. Session clear
- Have an active session (send a message first)
- Send
/clear(or/resetor/new) - Send "what is my name?"
- Agent should NOT remember — fresh session
5. Tool calls (internal)
- Send "list the files in /path/to/project"
- Agent should use shell/ls internally and return file listing
- Verify response contains actual file names
6. Markdown formatting
- Send "write me a hello world in python with explanation"
- Response should render with proper Telegram HTML formatting (bold, code blocks, etc.)
7. Multi-channel mode
- Ensure both
my-telegramandmy-weixinare configured in~/.qwen/settings.json - For WeChat: run
node dist/cli.js channel configure-weixinif token expired - Start all:
node dist/cli.js channel start - Should show:
Starting 2 channel(s): my-weixin, my-telegram - Send messages on both platforms — each should get exactly one response
- Check
~/.qwen/channels/sessions.json— each channel should have its own cwd
8. Crash recovery
- Start multi-channel mode and send a message to create sessions
- Find the ACP bridge PID:
ps --ppid <parent-pid> -o pid,args | grep acp - Kill it:
kill -9 <acp-pid> - Log should show:
Bridge crashed (1/3). Restarting in 3s...thenSessions restored: 2, failed: 0 - Send a message — should work, and session context (e.g. "what is my name?") should be preserved
9. Clean shutdown
- Start channels, send a message to create sessions
- Press Ctrl+C (or
qwen channel stopfrom another terminal) ~/.qwen/channels/sessions.jsonshould be deleted~/.qwen/channels/service.pidshould be deleted
10. Service management
- Start service:
qwen channel start - Check status from another terminal:
qwen channel status— should show running, uptime, channels - Try starting again:
qwen channel start— should fail with "already running" error - Stop from another terminal:
qwen channel stop— should stop gracefully - Confirm stopped:
qwen channel status— should show "No channel service is running."
11. Referenced messages (quoted replies)
- Send a message and get a bot response
- Reply to (quote) the bot's response with a follow-up question (e.g. "summarize that")
- Agent should see the quoted text as context and respond accordingly
- Test on both Telegram and WeChat
Useful debug commands
# Check recent updates the bot received
curl -s "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getUpdates?limit=5" | python3 -m json.tool
# Get bot info
curl -s "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getMe" | python3 -m json.tool