mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-23 07:54:11 +00:00
* fix(cli): Preserve mid-turn image messages Preserve image attachments and structured content when user messages are drained during tool execution. Keep text-only behavior compatible while preventing attachment-only or missing-base64 image messages from being acknowledged before they can be replayed safely. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * codex: address PR review feedback (#5183) Fix the lint blockers, preserve legacy mid-turn messages when structured items are empty, share the mid-turn prefix helper, and record mid-turn @ command reads without adding UI tool groups. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): Harden mid-turn message drain Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): Enforce mid-turn resolve timeout Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): Address mid-turn review suggestions Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * codex: address PR review feedback (#5183) Bound mid-turn @ resolution with a per-message timeout and surfaced attachment failures to the user before falling back to raw text. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * codex: address PR review feedback (#5183) Surface mid-turn at-command tool displays, validate ACP inline media MIME prefixes, and add focused coverage for mid-turn message prefixing. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * codex: address PR review feedback (#5183) Stop processing drained mid-turn messages once cancellation aborts at-command resolution, avoiding stale fallback notifications and recordings. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): Address mid-turn review feedback Skip mid-turn @ injections when attachment resolution fails, acknowledge image-only desktop queue entries by optimistic id, and make structured ACP mid-turn failures visible through a fallback notice and diagnostics. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): Harden mid-turn drain edge cases Handle additional mid-turn drain review feedback by logging unknown drain schemas, preserving accumulated parts during abort, acknowledging drained image-only messages more robustly, and avoiding empty text blocks for attachment-only prompts. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * test(cli): Cover mid-turn drain review cases Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(desktop): Remove unused mid-turn attachment argument Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(desktop): Harden mid-turn drain acknowledgements Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): Skip failed mid-turn at-command injection Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(desktop): Simplify mid-turn drain acknowledgements Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(desktop): Use stable mid-turn drain ack keys Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): Handle mid-turn image drain failures Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): Bound mid-turn drain fallbacks Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix: Bound mid-turn attachment handling Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix: Harden mid-turn attachment edge cases Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> --------- Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Co-authored-by: 易良 <1204183885@qq.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2026 Qwen
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { describe, expect, it } from 'vitest';
|
|
import type { Part } from '@google/genai';
|
|
import {
|
|
MID_TURN_USER_MESSAGE_PREFIX,
|
|
prefixMidTurnUserMessageParts,
|
|
} from './midTurnUserMessage.js';
|
|
|
|
describe('prefixMidTurnUserMessageParts', () => {
|
|
it('returns a text-only part when parts normalize to empty', () => {
|
|
expect(prefixMidTurnUserMessageParts([], 'fallback')).toEqual([
|
|
{ text: `${MID_TURN_USER_MESSAGE_PREFIX}fallback` },
|
|
]);
|
|
});
|
|
|
|
it('prepends the prefix to the first text part', () => {
|
|
const parts: Part[] = [{ text: 'hello' }, { text: 'world' }];
|
|
|
|
expect(prefixMidTurnUserMessageParts(parts, 'hello')).toEqual([
|
|
{ text: `${MID_TURN_USER_MESSAGE_PREFIX}hello` },
|
|
{ text: 'world' },
|
|
]);
|
|
});
|
|
|
|
it('prepends a text prefix before non-text first parts', () => {
|
|
const imagePart: Part = {
|
|
inlineData: { mimeType: 'image/png', data: 'abc' },
|
|
};
|
|
|
|
expect(prefixMidTurnUserMessageParts([imagePart], 'inspect this')).toEqual([
|
|
{ text: `${MID_TURN_USER_MESSAGE_PREFIX}inspect this` },
|
|
imagePart,
|
|
]);
|
|
});
|
|
});
|