缺陷 / 严重 / Agent 引擎
electron/harness/agent-loop/engine.ts (DEFAULT_CONFIG.contextWindow = 128_000)
electron/harness/agent-loop/engine.ts
Engine 的 DEFAULT_CONFIG.contextWindow 硬编码为 128_000,而各 Provider 实际支持的上下文窗口差异巨大:
DEFAULT_CONFIG.contextWindow
Engine 在初始化和 runStream 时从未调用 adapter.getContextWindow() 同步该值,导致:
adapter.getContextWindow()
compressionThreshold * contextWindow
这违反了 project_memory.md 中的硬性约束:
Engine context window must be synchronized with the LLM adapter's configured context window value
在 runStream 开始处同步:
runStream
private async executeRunStream(...) { // ... // 同步 adapter 的 contextWindow 到 Engine 配置 const adapterCtx = this.adapter.getContextWindow?.(); if (adapterCtx && adapterCtx > 0) { this.config.contextWindow = adapterCtx; } // ... }
同时在 setAdapter 热切换时也要同步。
setAdapter
No dependencies set.
The note is not visible to the blocked user.
问题类型
缺陷 / 严重 / Agent 引擎
文件位置
electron/harness/agent-loop/engine.ts(DEFAULT_CONFIG.contextWindow = 128_000)问题描述
Engine 的
DEFAULT_CONFIG.contextWindow硬编码为 128_000,而各 Provider 实际支持的上下文窗口差异巨大:Engine 在初始化和 runStream 时从未调用
adapter.getContextWindow()同步该值,导致:compressionThreshold * contextWindow) 计算错误这违反了 project_memory.md 中的硬性约束:
建议修复
在
runStream开始处同步:同时在
setAdapter热切换时也要同步。