Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(device-link): explain source attachment access failures

elfcv3ded68ff2572
diff --git a/apps/desktop/scripts/fixtures/attachment-access-error/attachment-access-error-fixture.tsx b/apps/desktop/scripts/fixtures/attachment-access-error/attachment-access-error-fixture.tsx
new file mode 100644
index 0000000000..63c98e8977
--- /dev/null
+++ b/apps/desktop/scripts/fixtures/attachment-access-error/attachment-access-error-fixture.tsx
@@ -0,0 +1,10 @@
+import { ErrorMessageCard } from '../../../src/renderer/components/chat/ErrorMessageCard';
+import { mountPage } from '../../ui-page/harness';
+
+void mountPage({
+ render: () => (
+ <div className="p-4">
+ <ErrorMessageCard message="[DEVICE_LINK_MEDIA_ACCESS_DENIED] Cannot read the source attachment." />
+ </div>
+ ),
+});
diff --git a/apps/desktop/scripts/fixtures/attachment-access-error/ui-page.mjs b/apps/desktop/scripts/fixtures/attachment-access-error/ui-page.mjs
new file mode 100644
index 0000000000..a615626b17
--- /dev/null
+++ b/apps/desktop/scripts/fixtures/attachment-access-error/ui-page.mjs
@@ -0,0 +1,17 @@
+import assert from 'node:assert/strict';
+
+export default {
+ name: 'attachment-access-error',
+ entry: './attachment-access-error-fixture.tsx',
+ viewport: { width: 560, height: 400 },
+ real: 'ErrorMessageCard, error-code decoding, ErrorNotice and localized attachment recovery guidance',
+ notCovered: 'macOS WeChat permissions, file I/O and cross-device sending; transport behavior is covered by targeted unit tests',
+ cases: {
+ default: { about: '#6530: source permission denial explains how to reattach a readable copy' },
+ narrow: { about: 'Recovery text wraps at a narrow message width', viewport: { width: 320, height: 480 } },
+ },
+ async check(page, ui) {
+ assert.ok(await page.getByText(await ui.t('chat.remoteError.DEVICE_LINK_MEDIA_ACCESS_DENIED'), { exact: true }).isVisible());
+ assert.equal(await page.getByText(await ui.t('chat.errorBanner.replyFailed'), { exact: true }).count(), 0);
+ },
+};
diff --git a/apps/desktop/src/main/__tests__/deviceLinkIpc.test.ts b/apps/desktop/src/main/__tests__/deviceLinkIpc.test.ts
index 45105c797b..f4ac004f41 100644
--- a/apps/desktop/src/main/__tests__/deviceLinkIpc.test.ts
+++ b/apps/desktop/src/main/__tests__/deviceLinkIpc.test.ts
@@ -996,6 +996,15 @@ describe('device-link controller handlers', () => {
expect(invoke).not.toHaveBeenCalled();
});
+ // #6530: preserve the source-access classification at the actual send boundary.
+ it('keeps attachment access guidance and does not dispatch a partial message', async () => {
+ const invoke = vi.fn();
+ const error = createIpcError('DEVICE_LINK_MEDIA_ACCESS_DENIED', 'Cannot read the source attachment.');
+ const deps = makeDeps({ invoke, rewriteOutboundMedia: vi.fn().mockRejectedValue(error) });
+ await expect(handleInvoke(deps, 'dev-2', 'maker:send', ['s', {}])).rejects.toBe(error);
+ expect(invoke).not.toHaveBeenCalled();
+ });
+
it('invoke:出方向改写成功 → 改写后的 args 才发给 invoke', async () => {
const invoke = vi.fn().mockResolvedValue({ ok: true, result: null });
const rewritten = ['s', { type: 'user', content: [{ type: 'image', path: 'cindy-oss-attach://m/xxx' }] }];
diff --git a/apps/desktop/src/main/device-link/__tests__/filePeer.test.ts b/apps/desktop/src/main/device-link/__tests__/filePeer.test.ts
index ed17d2c1f4..187108db8b 100644
--- a/apps/desktop/src/main/device-link/__tests__/filePeer.test.ts
+++ b/apps/desktop/src/main/device-link/__tests__/filePeer.test.ts
@@ -89,6 +89,24 @@ import { DesktopCaptureWindow } from '../../remote-desktop/captureWindow';
import { createHash } from 'node:crypto';
describe('peer attachment upload preflight', () => {
+ // #6530: an unreadable local file must not cool down a healthy peer or trigger OSS fallback.
+ it.each(['EPERM', 'EACCES'])('keeps the peer usable after source open fails with %s', async code => {
+ const source = path.resolve('unreadable-inventory.xlsx');
+ const error = Object.assign(new Error('source access denied'), { code, syscall: 'open', path: source });
+ const open = vi.spyOn(fsPromises, 'open').mockRejectedValueOnce(error);
+ const invoke = vi.fn(async () => ({ ok: true, result: { version: 1 } }));
+ const peer = `source-access-${code}`;
+ try {
+ await expect(tryUploadPeerAttachment(peer, source, undefined, invoke)).rejects.toBe(error);
+ expect(invoke).not.toHaveBeenCalled();
+ // A subsequent readable attachment still probes the peer (no permission-error cooldown).
+ await tryUploadPeerAttachment(peer, Buffer.from('readable copy'), undefined, invoke);
+ expect(invoke).toHaveBeenCalled();
+ } finally {
+ open.mockRestore();
+ }
+ });
+
it('checks the peer before reading a large file and never connects to an old peer', async () => {
const dir = await mkdtemp(path.join(os.tmpdir(), 'cindy-peer-upload-'));
try {
diff --git a/apps/desktop/src/main/device-link/__tests__/outboundMedia.test.ts b/apps/desktop/src/main/device-link/__tests__/outboundMedia.test.ts
index 6cf17c108b..3eb416344f 100644
--- a/apps/desktop/src/main/device-link/__tests__/outboundMedia.test.ts
+++ b/apps/desktop/src/main/device-link/__tests__/outboundMedia.test.ts
@@ -86,6 +86,46 @@ describe('rewriteOutboundMedia — channel gating', () => {
sourceSessionId: 'source', attachments: [{ name: 'notes.md', path: '/controller/notes.md' }],
}])).rejects.toThrow('upload failed');
});
+ // #6530: a source-file permission denial needs recovery guidance, not a network retry.
+ // Existing upload-failure coverage did not distinguish local open/stat from transport errors.
+ it.each(['EPERM', 'EACCES'])('classifies %s on the source file without exposing its path', async code => {
+ const file = '/private/wechat/temp/drag/inventory.xlsx';
+ uploadLocalFile.mockRejectedValue(Object.assign(new Error(`${code}: open '${file}'`), {
+ code, syscall: 'open', path: file,
+ }));
+ await expect(rewriteOutboundMedia('maker:send', ['session', {
+ type: 'user', content: [{ type: 'file', path: file }],
+ }])).rejects.toMatchObject({
+ code: 'DEVICE_LINK_MEDIA_ACCESS_DENIED',
+ message: '[DEVICE_LINK_MEDIA_ACCESS_DENIED] Cannot read the source attachment. Save a copy to an accessible folder, remove the original attachment, and add the copy again.',
+ });
+ });
+
+ it('does not try OSS after the peer source file is denied', async () => {
+ const file = '/private/source.xlsx';
+ const direct = vi.fn().mockRejectedValue(Object.assign(new Error('access denied'), {
+ code: 'EPERM', syscall: 'open', path: file,
+ }));
+ await expect(withPeerAttachmentUpload(direct, () => rewriteOutboundMedia('maker:send', ['session', {
+ type: 'user', content: [{ type: 'file', path: file }],
+ }]))).rejects.toMatchObject({ code: 'DEVICE_LINK_MEDIA_ACCESS_DENIED' });
+ expect(uploadLocalFile).not.toHaveBeenCalled();
+ });
+
+ it('does not classify transport or another file permission error as source access denial', async () => {
+ for (const details of [
+ { code: 'EACCES', syscall: 'connect' },
+ { code: 'EPERM', syscall: 'open', path: '/other/cache' },
+ {},
+ ]) {
+ const error = Object.assign(new Error('upload failed'), details);
+ uploadLocalFile.mockRejectedValue(error);
+ await expect(rewriteOutboundMedia('maker:send', ['session', {
+ type: 'user', content: [{ type: 'file', path: '/source.xlsx' }],
+ }])).rejects.toBe(error);
+ }
+ });
+
it('uses peer staging for exact file bytes, preserves the name and retains OSS fallback', async () => {
const direct = vi.fn(async () => buildPeerAttachmentRef({ ticket: 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', size: 10, sha256: SHA256, mimeType: 'text/plain' }));
const args = ['session', { type: 'user', content: [{ type: 'file', path: '/controller/a.txt', originalName: 'a.txt' }] }];
diff --git a/apps/desktop/src/main/device-link/filePeer.ts b/apps/desktop/src/main/device-link/filePeer.ts
index 08029401d9..227e83c1a9 100644
--- a/apps/desktop/src/main/device-link/filePeer.ts
+++ b/apps/desktop/src/main/device-link/filePeer.ts
@@ -41,6 +41,7 @@ import { createLogger } from '../logger.js';
import { handlePeerAttachment } from './peerAttachmentStore';
import { fileVersion } from './fileVersion';
import { remoteFileVersionCache, type FileVersionMetadata } from './remoteFileVersionCache';
+import { isSourceFileAccessError } from './sourceFileError';
// Local-only diagnostics (scope is not upload-allowlisted): stages, sizes and timings, never paths.
const log = createLogger('device-link:filePeer');
@@ -1096,9 +1097,12 @@ export async function tryUploadPeerAttachment(
`uploaded peer=${short(peer)} bytes=${size} transferMs=${ms} bytesPerSecond=${Math.round((size * 1000) / Math.max(1, ms))}`,
);
return result;
- } catch {
+ } catch (error) {
check();
if (signal?.aborted) throw new Error('FILE_PEER_CANCELLED');
+ // The source is unreadable on this computer; another transport cannot fix it.
+ // Leave the healthy peer connection and its cooldown untouched.
+ if (isSourceFileAccessError(error, source)) throw error;
cooldown.fail(peer);
const failed = outgoing.get(peer);
if (failed) stopConnection(failed.id, 'upload-failed');
diff --git a/apps/desktop/src/main/device-link/ipc.ts b/apps/desktop/src/main/device-link/ipc.ts
index b242b7fa97..725692c029 100644
--- a/apps/desktop/src/main/device-link/ipc.ts
+++ b/apps/desktop/src/main/device-link/ipc.ts
@@ -725,7 +725,8 @@ export async function handleInvoke(
() => existing ? deps.rewriteOutboundMedia!(channel, callArgs, existing) : deps.rewriteOutboundMedia!(channel, callArgs)),
createSentImageRetainer(normalizedDeviceId));
} catch (err) {
- if (isIpcError(err) && err.code === 'DEVICE_LINK_CHANNEL_NOT_ALLOWED') {
+ if (isIpcError(err) && (err.code === 'DEVICE_LINK_CHANNEL_NOT_ALLOWED'
+ || err.code === 'DEVICE_LINK_MEDIA_ACCESS_DENIED')) {
throw err;
}
// Review 走同一条出方向改写管线, 但它的授权/校验拒绝不是媒体传输失败:
diff --git a/apps/desktop/src/main/device-link/outboundMedia.ts b/apps/desktop/src/main/device-link/outboundMedia.ts
index dee4fea79c..fb16dfc119 100644
--- a/apps/desktop/src/main/device-link/outboundMedia.ts
+++ b/apps/desktop/src/main/device-link/outboundMedia.ts
@@ -4,7 +4,8 @@
* ---------------------------------------------------------------------------
* 在 device-link handleInvoke 里、deps.invoke 之前对 maker:send / maker:steer /
* maker:input:enqueue / maker:input:update-content 调用(这些 channel 才携带用户消息附件)。失败抛错 → handleInvoke
- * 转 throwIpcError(DEVICE_LINK_MEDIA_TRANSFER_FAILED) → 整条消息不发(产品决策)。
+ * 转 DEVICE_LINK_MEDIA_TRANSFER_FAILED;源文件权限拒绝保留 MEDIA_ACCESS_DENIED。
+ * 两者均整条消息不发(产品决策)。
*
* 被控端 normalizeUserMessage 识别 OSS 引用串 → presign-get 下载 → 物化喂 agent。
*
@@ -34,6 +35,8 @@ import {
import { buildLegacyAttachmentOssRef, parseAttachmentOssRef } from '../../shared/attachmentOssRef';
import { readStartReviewRequest } from '../maker-ipc/reviewStartHandler.js';
import { withPreparedOutboundReview } from '../maker-ipc/reviewOutboundInput.js';
+import { throwIpcError } from '../utils/ipcValidate';
+import { isSourceFileAccessError } from './sourceFileError';
const log = createLogger('device-link:outboundMedia');
@@ -113,8 +116,19 @@ async function uploadAttachment(src: AttachmentSource): Promise<string> {
};
const bufferRef = async (bytes: Buffer, options: Parameters<typeof uploadBuffer>[1]) => retain(bytes,
await direct(bytes, options?.contentType) ?? buildUploadedAttachmentRef(await uploadBuffer(bytes, options), originalName));
- const fileRef = async (file: string, options: Parameters<typeof uploadLocalFile>[1]) => retain(file,
- await direct(file, options?.contentType) ?? buildUploadedAttachmentRef(await uploadLocalFile(file, options), originalName));
+ const fileRef = async (file: string, options: Parameters<typeof uploadLocalFile>[1]) => {
+ try {
+ return await retain(file,
+ await direct(file, options?.contentType) ?? buildUploadedAttachmentRef(await uploadLocalFile(file, options), originalName));
+ } catch (error) {
+ if (isSourceFileAccessError(error, file)) {
+ // Do not send Node's private source path across IPC or persist it in chat history.
+ throwIpcError('DEVICE_LINK_MEDIA_ACCESS_DENIED',
+ 'Cannot read the source attachment. Save a copy to an accessible folder, remove the original attachment, and add the copy again.');
+ }
+ throw error;
+ }
+ };
// 1) 内存 base64(剪贴板/截图,视觉上下文语义)→ 压缩 → uploadBuffer(不把字节内联进 relay)
if (typeof src.base64 === 'string' && src.base64) {
diff --git a/apps/desktop/src/main/device-link/sourceFileError.ts b/apps/desktop/src/main/device-link/sourceFileError.ts
new file mode 100644
index 0000000000..e917a994d9
--- /dev/null
+++ b/apps/desktop/src/main/device-link/sourceFileError.ts
@@ -0,0 +1,10 @@
+/** Only a local source read denial warrants file-access recovery guidance.
+ * Transport permissions and failures writing another file must keep their own semantics.
+ */
+export function isSourceFileAccessError(error: unknown, source: string | Buffer): boolean {
+ if (typeof source !== 'string' || !error || typeof error !== 'object') return false;
+ const { code, syscall, path } = error as NodeJS.ErrnoException;
+ return (code === 'EPERM' || code === 'EACCES')
+ && path === source
+ && (syscall === 'open' || syscall === 'stat' || syscall === 'read');
+}
diff --git a/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts b/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts
index ba84b7a969..633fb15e00 100644
--- a/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts
+++ b/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts
@@ -5604,7 +5604,9 @@ describe('makerChatStore text delta batching', () => {
).toBeUndefined();
});
- it('calls the composer recovery callback when a deferred remote send later fails permanently', async () => {
+ // #6530: the specific source-access error must release the outbox into editable draft recovery.
+ it.each(['permission denied', '[DEVICE_LINK_MEDIA_ACCESS_DENIED] Cannot read the source attachment.'])(
+ 'calls the composer recovery callback after permanent failure: %s', async failure => {
remoteProjectsStore.pinSessionOrigin('device-1', SESSION_ID);
const recoveryUrl = 'cindy-media://blobs/recover-me.png';
let enqueueAttempts = 0;
@@ -5626,7 +5628,7 @@ describe('makerChatStore text delta batching', () => {
enqueueAttempts += 1;
queued = args[1] as AgentInputQueuedMessage;
if (enqueueAttempts === 1) throw new Error('[NOT_CONNECTED] target offline');
- throw new Error('permission denied');
+ throw new Error(failure);
}
if (channel === 'maker:input:get-projection') return projection(SESSION_ID);
throw new Error(`unexpected remote channel: ${channel}`);
diff --git a/apps/desktop/src/renderer/components/chat/__tests__/ErrorLocalization.test.tsx b/apps/desktop/src/renderer/components/chat/__tests__/ErrorLocalization.test.tsx
index e36f326b0c..1d7f10dc45 100644
--- a/apps/desktop/src/renderer/components/chat/__tests__/ErrorLocalization.test.tsx
+++ b/apps/desktop/src/renderer/components/chat/__tests__/ErrorLocalization.test.tsx
@@ -84,7 +84,7 @@ describe.each(SUPPORTED_LOCALES)('error presentation in %s', locale => {
expect(screen.queryByText(locales[locale].chat.errorBanner.networkShowRaw)).toBeNull();
});
- it.each(['REMOTE_LOCAL_ONLY_PROVIDER', 'DEVICE_LINK_MEDIA_TRANSFER_FAILED', 'DEVICE_LINK_BUSY', 'MCP_APPROVAL_CONFIRMATION_TIMEOUT'])('preserves curated %s guidance and follows language changes', async code => {
+ it.each(['REMOTE_LOCAL_ONLY_PROVIDER', 'DEVICE_LINK_MEDIA_TRANSFER_FAILED', 'DEVICE_LINK_MEDIA_ACCESS_DENIED', 'DEVICE_LINK_BUSY', 'MCP_APPROVAL_CONFIRMATION_TIMEOUT'])('preserves curated %s guidance and follows language changes', async code => {
const i18n = createInstance();
await i18n.init({ lng: locale, fallbackLng: 'en', resources: Object.fromEntries(Object.entries(locales).map(([lng, common]) => [lng, { translation: common }])) });
const message = `Error invoking remote method device-link:invoke: Error: [${code}] upstream fallback api_key=private-test-value`;
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index f8ed7ee54f..691fd3700a 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -952,6 +952,7 @@
"handoffWindow": "Input handoff · {{app}}"
},
"ipcError": {
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy cannot read the source attachment; the message was not sent. Save a copy to Downloads or another accessible folder, remove the original attachment, and add the copy using the attachment button before sending again.",
"DEVICE_LINK_BUSY": "The remote computer is busy. Please try again shortly.",
"INVALID_PARAMS": "Invalid input. Please check and try again.",
"PRECONDITION_FAILED": "This action is unavailable in the current state. Please try again.",
@@ -12056,6 +12057,7 @@
"LOCAL_OLLAMA_NOT_READY": "Local Ollama isn't ready. Open Settings → Model Providers → Ollama.",
"DEVICE_LINK_CONTROL_DISABLED": "Control for this device is off; the message was not sent.",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "Attachment transfer failed; the message was not sent. Please try again.",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy cannot read the source attachment; the message was not sent. Save a copy to Downloads or another accessible folder, remove the original attachment, and add the copy using the attachment button before sending again.",
"MCP_APPROVAL_AUTO_BLOCKED": "Automatic approval review blocked this tool call. No manual rejection was received.",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "The permission request timed out without a confirmed decision. A timeout does not show whether you clicked a button.",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "Permission confirmation could not be completed. No manual rejection was received.",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 2bbcef9451..e3100149a8 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -940,6 +940,7 @@
"handoffWindow": "代理入力 · {{app}}"
},
"ipcError": {
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy が元の添付ファイルを読み取れないため、メッセージは送信されていません。「ダウンロード」などアクセス可能なフォルダーにコピーを保存し、元の添付ファイルを削除してから、添付ボタンでコピーを追加し、再送信してください。",
"DEVICE_LINK_BUSY": "接続先のコンピュータが混み合っています。しばらくしてから再試行してください。",
"INVALID_PARAMS": "パラメータが無効です。確認して再試行してください。",
"PRECONDITION_FAILED": "現在の状態ではこの操作を実行できません。しばらくしてから再試行してください。",
@@ -12012,6 +12013,7 @@
"LOCAL_OLLAMA_NOT_READY": "ローカル Ollama の準備ができていません。設定 → モデルプロバイダー → Ollama を開いてください。",
"DEVICE_LINK_CONTROL_DISABLED": "このデバイスの操作はオフです。メッセージは送信されていません。",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "添付ファイルの転送に失敗しました。メッセージは送信されていません。もう一度お試しください。",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy が元の添付ファイルを読み取れないため、メッセージは送信されていません。「ダウンロード」などアクセス可能なフォルダーにコピーを保存し、元の添付ファイルを削除してから、添付ボタンでコピーを追加し、再送信してください。",
"MCP_APPROVAL_AUTO_BLOCKED": "このツール呼び出しは自動審査でブロックされました。手動で拒否された記録はありません。",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "権限の確認がタイムアウトし、有効な確認結果を受信できませんでした。タイムアウトだけでは、ボタンをクリックしたかどうかは判断できません。",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "権限の確認を完了できませんでした。手動で拒否された記録はありません。",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 07c396f021..04cc3bf633 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -940,6 +940,7 @@
"handoffWindow": "대리 입력 · {{app}}"
},
"ipcError": {
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy가 원본 첨부 파일을 읽을 수 없어 메시지가 전송되지 않았습니다. 다운로드 등 접근 가능한 폴더에 사본을 저장하고, 원본 첨부 파일을 제거한 뒤 첨부 버튼으로 사본을 추가하여 다시 전송하세요.",
"DEVICE_LINK_BUSY": "원격 컴퓨터가 사용 중입니다. 잠시 후 다시 시도해 주세요.",
"INVALID_PARAMS": "매개변수가 잘못되었습니다. 확인 후 다시 시도하세요.",
"PRECONDITION_FAILED": "현재 상태에서는 이 작업을 수행할 수 없습니다. 잠시 후 다시 시도하세요.",
@@ -12012,6 +12013,7 @@
"LOCAL_OLLAMA_NOT_READY": "로컬 Ollama가 아직 준비되지 않았습니다. 설정 → 모델 제공자 → Ollama를 여세요.",
"DEVICE_LINK_CONTROL_DISABLED": "이 기기의 제어가 꺼져 있어 메시지가 전송되지 않았습니다.",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "첨부 파일 전송에 실패했습니다. 메시지가 전송되지 않았습니다. 다시 시도하세요.",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy가 원본 첨부 파일을 읽을 수 없어 메시지가 전송되지 않았습니다. 다운로드 등 접근 가능한 폴더에 사본을 저장하고, 원본 첨부 파일을 제거한 뒤 첨부 버튼으로 사본을 추가하여 다시 전송하세요.",
"MCP_APPROVAL_AUTO_BLOCKED": "자동 승인 검토가 이 도구 호출을 차단했습니다. 직접 거부한 기록은 없습니다.",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "권한 확인 시간이 초과되어 유효한 확인 결과를 받지 못했습니다. 시간 초과만으로는 버튼을 클릭했는지 알 수 없습니다.",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "권한 확인을 완료하지 못했습니다. 직접 거부한 기록은 없습니다.",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 58d65f4de5..bf90b50618 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -940,6 +940,7 @@
"handoffWindow": "代输入 · {{app}}"
},
"ipcError": {
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy 无法读取源附件,消息未发送。请将文件另存到“下载”或其他可访问的文件夹,移除原附件,再用附件按钮添加副本后发送。",
"DEVICE_LINK_BUSY": "远端繁忙,请稍后重试。",
"INVALID_PARAMS": "参数无效,请检查后重试。",
"PRECONDITION_FAILED": "当前状态下无法执行此操作,请稍后重试。",
@@ -12012,6 +12013,7 @@
"LOCAL_OLLAMA_NOT_READY": "本机 Ollama 还没就绪。请打开设置 → 模型供应商 → Ollama。",
"DEVICE_LINK_CONTROL_DISABLED": "已关闭对该设备的控制,消息未发送。",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "附件传输失败,消息未发送。请重试。",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy 无法读取源附件,消息未发送。请将文件另存到“下载”或其他可访问的文件夹,移除原附件,再用附件按钮添加副本后发送。",
"MCP_APPROVAL_AUTO_BLOCKED": "这次工具调用被自动审核拦截,未收到你手动拒绝的记录。",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "权限确认超时,未收到有效的确认结果。仅凭超时无法判断你是否点过按钮。",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "这次权限确认未完成,未收到你手动拒绝的记录。",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 068c38a554..f6a2899aab 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -940,6 +940,7 @@
"handoffWindow": "代輸入 · {{app}}"
},
"ipcError": {
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy 無法讀取來源附件,訊息未傳送。請將檔案另存到「下載」或其他可存取的資料夾,移除原附件,再用附件按鈕加入副本後傳送。",
"DEVICE_LINK_BUSY": "遠端忙碌中,請稍後再試。",
"INVALID_PARAMS": "引數無效,請檢查後重試。",
"PRECONDITION_FAILED": "目前狀態下無法執行此操作,請稍後再試。",
@@ -12011,6 +12012,7 @@
"LOCAL_OLLAMA_NOT_READY": "本機 Ollama 尚未就緒。請打開設定 → 模型供應商 → Ollama。",
"DEVICE_LINK_CONTROL_DISABLED": "已關閉對該裝置的控制,訊息未傳送。",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "附件傳輸失敗,訊息未傳送。請重試。",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy 無法讀取來源附件,訊息未傳送。請將檔案另存到「下載」或其他可存取的資料夾,移除原附件,再用附件按鈕加入副本後傳送。",
"MCP_APPROVAL_AUTO_BLOCKED": "這次工具呼叫被自動審核攔截,未收到你手動拒絕的紀錄。",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "權限確認逾時,未收到有效的確認結果。僅憑逾時無法判斷你是否點過按鈕。",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "這次權限確認未完成,未收到你手動拒絕的紀錄。",
diff --git a/apps/desktop/src/shared/ipc-errors.ts b/apps/desktop/src/shared/ipc-errors.ts
index b16cea656c..9af05b29dc 100644
--- a/apps/desktop/src/shared/ipc-errors.ts
+++ b/apps/desktop/src/shared/ipc-errors.ts
@@ -236,6 +236,7 @@ export type IpcErrorCode =
| 'DEVICE_LINK_DEVICE_UNRESPONSIVE' // 目标设备连续超时被熔断判定无响应(弱网 / 对端卡死),快速失败中
| 'DEVICE_LINK_VERSION_MISMATCH' // 两端协议/版本不匹配
| 'DEVICE_LINK_MEDIA_TRANSFER_FAILED' // 远程媒体经 OSS 中转失败(出方向附件上传 / 入方向取媒体)
+ | 'DEVICE_LINK_MEDIA_ACCESS_DENIED' // 控制端源附件不可读,需重新添加可访问的副本
| 'REMOTE_WORKDIR_INVALID' // 被控端工作目录路径非法
| 'REMOTE_WORKDIR_NOT_FOUND' // 被控端工作目录不存在
| 'REMOTE_WORKDIR_NOT_DIRECTORY' // 被控端工作路径存在但不是目录
@@ -454,6 +455,7 @@ const IPC_ERROR_CODES: ReadonlySet<IpcErrorCode> = new Set<IpcErrorCode>([
'DEVICE_LINK_DEVICE_UNRESPONSIVE',
'DEVICE_LINK_VERSION_MISMATCH',
'DEVICE_LINK_MEDIA_TRANSFER_FAILED',
+ 'DEVICE_LINK_MEDIA_ACCESS_DENIED',
'REMOTE_WORKDIR_INVALID',
'REMOTE_WORKDIR_NOT_FOUND',
'REMOTE_WORKDIR_NOT_DIRECTORY',
diff --git a/apps/mobile/src/__tests__/AgentErrorLocalization.test.tsx b/apps/mobile/src/__tests__/AgentErrorLocalization.test.tsx
index 14668ce100..4a8e24fb6b 100644
--- a/apps/mobile/src/__tests__/AgentErrorLocalization.test.tsx
+++ b/apps/mobile/src/__tests__/AgentErrorLocalization.test.tsx
@@ -175,7 +175,7 @@ describe.each(SUPPORTED_LOCALES)('known mobile remote errors in %s', locale => {
expect(unclassifiedAgentErrorI18nKey('[CUSTOM_ERROR] private diagnostic')).toBe('session.tail.replyFailed');
});
- it.each(['REMOTE_LOCAL_ONLY_PROVIDER', 'DEVICE_LINK_MEDIA_TRANSFER_FAILED', 'MCP_APPROVAL_CONFIRMATION_TIMEOUT'])(
+ it.each(['REMOTE_LOCAL_ONLY_PROVIDER', 'DEVICE_LINK_MEDIA_TRANSFER_FAILED', 'DEVICE_LINK_MEDIA_ACCESS_DENIED', 'MCP_APPROVAL_CONFIRMATION_TIMEOUT'])(
'preserves %s guidance across history, live and tail, including language changes', async code => {
await i18n.changeLanguage(locale);
const message = `Error invoking remote method 'maker:send': Error: [${code}] upstream diagnostic; api_key=private-test-value`;
@@ -228,7 +228,7 @@ it.each(['REMOTE_LOCAL_ONLY_PROVIDER', 'REMOTE_COMPAT_MODE_UNSUPPORTED', 'REMOTE
expect(requiresAgentErrorConfigurationChange(`[${code}] diagnostic`)).toBe(true);
},
);
-it.each(['REMOTE_DAEMON_CLOSED', 'REMOTE_GATEWAY_ENDPOINT_UNAVAILABLE', 'DEVICE_LINK_MEDIA_TRANSFER_FAILED', 'MCP_APPROVAL_CONFIRMATION_TIMEOUT', 'REMOTE_FUTURE'])(
+it.each(['REMOTE_DAEMON_CLOSED', 'REMOTE_GATEWAY_ENDPOINT_UNAVAILABLE', 'DEVICE_LINK_MEDIA_TRANSFER_FAILED', 'DEVICE_LINK_MEDIA_ACCESS_DENIED', 'MCP_APPROVAL_CONFIRMATION_TIMEOUT', 'REMOTE_FUTURE'])(
'preserves retry for recoverable or unclassified %s', code => {
expect(requiresAgentErrorConfigurationChange(`[${code}] diagnostic`)).toBe(false);
},
diff --git a/apps/mobile/src/i18n/locales/en/session.json b/apps/mobile/src/i18n/locales/en/session.json
index 99eabbc6fe..36db82cd39 100644
--- a/apps/mobile/src/i18n/locales/en/session.json
+++ b/apps/mobile/src/i18n/locales/en/session.json
@@ -567,6 +567,7 @@
"DEVICE_LINK_CONTROL_DISABLED": "Control for this device is off; the message was not sent.",
"DEVICE_LINK_BUSY": "The remote computer is busy. Please try again shortly.",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "Attachment transfer failed; the message was not sent. Please try again.",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy cannot read the source attachment; the message was not sent. Save a copy to Downloads or another accessible folder, remove the original attachment, and add the copy using the attachment button before sending again.",
"MCP_APPROVAL_AUTO_BLOCKED": "Auto approve blocked this tool call. No manual rejection was received.",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "The permission request timed out without a confirmed decision. A timeout does not show whether you clicked a button.",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "Permission confirmation could not be completed. No manual rejection was received.",
diff --git a/apps/mobile/src/i18n/locales/ja/session.json b/apps/mobile/src/i18n/locales/ja/session.json
index fa210e1747..48662c5791 100644
--- a/apps/mobile/src/i18n/locales/ja/session.json
+++ b/apps/mobile/src/i18n/locales/ja/session.json
@@ -567,6 +567,7 @@
"DEVICE_LINK_CONTROL_DISABLED": "このデバイスの操作はオフです。メッセージは送信されていません。",
"DEVICE_LINK_BUSY": "接続先のコンピュータが混み合っています。しばらくしてから再試行してください。",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "添付ファイルの転送に失敗しました。メッセージは送信されていません。もう一度お試しください。",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy が元の添付ファイルを読み取れないため、メッセージは送信されていません。「ダウンロード」などアクセス可能なフォルダーにコピーを保存し、元の添付ファイルを削除してから、添付ボタンでコピーを追加し、再送信してください。",
"MCP_APPROVAL_AUTO_BLOCKED": "このツール呼び出しは自動承認でブロックされました。手動で拒否された記録はありません。",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "権限の確認がタイムアウトし、有効な確認結果を受信できませんでした。タイムアウトだけでは、ボタンをクリックしたかどうかは判断できません。",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "権限の確認を完了できませんでした。手動で拒否された記録はありません。",
diff --git a/apps/mobile/src/i18n/locales/ko/session.json b/apps/mobile/src/i18n/locales/ko/session.json
index 7e93db762b..a002183b13 100644
--- a/apps/mobile/src/i18n/locales/ko/session.json
+++ b/apps/mobile/src/i18n/locales/ko/session.json
@@ -563,6 +563,7 @@
"DEVICE_LINK_CONTROL_DISABLED": "이 기기의 제어가 꺼져 있어 메시지가 전송되지 않았습니다.",
"DEVICE_LINK_BUSY": "원격 컴퓨터가 사용 중입니다. 잠시 후 다시 시도해 주세요.",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "첨부 파일 전송에 실패했습니다. 메시지가 전송되지 않았습니다. 다시 시도하세요.",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy가 원본 첨부 파일을 읽을 수 없어 메시지가 전송되지 않았습니다. 다운로드 등 접근 가능한 폴더에 사본을 저장하고, 원본 첨부 파일을 제거한 뒤 첨부 버튼으로 사본을 추가하여 다시 전송하세요.",
"MCP_APPROVAL_AUTO_BLOCKED": "자동 승인이 이 도구 호출을 차단했습니다. 직접 거부한 기록은 없습니다.",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "권한 확인 시간이 초과되어 유효한 확인 결과를 받지 못했습니다. 시간 초과만으로는 버튼을 클릭했는지 알 수 없습니다.",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "권한 확인을 완료하지 못했습니다. 직접 거부한 기록은 없습니다.",
diff --git a/apps/mobile/src/i18n/locales/zh-CN/session.json b/apps/mobile/src/i18n/locales/zh-CN/session.json
index bf67dd4065..af386a08c8 100644
--- a/apps/mobile/src/i18n/locales/zh-CN/session.json
+++ b/apps/mobile/src/i18n/locales/zh-CN/session.json
@@ -563,6 +563,7 @@
"DEVICE_LINK_CONTROL_DISABLED": "已关闭对该设备的控制,消息未发送。",
"DEVICE_LINK_BUSY": "远端繁忙,请稍后重试。",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "附件传输失败,消息未发送。请重试。",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy 无法读取源附件,消息未发送。请将文件另存到“下载”或其他可访问的文件夹,移除原附件,再用附件按钮添加副本后发送。",
"MCP_APPROVAL_AUTO_BLOCKED": "这次工具调用被自动审批拦截,未收到你手动拒绝的记录。",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "权限确认超时,未收到有效的确认结果。仅凭超时无法判断你是否点过按钮。",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "这次权限确认未完成,未收到你手动拒绝的记录。",
diff --git a/apps/mobile/src/i18n/locales/zh-TW/session.json b/apps/mobile/src/i18n/locales/zh-TW/session.json
index 398f89b073..9bd34d5101 100644
--- a/apps/mobile/src/i18n/locales/zh-TW/session.json
+++ b/apps/mobile/src/i18n/locales/zh-TW/session.json
@@ -567,6 +567,7 @@
"DEVICE_LINK_CONTROL_DISABLED": "已關閉對該裝置的控制,訊息未傳送。",
"DEVICE_LINK_BUSY": "遠端忙碌中,請稍後再試。",
"DEVICE_LINK_MEDIA_TRANSFER_FAILED": "附件傳輸失敗,訊息未傳送。請重試。",
+ "DEVICE_LINK_MEDIA_ACCESS_DENIED": "Cindy 無法讀取來源附件,訊息未傳送。請將檔案另存到「下載」或其他可存取的資料夾,移除原附件,再用附件按鈕加入副本後傳送。",
"MCP_APPROVAL_AUTO_BLOCKED": "這次工具呼叫被自動審批攔截,未收到你手動拒絕的紀錄。",
"MCP_APPROVAL_CONFIRMATION_TIMEOUT": "權限確認逾時,未收到有效的確認結果。僅憑逾時無法判斷你是否點過按鈕。",
"MCP_APPROVAL_CONFIRMATION_UNAVAILABLE": "這次權限確認未完成,未收到你手動拒絕的紀錄。",
diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.md
index b823b7765c..a16e4645b8 100644
--- a/docs/dev-rules/protocol-compatibility.md
+++ b/docs/dev-rules/protocol-compatibility.md
@@ -624,6 +624,17 @@ warn/warning 状态检查项、等待或处理中的检查项和 warning issue
重试说明。实现与回归见 `shared/skillhubPublishErrors.ts`、`publishService.test.ts`、
`PublishDialog.feedback.test.tsx` 和 `ScanResultDialog.test.tsx`。
+## 桌面出站附件的本机读取拒绝(#6530)
+
+控制端上传附件时,仅将源路径一致的文件系统 `open/stat/read` 的 `EPERM/EACCES`
+标记为 `DEVICE_LINK_MEDIA_ACCESS_DENIED`。源文件拒绝不触发直连冷却、连接关闭或 OSS
+回退;消息仍整条不派发。网络、远端和其他路径的错误保留原有传输失败语义。
+该错误经现有 IPC 错误封装返回,不携带原始私人路径;Desktop 与 Mobile 的错误展示
+提供五语“另存到可访问文件夹、移除旧附件、用附件按钮重选”指引。
+不新增 channel、relay 字段或权限。生成该错误的是桌面控制端,不要求目标设备升级;
+旧客户端遇到历史里的未知错误仍走原通用提示。SSH 的远端文件读取流程不变。
+这不授予 macOS 文件权限,也不证明微信拖入的系统授权生命周期已修复。
+
## 电脑互联的消息文件与历史变更
跨电脑任务复制使用同账号业务通道 `maker:task-copy`,受信 Renderer 使用 `task-copy:request`。
diff --git a/packages/maker-shared/src/errorRedaction.test.ts b/packages/maker-shared/src/errorRedaction.test.ts
index 4d054e4439..cec2566e0e 100644
--- a/packages/maker-shared/src/errorRedaction.test.ts
+++ b/packages/maker-shared/src/errorRedaction.test.ts
@@ -276,7 +276,7 @@ describe('isGatewayProxyTokenInvalidError', () => {
describe('agent error envelopes shared by desktop and mobile', () => {
- it.each(['REMOTE_LOCAL_ONLY_PROVIDER', 'DEVICE_LINK_MEDIA_TRANSFER_FAILED', 'DEVICE_LINK_BUSY', 'MCP_APPROVAL_CONFIRMATION_TIMEOUT', 'AUTO_REVIEW_UNAVAILABLE'])(
+ it.each(['REMOTE_LOCAL_ONLY_PROVIDER', 'DEVICE_LINK_MEDIA_TRANSFER_FAILED', 'DEVICE_LINK_MEDIA_ACCESS_DENIED', 'DEVICE_LINK_BUSY', 'MCP_APPROVAL_CONFIRMATION_TIMEOUT', 'AUTO_REVIEW_UNAVAILABLE'])(
'parses %s directly and inside an IPC error', code => {
for (const prefix of ['', "Error invoking remote method 'maker:send': Error: "]) {
expect(parseAgentErrorCode(`${prefix}[${code}] first line\nsecond line`)).toEqual({ code, fallback: 'first line\nsecond line' });
diff --git a/packages/maker-shared/src/errorRedaction.ts b/packages/maker-shared/src/errorRedaction.ts
index 482fef8e68..22a633e025 100644
--- a/packages/maker-shared/src/errorRedaction.ts
+++ b/packages/maker-shared/src/errorRedaction.ts
@@ -221,6 +221,7 @@ const AGENT_CHAT_ERROR_CODES: ReadonlySet<string> = new Set([
'DEVICE_LINK_BUSY',
'DEVICE_LINK_CONTROL_DISABLED',
'DEVICE_LINK_MEDIA_TRANSFER_FAILED',
+ 'DEVICE_LINK_MEDIA_ACCESS_DENIED',
'AUTO_REVIEW_UNAVAILABLE',
'AUTO_REVIEW_CONFIRM_UNDELIVERED',
'MCP_APPROVAL_AUTO_BLOCKED',