14 Commits
Author SHA1 Message Date
Shaojin WenandQwen-Coder 36c8b34222 perf(core): load the MCP client's Google auth providers on demand (#16242)
* perf(core): load the MCP client's Google auth providers on demand

mcp-client imported GoogleCredentialProvider and
ServiceAccountImpersonationProvider statically, so every process that
loads the MCP client, including each resident Managed Runtime worker,
also loaded google-auth-library whether or not any server uses Google
authentication. createTransport is already async; import each provider
only for a server configured with it.

Add transport tests for the service-account impersonation provider,
which had none in this file. On Linux x86_64 an idle worker loads
0.24 MiB less JavaScript and holds 0.9 MiB less private memory.

* fix(core): ask for a restart when a Google auth provider chunk is missing

Now that the MCP client imports its Google auth providers on demand, the
bundle puts them in separate chunks. A background update that replaces
dist under a long-lived process made the next connection fail with
"Cannot find module", wrapped as a connection error for the server.

Move the restart guidance that contentGenerator already gives for its lazy
provider chunks into utils/errors (getModuleNotFoundError,
wrapLazyModuleLoadError) and apply it to both provider imports. The
original error stays as the cause.

Add google-auth-library to the ACP static closure guard, so a static
import of either provider fails check-serve-fast-path-bundle again.

