mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-22 23:44:11 +00:00
* feat(cli): add /compress-fast command for no-LLM rule-based context compression
Adds /compress-fast, a new slash command that compresses context without
any LLM side-query. It combines two rule-based steps:
1. Force microcompaction — clears old tool results and media parts,
keeping the most recent N (default 5, configurable via
toolResultsNumToKeep). Uses a new { force: true } option on
microcompactHistory() to skip the time-based trigger.
2. Strip thinking blocks — removes thought parts from all model turns,
keeping text and tool_use parts intact.
Uses setHistory() for zero-latency history replacement (no session
rebuild, deferred tools survive). Writes a chat_compression checkpoint
to JSONL so --resume works identically to /compress.
Post-compression, tryCompressChatFast() surgically disarms affected
file paths from FileReadCache via markReadEvictedFromHistory(), falling
back to clear() only when paths can't be resolved.
Resolves #4264.
* fix(cli): address review comments for /compress-fast PR
- Add test coverage for tryCompressChatFast FileReadCache disarming
(NOOP, clear, surgical disarm with inode miss, full success)
- Fix weak assertions in geminiChat compressFast tests:
- NOOP test now strictly asserts CompressionStatus.NOOP
- lastPromptTokenCount test guarantees COMPRESSED with larger history
- Register 'No compression needed.' i18n key in en/zh/zh-TW locales
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
* fix(core): address remaining review comments for /compress-fast PR
- Fix token estimation: use same estimator (estimateContentTokens) on
both sides of the NOOP gate, then delta-adjust API-authoritative
lastPromptTokenCount instead of replacing it with char/4 heuristic
- Handle lastPromptTokenCount=0 fallback for fresh/continued sessions
- Extract duplicated FileReadCache disarm logic into shared
disarmFileReadCacheAfterEviction() method with debug logs
- Remove redundant setLastPromptTokenCount call from tryCompressChatFast
- Update tests for delta-adjustment and zero-fallback behavior
* fix(cli,core): address second-round review feedback
- Add telemetry: emit logChatCompression event in compressFast() for usage tracking
- Add /compress-fast to docs/users/features/commands.md
- Use CompressionStatus.NOOP enum instead of token count comparison for NOOP detection
- Deduplicate disarm logic in microcompactIdleHistory to use shared disarmFileReadCacheAfterEviction method (resolves conflict with upstream #4840)
---------
Co-authored-by: 俊良 <zzj542558@alibaba-inc.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
|
||
|---|---|---|
| .. | ||
| design | ||
| developers | ||
| e2e-tests | ||
| plans | ||
| superpowers | ||
| users | ||
| verification/abort-controller-refactor | ||
| _meta.ts | ||
| declarative-agents-port.md | ||
| index.md | ||