fix: recover stale WeChat active requests

This commit is contained in:
john
2026-07-18 19:05:33 +08:00
parent 8eaf4d23f3
commit ae3e1ba3fa
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -1012,6 +1012,7 @@ export function isRecoverableWechatAgentSessionError(message) {
if (/stale_session_poisoned_completion/i.test(normalized)) return true;
if (/403|404|not found|无权访问/i.test(normalized)) return true;
if (/tool_calls|tool_call_id|insufficient tool messages/i.test(normalized)) return true;
if (/session already has an active request|active request.*cancel/i.test(normalized)) return true;
if (/wechat_agent_incomplete_reply/i.test(normalized)) return true;
return false;
}
+4
View File
@@ -2714,6 +2714,10 @@ test('isRecoverableWechatAgentSessionError detects poisoned tool_calls history',
);
assert.equal(isRecoverableWechatAgentSessionError('stale_session_poisoned_completion'), true);
assert.equal(isRecoverableWechatAgentSessionError('无权访问该会话'), true);
assert.equal(
isRecoverableWechatAgentSessionError('Session already has an active request. Cancel it first.'),
true,
);
assert.equal(isRecoverableWechatAgentSessionError('network timeout'), false);
});