Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(wechat): direct companion runtime recovery to teammate settings
Chrisade1b9237089
diff --git a/apps/desktop/src/main/im/wechat/WechatIM.ts b/apps/desktop/src/main/im/wechat/WechatIM.tsindex 9bc1165831..c3dc0451dc 100644--- a/apps/desktop/src/main/im/wechat/WechatIM.ts+++ b/apps/desktop/src/main/im/wechat/WechatIM.ts@@ -1470,7 +1470,8 @@ export class WechatIM extends BaseIM implements RichChannelIM {}async #commitPreDispatchFailure(task: WechatTask, reason: string): Promise<void> {- const text = wechatPreDispatchFailureText(reason);+ const companion = this.#turnRuntime?.runner.companionBotIdFor?.(this.#epoch?.credentials.ilinkBotId ?? '');+ const text = wechatPreDispatchFailureText(reason, Boolean(companion));const chunks = chunkWechatText(text);await this.#requireStore().commitPreDispatchFailure({bindingEpoch: task.bindingEpoch,@@ -2029,7 +2030,14 @@ function safeMachineCode(value: string): string {* - 'missing_auth' — 未连接模型服务;* - 其余 — 通用重试提示。*/-export function wechatPreDispatchFailureText(reason: string): string {+export function wechatPreDispatchFailureText(reason: string, companion = false): string {+ if (companion && (+ reason.includes(WECHAT_TURN_PERMISSION_POLICY_UNSUPPORTED)+ || reason.includes('unsupported_turn_permission')+ )) {+ return '当前伙伴的模型或权限模式不支持微信的逐次权限确认,消息无法启动。\n'+ + '请主人在 Cindy 的伙伴设置中选择 Claude Code 或 Codex,并将权限设为自动审查或询问,然后重试。';+ }if (reason.includes(`${WECHAT_TURN_PERMISSION_POLICY_UNSUPPORTED}:agent`)) {// 当前权限模式若是换 Agent 后仍不兼容的档位(bypassPermissions / acceptEdits),// 仅换 Agent 会在新 Agent 上再次命中权限模式错误,补一条 /permission 提示。diff --git a/apps/desktop/src/main/im/wechat/__tests__/WechatIM.test.ts b/apps/desktop/src/main/im/wechat/__tests__/WechatIM.test.tsindex 57f5d0982a..f656149017 100644--- a/apps/desktop/src/main/im/wechat/__tests__/WechatIM.test.ts+++ b/apps/desktop/src/main/im/wechat/__tests__/WechatIM.test.ts@@ -151,6 +151,15 @@ describe('WechatIM host boundary', () => {expect(__testing.wechatPreDispatchFailureText('unsupported_turn_permission')).toContain('权限模式');expect(__testing.wechatPreDispatchFailureText('missing_auth')).toContain('模型服务');expect(__testing.wechatPreDispatchFailureText('boom')).toContain('稍后重试');+ // Linked companions inherit their runtime: the personal-channel settings and+ // /permission advice cannot fix their configuration (PR #6492, unit).+ const companionFailure = __testing.wechatPreDispatchFailureText(+ 'TURN_PERMISSION_POLICY_UNSUPPORTED:agent:bypassPermissions', true,+ );+ expect(companionFailure).toContain('伙伴设置');+ expect(companionFailure).toContain('Claude Code 或 Codex');+ expect(companionFailure).toContain('自动审查或询问');+ expect(companionFailure).not.toContain('/permission');});it('dispatches attachment-only WeChat messages to the agent', () => {