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 `<testDir>/.qwen-home`, and the parity
rig forwarded only QWEN_HOME to both ACP surfaces. Session runtime state
(`tmp/<hash>`, token usage) therefore landed inside the workspace, so the
folder-structure snapshot embedded in each request listed
`.qwen-home/tmp/<hash>` 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/<hash>` 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
`<testDir>/.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 <[email protected]>
Patrol-Run: qwen-pr-closeout/jmw14zt15bk

---------

Co-authored-by: Qwen-Coder <[email protected]>
This commit is contained in:
易良andQwen-Coder authored and GitHub committed 2026-11-04 08:00:28 +08:00
1 parent aaf523cfc4
commit 80953e053b
1 file changed
+14 -1
@@ -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/<hash>` 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/<hash>`
// 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) =>