[codex] Harden context compression history handling (#848)

* Use token threshold for chat compression

* Add compression settings controls

* Use config for chat compression

* Cover protected messages in compression tests

* Remove message-count compression limit

* Harden compression window fallback

* Rebuild stale compression snapshots

* Harden stale compression snapshots

* Update changelog for compression hardening

* Prefer local history session details
This commit is contained in:
ekko
2026-05-19 17:58:39 +08:00
committed by GitHub
parent 84e343fc22
commit 0547fd6b6a
22 changed files with 1255 additions and 56 deletions
+14
View File
@@ -696,6 +696,7 @@ export default {
account: '帳號',
agent: '代理',
memory: '記憶',
compression: '上下文壓縮',
session: '工作階段',
privacy: '隱私',
apiServer: 'API 伺服器',
@@ -754,6 +755,18 @@ export default {
userCharLimit: '使用者畫像字元上限',
userCharLimitHint: 'USER.md 最大字元數',
},
compression: {
enabled: '啟用壓縮',
enabledHint: '長對話接近模型上下文上限前自動壓縮歷史',
threshold: '壓縮閾值',
thresholdHint: '預估 token 超過上下文比例時開始壓縮',
targetRatio: '目標比例',
targetRatioHint: '壓縮後歷史保留到上下文的目標比例',
protectLastN: '保護最近訊息',
protectLastNHint: '最近多少則訊息不參與壓縮',
protectFirstN: '保護開頭訊息',
protectFirstNHint: '最早多少則訊息不參與壓縮',
},
session: {
mode: '重設模式',
modeHint: '工作階段重設的觸發條件',
@@ -1243,6 +1256,7 @@ export default {
new_0_5_30_6: '優化 Windows 相容性:路徑識別、檔案下載、任務/更新子程序不再彈出額外終端視窗',
new_0_5_30_7: '修復配置寫入和 Provider 預設:加強 .env 校驗,FUN-Codex 改走 Responses API,並更新 Z.AI/GLM 模型列表',
new_0_5_30_8: '前端體驗細節優化:折疊側邊欄布局、分組短標題、側邊欄分隔線和對話大綱樣式更穩定',
new_0_5_30_9: '上下文壓縮現在跟隨 Profile 壓縮配置,並在舊快照失效時複用舊摘要和安全尾部,避免重新壓縮完整歷史',
new_0_5_6_1: '新增語音播放功能:使用 Web Speech API,支援手動播放按鈕、自動播放開關、彩虹邊框動畫和行動端最佳化',
new_0_5_6_2: '新增強健的 LLM JSON 解析器,相容 Python 格式並從串流事件中擷取文字',
new_0_5_6_3: 'Skills 功能增強:使用統計、來源過濾、封存技能、來源追溯和釘選切換',