fix: #94391 将 compaction aggregate timeout 从硬编码 60s 改为读取 compaction.timeoutSeconds 配置#94429
Conversation
…action.timeoutSeconds 配置 将硬编码的 COMPACTION_RETRY_AGGREGATE_TIMEOUT_MS (60000ms) 替换为从 agents.defaults.compaction.timeoutSeconds 配置读取的 compactionTimeoutMs (默认 180000ms)。 根因: 在 ~200K token 的大 session 中, compaction 模型调用需要 143-187s 完成, 但硬编码的 60s aggregate timeout 在调用完成前就丢弃了结果, 导致: - 有效 compaction 结果被丢弃 - 每次失败都触发新的 compaction 重试 (重试风暴) - 每次失败都白烧完整的 provider API 调用费用 - 用户无感知 (失败是静默的) 此修复将 aggregate timeout 关联到已有的 agents.defaults.compaction.timeoutSeconds 配置项 (默认 180s), 使已调高此配置的用户自动获得修复。 Co-Authored-By: Claude <[email protected]>
🔍 Real behavior proof1. 架构一致性证明
逻辑: 如果 180s 对 compaction 模型调用足够(内层 safety timeout),对外层等待也应该足够 — compaction 在同一时间段内要么完成、要么被内层超时杀死。 2. 配置解析链路已验证
3. Aggregate timeout 函数本身已验证
4. 行为变更分析
5. Issue 证据关联Issue #94391 包含完整 trajectory 证据(session
本 PR 将 aggregate timeout 从 60s → 180s(默认),使这些已完成调用有机会被正常消费。 |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix: #94391 将 compaction aggregate timeout 从硬编码 60s 改为读取 compaction.timeoutSeconds 配置 This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Superseded by #94421 which fixes the root cause (isCompactionStillInFlight signal during active retry streaming) rather than changing the timeout value. #94421's approach is superior: it preserves the 60s idle guard while correctly treating active model streaming as work-in-progress, so valid long-running retries are not abandoned. |
变更说明
将
COMPACTION_RETRY_AGGREGATE_TIMEOUT_MS硬编码常量(60000ms)替换为从agents.defaults.compaction.timeoutSeconds配置读取的compactionTimeoutMs(默认 180000ms)。根因
在 ~200K token 的大 session 中,compaction 模型调用(anthropic/claude-sonnet-4-6)需要 143-187s 完成,但硬编码的 60s aggregate timeout 在模型调用完成前就丢弃了有效结果:
aborted=False)但被 60s 标记 incomplete修复方案
将 aggregate timeout 关联到已有的
agents.defaults.compaction.timeoutSeconds配置项:对比竞品 PR #94403
#94403只是把硬编码从 60000 改成 300000,仍然硬编码。本 PR 将其接入已有配置体系,用户可以自行调整。关联 Issue
Closes #94391
变更类型
风险等级
low — 改动范围极小(删除 2 行、修改 2 行),复用已有的
compactionTimeoutMs变量和resolveCompactionTimeoutMs()配置解析逻辑。测试情况
compaction-retry-aggregate-timeout.test.ts:16/16 通过🤖 Generated with Claude Code