fix(serve): keep daemon Git guard out of serve fast-path closure

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Shaojin Wen 2026-08-07 19:23:51 +00:00
parent 2af741937b
commit b1b7606052

View file

@ -135,7 +135,6 @@ import type {
ChannelDeliveryHostResult,
ExternalToolGuardHandler,
} from '@qwen-code/acp-bridge/bridgeOptions';
import { createDaemonToolGuard } from './daemon-git-worktree-guard.js';
import { getCliVersion } from '../utils/version.js';
import { getRateLimiter } from './rate-limit.js';
import type { AcpHttpHandle } from './acp-http/index.js';
@ -2800,6 +2799,11 @@ async function runQwenServeImpl(
'qwen serve: required external tool guard handshake succeeded.',
);
}
// Dynamic-imported (not at module scope) so the guard's core helper
// imports stay out of the serve fast-path bundle closure.
const { createDaemonToolGuard } = await import(
'./daemon-git-worktree-guard.js'
);
const daemonToolGuardHandler = createDaemonToolGuard(
externalToolGuardHandler,
);