* test(core): isolate the lazy Google auth chunk tests in their own file

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-11-05 18:08:58 +00:00
Shaojin Wen fa336618c2 refactor(serve): separate ACP control plane and channel harness (#11916) 2026-09-16 07:24:11 +00:00
易良andqwen-code-dev-bot 983fafd1ed refactor(core,cli): rename generic Gemini identifiers to Llm (#10124)
* refactor(core,cli): rename Gemini residue in memory/spinner/leaf ids

PR 1 of #4063 item 6 (de-Google naming). Renames three independent families plus the leaf LLM types:

- Memory filename: GeminiMd* -> Memory* (project memory file, not an LLM client)

- UI spinners: GeminiRespondingSpinner/GeminiSpinner -> RespondingSpinner/Spinner

- Leaf types: GeminiCodeRequest/GeminiChatSendOptions/GeminiErrorEventValue/GeminiFinishedEventValue -> Llm*

- geminiRequest.ts -> llm-request.ts (and its collocated test)

No behavior change. Renamed symbols typecheck clean in core+cli; eslint clean on renamed files.

Refs #4063

* fix(cli): resolve rename build failure

* docs(serve): fix memory filename references

* test(cli): pin primary workspace QWEN.md init fallback

Assert that the primary daemon workspace service receives the
hard-coded 'QWEN.md' context filename when boot settings carry no
context.fileName. Previously only the secondary workspace's explicit
SECONDARY.md resolution was asserted, so swapping the fallback literal
at the createDaemonWorkspaceService call site survived the suite.

* refactor(core,cli): finish Gemini residue rename in memoryDiscovery

Complete the rename flagged in review: GeminiFileContent -> MemoryFileContent (module-local interface), includeDirectoriesToReadGemini -> includeDirectoriesToReadMemory (parameter only; all call sites are positional, zero cross-package impact), plus test-local variable names and the stale ORIGINAL_GEMINI_MD_FILENAME test title.

* docs(design): route loadHierarchicalGeminiMemory to Memory naming

Per exception #1 the Llm prefix is reserved for the generic LLM-client surface; the symbol is a memory-file loader (thin wrapper around core's loadServerHierarchicalMemory), so the PR-2 symbol map targets loadHierarchicalMemory instead of loadHierarchicalLlmMemory. Doc-only: the code symbol is not renamed by this PR.

* docs(cli): narrow extractContextFilename fallback description

The undefined fallback first inherits the primary workspace's configured context.fileName snapshot (contextFilenameForInit) at the secondary startup and dynamically added workspace call sites, before the hard-coded QWEN.md. Describe the actual chain instead of the hard-coded default only. Comment-only: the inheritance behavior predates this PR and is unchanged.

* refactor(cli): rename loadHierarchicalGeminiMemory to loadHierarchicalMemory

The design doc's symbol map routes the memory loader to
loadHierarchicalMemory (memory family, exception #1), but no phasing
bullet performed the rename and a prior round left the mixed signature.
Complete the rename across the definition (config.ts), the AppContainer
call site, and the AppContainer test mocks, and update the design doc's
exception #1, symbol map, and PR-1 phasing bullet so the map row is no
longer orphaned.

* fix(core): preserve Gemini rename compatibility

* docs(core): extend Gemini deprecation window

* refactor(core,cli): rename Gemini LLM identifiers

* fix(core): retain Gemini content generator aliases

* docs(core): document legacy content generator paths

* ci: trigger checks after retargeting to main

* test(cli): update renamed LLM expectations

---------

Co-authored-by: qwen-code-dev-bot <[email protected]>
2026-08-28 03:05:49 +00:00
Shaojin Wenandverify 3ff8892a82 feat(ci): fail the startup bundle check when the CLI entry is hoisted into a chunk (#8203)
`packages/cli/src/cli.ts` is the esbuild entry point and bootstraps only under a
main-module guard:

    if (process.argv[1] !== undefined &&
        import.meta.url === pathToFileURL(process.argv[1]).href) {
      void runCliEntryPoint();
    }

The bundle is built with `splitting: true`. If any module the entry loads lazily
(e.g. `gemini.tsx`, reached through `await import('./gemini.js')`) adds a static
`import ... from './cli.js'`, esbuild moves the entry module's body into a shared
chunk and leaves `dist/cli.js` as a re-export stub. Inside a chunk
`import.meta.url` is the chunk's own URL, so the guard never matches and the
bundled CLI exits 0 without running anything.

Nothing catches that today: tsc, eslint and every src-based unit test stay green,
because the breakage only exists in the bundle. The single CI step that executes
`dist/cli.js` is the no-AK integration smoke test, which reports it as
`daemon exited with 0 before listening` from three unrelated serve suites — a
symptom that points nowhere near the import that caused it.

Assert instead that the entry output still compiles the entry module. When the
entry is hoisted, `dist/cli.js` keeps no inputs of its own, so the metafile the
existing closure checks already read is a precise signal, and the diagnostic can
name both the cause and the fix.

Co-authored-by: verify <verify@local>
2026-07-31 08:57:57 +00:00
jinyeandQwen-Coder 9bdc62c74b perf(cli): replace comment-json settings parser (#7747)
Co-authored-by: Qwen-Coder <[email protected]>
2026-07-26 14:42:51 +00:00
jinyeandQwen-Coder 8fa8085036 perf(core): Lazy-load first-use dependencies (#7686)
* perf(core): Lazy-load first-use dependencies

Co-authored-by: Qwen-Coder <[email protected]>

* test(core): Fix simple-git loader mock

Co-authored-by: Qwen-Coder <[email protected]>

* test(core): Cover abort during xterm load

Co-authored-by: Qwen-Coder <[email protected]>

* fix(core): Address lazy-loader review feedback

Co-authored-by: Qwen-Coder <[email protected]>

* fix(core): Validate lazy dependency module shapes

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-07-26 03:04:33 +00:00
jinyeandQwen-Coder 7c73768fa5 perf(startup): lazy-load Google GenAI SDK on first use (#7512)
* perf(startup): lazy-load Google GenAI SDK on first use

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#7512)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#7512)

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-07-23 02:07:39 +00:00
jinye 042f6373b7 perf(startup): Load undici lazily behind package-local dynamic imports (#7455)
* perf(startup): load undici lazily behind package-local dynamic imports

* fix(web-search): preload undici before building runtime fetch options

Address review: web search builds fetch options outside the content
generator preload path, so 33 web-search tests (and any standalone
search invocation) hit the requireUndici fail-loud guard. Also redact
and rethrow proxy dispatcher install failures, guard early promise
rejections against unhandledRejection, and pin the guard message with
a test.

* test(cli): cover loadUndici interop and gitUtils proxy path

Address review suggestions: add parameterized tests for the CJS
unwrap normalization used by both core and cli loadUndici helpers,
and verify getLatestGitHubRelease instantiates ProxyAgent when a
proxy argument is passed.

* fixup! test(cli): fix loadUndici test type errors

Export UndiciModule type and loosen test helper typing so the cli
package builds under tsc --build.
2026-07-22 00:25:52 +00:00
jinye 636971efad perf(telemetry): lazy-load the SDK and split OTLP exporter chains by protocol (#7276)
* perf(telemetry): lazy-load the SDK and split OTLP exporter chains by protocol

* fix(telemetry): close lazy SDK init/shutdown races and make load failure non-fatal

Addresses PR #7276 review feedback: shutdown now awaits an in-flight init before tearing down (was racing past the sync flag and leaking a started SDK whose buffered spans/logs never flushed); the dynamic imports now sit inside init's try so a chunk-load failure degrades telemetry instead of aborting daemon runtime startup. Also breaks the sdk<->sdk-impl import cycle via a leaf otlp-urls module, hardens the sdk-node exporter stub for thenable/interop probes with a unit-tested separator-independent resolve, lists the HTTP exporter packages explicitly in the bundle guard, and adds lazy-init lifecycle tests.
2026-07-21 07:35:30 +00:00
jinyeandQwen-Coder 86ad532deb perf(cli): Defer TUI runtime from ACP startup (#7182)
* perf(cli): Defer TUI runtime from ACP startup

Co-authored-by: Qwen-Coder <[email protected]>

* fix(cli): Preserve state on lazy import failures

Co-authored-by: Qwen-Coder <[email protected]>

* test(cli): Colocate API error classifier coverage

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-07-19 00:10:15 +00:00
jinyeandQwen-Coder b67506b70b feat(daemon): Profile ACP channel initialization (#7145)
* feat(daemon): Profile ACP channel initialization

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#7145)

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-07-18 05:27:59 +00:00
易良 6d966d2917 test(core): stabilize file history eviction test (#6637)
* test(core): stabilize file history eviction test

* ci: clean package build artifacts before fast-path check

* ci: preserve web build outputs during fast-path check
2026-07-10 06:39:52 +00:00
jinyeandQwen-Coder ea536d361f fix(cli): Handle ACP read_file for managed local paths (#6021)
* fix(cli): handle ACP read_file local roots

Allow ACP read_file calls to fall back to local reads for explicitly permitted local roots when the serve workspace boundary rejects them, and preserve useful messages for plain object read errors.

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Add the missing getUserAutoMemoryRoot export to the acpAgent test core mock so the updated acpAgent import resolves under Vitest.

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* fix(acp): Narrow local read fallback temp roots

Remove the broad OS temp directory from default read_file allow roots and ACP local read fallback roots. Keep qwen-managed temp roots readable and reuse the shared isSubpath helper after realpath resolution for ACP fallback containment.

Co-authored-by: Qwen-Coder <[email protected]>

* codex: fix CI failure on PR #6021

Add the serve fast-path bundle check script and root npm script that the current CI workflow invokes. This mirrors the already-merged mainline check without pulling unrelated workflow or test config changes into this PR.

Co-authored-by: Qwen-Coder <[email protected]>

* fix(cli): address ACP read error review feedback

Co-authored-by: Qwen-Coder <[email protected]>

* fix(cli): harden ACP error normalization

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: fix Windows CI path expectation (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#6021)

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-06-30 11:15:49 +00:00
jinyeandQwen-Coder 565e4bc437 fix(cli): Guard serve fast-path bundle closure (#5995)
* fix(cli): guard serve fast-path bundle closure

Co-authored-by: Qwen-Coder <[email protected]>

* test(cli): tighten serve fast-path bundle guard

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#5995)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#5995)

Co-authored-by: Qwen-Coder <[email protected]>

* codex: address PR review feedback (#5995)

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-06-29 14:38:32 +00:00