qwen-code/docs/e2e-tests
易良 a3037889a6
fix(core): replace structuredClone with shallow copy to prevent OOM in long sessions (#4286)
* docs: add OOM investigation reports and auto-compaction redesign proposal

- Runtime memory investigation plan
- Non-interactive memory benchmark report
- OOM reproduction report with 2GiB/4GiB synthetic tests
- Runtime diagnostics benchmark report
- Auto-compaction threshold redesign proposal

* fix(core): replace structuredClone with shallow copy to prevent OOM

Replace `structuredClone(this.history)` (called up to 4x per turn on the
send path) with a lightweight shallow copy via `copyContentContainer()`.
This eliminates the OOM root cause in long tool-heavy sessions where the
full deep clone exceeded remaining V8 heap headroom.

Key changes:
- Add `copyContentContainer()` helper ({...content, parts: [...parts]})
- Add `getRequestHistory()` private method for the send path
- Add `getHistoryShallow()`, `getHistoryTailShallow()`,
  `peekLastHistoryEntry()`, `getLastModelMessageText()`,
  `getHistoryLength()` for read-only callers
- Remove HEAP_PRESSURE_COMPRESSION_RATIO safety net (no longer needed
  now that the underlying OOM cause is fixed)
- Update chatCompressionService to use getHistoryShallow(true)
- Update nextSpeakerChecker to send only lastMessage (not full history)
- Update memoryDiagnostics with process-tree RSS measurement

* feat(core): add runtimeDiagnostics utility for heap/memory instrumentation

Required by content generators (anthropic, openai, logging) which import
runtimeDiagnostics for optional heap-pressure telemetry during streaming.
Gated by QWEN_CODE_PROFILE_RUNTIME=1 environment variable.

* fix(cli): update doctorCommand test mocks for new MemoryDiagnostics interface

Add missing maxRSSRaw, maxRSSUnit, and processTree fields to test fixtures
to match the updated MemoryResourceUsage and MemoryDiagnostics interfaces.

* fix(vscode-ide-companion): use public core imports

* fix: address review comments — type guards, dead fallbacks, and doc accuracy

Code:
- Fix unsound type guard: `'text' in part` → `typeof part.text === 'string'`
  in geminiChat.ts and client.ts (Copilot + wenshao feedback)
- Remove unnecessary optional chaining and dead fallback chains in client.ts
  (getHistoryShallow, peekLastHistoryEntry, getHistoryLength, etc. now call
  GeminiChat methods directly)
- Add 5s timeout to `execFileAsync('ps', ...)` in memoryDiagnostics.ts

Docs:
- Fix GiB conversion accuracy and add single-run caveat to summary
- Add Node.js version to test environment table
- Fix auto-compaction attempt count (5→4) in OOM report
- Soften root-cause attribution certainty
- Add MCP child process context to investigation plan
- Clarify "Codex" reference (→ OpenAI Codex)
- Fix truncated MCP server name (chrome → chrome-devtools)
- Remove duplicate verification commands in benchmark table
- Clarify thread exhaustion vs V8 heap OOM distinction
- Add workload confound caveat to before/after comparison
- Fix SUMMARY_RESERVE "hard relationship" vs thinking budget contradiction

* fix(core): restore fallback chains in client.ts for mock compatibility

The previous commit removed optional chaining from client.ts wrapper
methods, but client.test.ts mocks getChat() with partial objects that
lack the new shallow methods. Restore ?. fallback chains so both
production (GeminiChat) and test (mock) paths work correctly.

* docs: clarify memory review follow-ups

* docs: fix runtime benchmark unit conversion

* docs: add default-heap OOM stress report

* fix: update copyright year to 2026 in new files [skip ci]

New files added in this PR had 2025 copyright headers. Updated to 2026
to reflect the current year.
2026-05-21 10:28:59 +08:00
..
2026-05-18-qwen-memory-benchmark-report.md fix(core): replace structuredClone with shallow copy to prevent OOM in long sessions (#4286) 2026-05-21 10:28:59 +08:00
2026-05-19-oom-reproduction-report.md fix(core): replace structuredClone with shallow copy to prevent OOM in long sessions (#4286) 2026-05-21 10:28:59 +08:00
2026-05-19-qwen-runtime-diagnostics-benchmark-report.md fix(core): replace structuredClone with shallow copy to prevent OOM in long sessions (#4286) 2026-05-21 10:28:59 +08:00
2026-05-21-qwen-0.15.11-default-heap-oom-stress-report.md fix(core): replace structuredClone with shallow copy to prevent OOM in long sessions (#4286) 2026-05-21 10:28:59 +08:00
worktree-phase-c.md feat(worktree): Phase C — session persistence, hooksPath, Footer + WorktreeExitDialog, three-mode --resume restore (#4174) 2026-05-19 13:59:35 +08:00
worktree.md feat(tools): add generic worktree support — EnterWorktree/ExitWorktree + Agent isolation (#4073) 2026-05-14 18:00:30 +08:00