mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-09-11 19:46:21 +00:00
* fix(test): stop measuring model latency anywhere under CI (#11271) The prompt-latency probe in qwen-serve-baseline sends 20 real prompts through the shared OpenAI-compatible gateway and asserts p99 < 60s. One gateway-queued prompt in twenty fails it, and each vitest retry re-issues all 20 prompts into the same degraded window, so a single slow window fails every attempt and turns the shard red. Since the pool skip (#11004) the probe runs on exactly one E2E leg — macOS shard 2/2, the only shard holding the file — and that leg failed twice within six hours on unrelated commits (runs 34070970091 and 34088422718, both full-duration with retries consumed) while every Linux leg, macOS shard 1/2, and the OpenTUI leg stayed green. The measured quantity is gateway weather, not the daemon; the same argument the pool skip made for host contention applies to the shared gateway. Skip the probe whenever CI is set (any populated CI marker, matching the repo's other CI checks), keeping the self-hosted disjunct so a pool-shaped shell outside CI keeps its specific skip reason. The probe still runs off CI on a credential, and QWEN_BASELINE_ENABLE_PROMPT_LATENCY=1 force-runs it anywhere. The skip reason distinguishes CI gateway contention from pool host contention. * fix(test): tolerate transient model-serving errors in the acp plan-mode case (#11271) The CI-wide prompt-latency skip rested on a misattribution: in both cited runs the latency probe ran and passed, and the macOS leg went red on cli/acp-integration.test.ts > blocks write tools in plan mode — killed by a transient model-serving -32603 returned over ACP, with the retry attempt then tripping ENOTEMPTY on the previous attempt's leftover .qwen-home. Revert the CI skip, re-issue the plan-mode session/prompt on the observed gateway -32603 shape (bounded at 3 attempts, 2s apart, inside the existing per-request timeout), and let the TestRig.setup directory reset retry through the mid-delete refill race the way globalSetup's teardown already does. * test(e2e): isolate protocol checks from model service * fix(test): surface fake-server setup failures in json-output teardown (#11271) Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(test): close ACP teardown race and tighten fake-server E2E (#11271) - Move per-agent QWEN_HOME out of rig.testDir: the agent keeps writing there ~300ms after exit, racing global teardown's recursive rm (ENOTEMPTY). cleanup() now removes it with retries. - Drop the plan-mode test's permissionHandler: the plan-mode guard short-circuits before any permission request, so it could never run and its comment claimed coverage the test does not have. - Name the collected tool-call events in the plan-mode assertion so a wire-shape drift is distinguishable from a plan-mode let-through. - Stub loopback NO_PROXY in json-output tests: an inherited HTTP(S)_PROXY otherwise tunnels the fake-server POST and the cases time out. Two-chunk fixture restores multi-delta accumulator coverage. - Make the auth-mismatch case hermetic via fakeModelArgs instead of the ambient OPENAI_* secrets. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(test): reclaim leaked ACP qwen homes and unify scratch teardown (#11271) --------- Co-authored-by: yiliang114 <effortyiliang@gmail.com> Co-authored-by: 易良 <1204183885@qq.com> Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2026 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
import { tmpdir } from 'node:os';
|
|
import { join } from 'node:path';
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
|
|
import { removeScratchDir } from './scratch-dir.js';
|
|
|
|
describe('removeScratchDir', () => {
|
|
let tmpRoot: string;
|
|
|
|
beforeEach(async () => {
|
|
tmpRoot = await mkdtemp(join(tmpdir(), 'qwen-scratch-dir-test-'));
|
|
});
|
|
|
|
afterEach(async () => {
|
|
vi.restoreAllMocks();
|
|
await rm(tmpRoot, { recursive: true, force: true });
|
|
});
|
|
|
|
it('warns and resolves when the dir cannot be removed', async () => {
|
|
// A cleanup that cannot finish must not turn an all-green run red
|
|
// (#10325). ENOTDIR is outside rm's retryable codes, so the rejection
|
|
// reaches the catch deterministically instead of racing a retry window.
|
|
const warn = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
const file = join(tmpRoot, 'not-a-dir');
|
|
await writeFile(file, 'x');
|
|
const stuck = join(file, 'child');
|
|
|
|
await expect(removeScratchDir(stuck)).resolves.toBeUndefined();
|
|
|
|
expect(warn).toHaveBeenCalledWith(
|
|
`Warning: could not remove ${stuck}:`,
|
|
expect.anything(),
|
|
);
|
|
});
|
|
});
|