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(orca): 带图 no-live 目标改为携 files 入队,不再拒绝

Zhang Yunjin1d835ef6466f
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/orcaInterAgentDispatcher.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/orcaInterAgentDispatcher.test.ts
index 01b4c08d81..5dddb2f46b 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/orcaInterAgentDispatcher.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/orcaInterAgentDispatcher.test.ts
@@ -396,6 +396,34 @@ describe('Orca lead/worker dispatcher', () => {
expect(invalid.liveSession.send).not.toHaveBeenCalled();
});
+ it('queues image attachments for a no-live target instead of failing after rollover', async () => {
+ const validateImageAttachments = vi.fn(async (paths: string[]) => ({
+ ok: true as const,
+ images: paths.map((p) => ({
+ path: p, name: p.split(/[\\/]/).pop() ?? p, ext: '.png', size: 10, mimeType: 'image/png',
+ })),
+ }));
+ const h = createHarness({
+ validateImageAttachments,
+ prepareUnhealthySession: vi.fn(async () => true),
+ getLiveSession: vi.fn(() => null),
+ });
+
+ const result = await h.dispatcher.dispatchOrEnqueueOrcaInterAgentMessage({
+ targetSessionId: 'target-session',
+ rawContent: 'Check after rollover',
+ source: 'lead',
+ senderLabel: 'Lead',
+ imagePaths: ['C:/tmp/a.png'],
+ meta: { source: 'orca', context: 'images-no-live-test' },
+ });
+
+ expect(result).toMatchObject({ ok: true, mode: 'queued', clientId: 'client-1' });
+ const item = firstQueuedItem(h.queuedItems);
+ expect(item.files?.map((file) => file.path)).toEqual(['C:/tmp/a.png']);
+ expect(h.deps.sendToSessionInternal).not.toHaveBeenCalled();
+ });
+
it('prepares an unhealthy live session before direct send and does not reuse the closed handle', async () => {
const closed = { current: false };
const liveSession = createLiveSession(async (_message, opts) => {
diff --git a/apps/desktop/src/main/maker-ipc/orcaInterAgentDispatcher.ts b/apps/desktop/src/main/maker-ipc/orcaInterAgentDispatcher.ts
index ceafa1d6be..a29784f663 100644
--- a/apps/desktop/src/main/maker-ipc/orcaInterAgentDispatcher.ts
+++ b/apps/desktop/src/main/maker-ipc/orcaInterAgentDispatcher.ts
@@ -685,16 +685,10 @@ export function createOrcaInterAgentDispatcher<TSessionMeta>(
? await deps.withSendToSessionLock(params.targetSessionId, dispatchLive)
: await dispatchLive();
if (liveResult) return liveResult;
- // 带图时 no-live 回退路径(sendToSessionInternal 重建)只支持纯文本,宁拒勿静默丢图。
+ // 带图 no-live(换窗/重建中)与纯文本排队语义对齐:携 files 入队,
+ // drain 经 sendToAgent 用 createOpts 重建 session 后送达,不静默丢图。
if (imageFiles.length > 0) {
- return failureResult({
- ...createHostSendFailure(
- 'SEND_FAILED',
- 'image attachments require a live local session; retry after the target session is available',
- ),
- source: params.meta.source,
- context: params.meta.context,
- });
+ return enqueueQueuedMessage('orca inter-agent message queued for no-live target with images');
}
return await sendToInternal();
} catch (err) {