[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
@@ -708,6 +708,7 @@ export default {
account: '账户',
agent: '代理',
memory: '记忆',
compression: '上下文压缩',
session: '会话',
privacy: '隐私',
apiServer: 'API 服务器',
@@ -766,6 +767,18 @@ export default {
userCharLimit: '用户画像字符上限',
userCharLimitHint: 'USER.md 最大字符数',
},
compression: {
enabled: '启用压缩',
enabledHint: '长对话接近模型上下文上限前自动压缩历史',
threshold: '压缩阈值',
thresholdHint: '预计 token 超过上下文比例时开始压缩',
targetRatio: '目标比例',
targetRatioHint: '压缩后历史保留到上下文的目标比例',
protectLastN: '保护最近消息',
protectLastNHint: '最近多少条消息不参与压缩',
protectFirstN: '保护开头消息',
protectFirstNHint: '最早多少条消息不参与压缩',
},
session: {
mode: '重置模式',
modeHint: '会话重置的触发条件',
@@ -1253,6 +1266,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 格式并从流式事件中提取文本',