fix: handle binded_redirect state inconsistency in WeChat login
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -385,10 +385,27 @@ async function _runLogin({ callId, timeoutMs, botType, emit, isAborted }) {
|
||||
break;
|
||||
}
|
||||
|
||||
case 'binded_redirect':
|
||||
log.info('weixin', `callId=${callId} already connected`);
|
||||
emit({ action: 'finish', event: 'success', data: { accountId: 'already_connected' } });
|
||||
case 'binded_redirect': {
|
||||
// WeChat server considers this OpenClaw already bound.
|
||||
// Check if local token exists — if yes, treat as success; if not, local state was
|
||||
// cleared (e.g. logout) but remote binding wasn't revoked → state inconsistency.
|
||||
const indexedIds = _listIndexedAccountIds();
|
||||
const hasLocalToken = indexedIds.some(id => {
|
||||
const acct = _loadAccount(id);
|
||||
return acct && acct.token;
|
||||
});
|
||||
if (hasLocalToken) {
|
||||
log.info('weixin', `callId=${callId} already connected, local token intact`);
|
||||
emit({ action: 'finish', event: 'success', data: { accountId: indexedIds[0] } });
|
||||
} else {
|
||||
log.warn('weixin', `callId=${callId} binded_redirect but local token missing — state inconsistency`);
|
||||
emit({
|
||||
action: 'finish', event: 'failed', code: 1010,
|
||||
message: '微信服务端已绑定,但本地登录状态已清除。请在微信公众号后台解绑此 OpenClaw 后重新扫码登录。',
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case 'confirmed': {
|
||||
if (!status.ilink_bot_id) throw new Error('confirmed: missing ilink_bot_id');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "clawd",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"description": "Claw Box daemon - connects local Linux box to claw.cutos.ai via WebSocket",
|
||||
"main": "lib/client.js",
|
||||
"bin": {
|
||||
|
||||
Reference in New Issue
Block a user