fix(agents): retain bounded preflight history · openclaw/openclaw@2f33999
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
File tree
src/agents/embedded-agent-runner/run
| Original file line number | Diff line number | Diff line change |
|---|
@@ -542,6 +542,8 @@ export {
|
542 | 542 | }; |
543 | 543 | |
544 | 544 | const MAX_BTW_SNAPSHOT_MESSAGES = 100; |
| 545 | +const PROMPT_TOOL_RESULT_AGGREGATE_CAP_MULTIPLIER = 4; |
| 546 | + |
545 | 547 | function pluginMetadataSnapshotCoversProvider( |
546 | 548 | snapshot: PluginMetadataSnapshot | undefined, |
547 | 549 | provider: string, |
@@ -4174,14 +4176,17 @@ export async function runEmbeddedAttempt(
|
4174 | 4176 | activeSession.messages, |
4175 | 4177 | contextTokenBudget, |
4176 | 4178 | promptToolResultMaxChars, |
4177 | | -null, |
| 4179 | +promptToolResultMaxChars * PROMPT_TOOL_RESULT_AGGREGATE_CAP_MULTIPLIER, |
4178 | 4180 | ); |
4179 | 4181 | if (promptToolResultTruncation.truncatedCount > 0) { |
4180 | 4182 | promptHistoryMessages = promptToolResultTruncation.messages; |
4181 | 4183 | log.info( |
4182 | 4184 | `[tool-result-truncation] Truncated ${promptToolResultTruncation.truncatedCount} ` + |
4183 | 4185 | `tool result(s) for prompt history ` + |
4184 | | -`(maxChars=${promptToolResultMaxChars}) ` + |
| 4186 | +`(maxChars=${promptToolResultMaxChars} ` + |
| 4187 | +`aggregateBudgetChars=${ |
| 4188 | + promptToolResultMaxChars * PROMPT_TOOL_RESULT_AGGREGATE_CAP_MULTIPLIER |
| 4189 | + }) ` + |
4185 | 4190 | `sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`, |
4186 | 4191 | ); |
4187 | 4192 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。