From 80953e053b40159d8498ece9d34112785a002aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=93=E8=89=AF?= <1204183885@qq.com> Date: Wed, 4 Nov 2026 08:00:28 +0800 Subject: [PATCH] test(integration): give the ACP parity rig a scratch runtime directory (#16224) * test(integration): give the ACP parity rig a scratch runtime directory TestRig points QWEN_RUNTIME_DIR at `/.qwen-home`, and the parity rig forwarded only QWEN_HOME to both ACP surfaces. Session runtime state (`tmp/`, token usage) therefore landed inside the workspace, so the folder-structure snapshot embedded in each request listed `.qwen-home/tmp/` for the surface that inherited the rig's runtime and not for the other: `expect(shared.requests).toEqual(current.requests)` then failed whenever that ordering broke, and the retry went green (run 41668631944, first attempt failing three parity cases). Point QWEN_RUNTIME_DIR at the same scratch home as QWEN_HOME so neither surface writes into the workspace. Verified with the fixed bundle: 24/24 parity cases pass. With KEEP_OUTPUT, the test directory now holds `.qwen-home/settings.json` and `trustedFolders.json` only, where origin/main additionally creates `.qwen-home/tmp/` for the same case. * test(integration): keep the ACP parity scratch runtime under KEEP_OUTPUT Checkpoint for review suggestions R1-1/R1-2 on #16224. The parity rig now keeps its scratch QWEN_HOME when KEEP_OUTPUT is set, matching TestRig.cleanup()'s truthiness check, and pins the absence of the default `/.qwen-home/tmp` runtime directory directly instead of relying on the request-snapshot diff. Not verified locally: `npm run bundle` cannot resolve the generated web-templates sources in this worktree, so the parity case was not executed. Co-authored-by: Qwen-Coder Patrol-Run: qwen-pr-closeout/jmw14zt15bk --------- Co-authored-by: Qwen-Coder --- .../cli/acp-agent-loop-parity.test.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/integration-tests/cli/acp-agent-loop-parity.test.ts b/integration-tests/cli/acp-agent-loop-parity.test.ts index d6410cd564b..0be7a019fff 100644 --- a/integration-tests/cli/acp-agent-loop-parity.test.ts +++ b/integration-tests/cli/acp-agent-loop-parity.test.ts @@ -302,6 +302,11 @@ const allowOnce = () => ({ NO_PROXY: noProxy, no_proxy: noProxy, QWEN_HOME: qwenHome, + // TestRig keeps QWEN_RUNTIME_DIR inside the workspace; leaving it + // there makes the session runtime write `tmp/` into the test + // directory, which then differs between the two surfaces' request + // snapshots. Give both surfaces the same scratch runtime. + QWEN_RUNTIME_DIR: qwenHome, }; delete env['QWEN_CODE_ENABLE_UNIFIED_AGENT_LOOP']; if (shared) env['QWEN_CODE_ENABLE_UNIFIED_AGENT_LOOP'] = '1'; @@ -496,8 +501,16 @@ const allowOnce = () => ({ if (agent.exitCode !== null || agent.signalCode) resolve(undefined); else agent.once('exit', resolve); }); - await removeScratchDir(qwenHome); + // Keep the runtime state for post-mortem whenever TestRig.cleanup() + // keeps the test directory, which it decides by truthiness. + if (!process.env['KEEP_OUTPUT']) { + await removeScratchDir(qwenHome); + } } + // The scratch runtime is what keeps the session runtime's `tmp/` + // out of the workspace, so pin its absence rather than relying on the + // snapshot diff, which only trips on the losing side of a race. + expect(existsSync(join(dir, '.qwen-home', 'tmp'))).toBe(false); return { requests: modelRequests(server, dir), dateReminders: streamingMessages(server).filter((messages) =>