perf: bound compaction contributor selection · openclaw/openclaw@7d40118
shakkernerd
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,6 +14,7 @@ Docs: https://docs.openclaw.ai
|
14 | 14 | - Workspace/oc-path: add the `oc://` addressing substrate (`src/oc-path/`) — a universal, kind-dispatched path scheme for addressing leaves and nodes inside markdown, jsonc, jsonl, and yaml workspace files, with `parseOcPath`/`formatOcPath`, per-kind `parseXxx`/`emitXxx`, universal `resolveOcPath`/`setOcPath`/`findOcPaths` verbs, the `__OPENCLAW_REDACTED__` sentinel emit guard, and the new `openclaw path resolve|find|set|validate|emit` CLI for shell-level inspection and surgical edits. Implements #78051. (#78678) Thanks @giodl73-repo. |
15 | 15 | - Runtime/performance: avoid full-array sorting while auto-selecting providers, resolving supported thinking levels, picking node last-seen timestamps, and extracting Codex usage-limit messages. Thanks @shakkernerd. |
16 | 16 | - Plugins/doctor: avoid full-array sorting while selecting ClawHub search/archive results and bounded dreaming doctor entries. Thanks @shakkernerd. |
| 17 | +- Agents/compaction: keep contributor diagnostics to a bounded top-three selection without sorting the full history. Thanks @shakkernerd. |
17 | 18 | - Telegram: preserve the channel-specific 10-option poll cap in the unified outbound adapter so over-limit polls are rejected before send. (#78762) Thanks @obviyus. |
18 | 19 | - Slack: route handled top-level channel turns in implicit-conversation channels to thread-scoped sessions when Slack reply threading is enabled, keeping the root turn and later thread replies on one OpenClaw session. (#78522) Thanks @zeroth-blip. |
19 | 20 | - Telegram: re-probe the primary fetch transport after repeated sticky fallback success so transient IPv4 or pinned-IP fallback promotion can recover without a gateway restart. Fixes #77088. (#77157) Thanks @MkDev11. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -323,10 +323,34 @@ function summarizeCompactionMessages(messages: AgentMessage[]): CompactionMessag
|
323 | 323 | historyTextChars, |
324 | 324 | toolResultChars, |
325 | 325 | estTokens: tokenEstimationFailed ? undefined : estTokens, |
326 | | -contributors: contributors.toSorted((a, b) => b.chars - a.chars).slice(0, 3), |
| 326 | +contributors: selectTopContributors(contributors), |
327 | 327 | }; |
328 | 328 | } |
329 | 329 | |
| 330 | +function selectTopContributors( |
| 331 | +contributors: CompactionMessageMetrics["contributors"], |
| 332 | +): CompactionMessageMetrics["contributors"] { |
| 333 | +const selected: CompactionMessageMetrics["contributors"] = []; |
| 334 | +for (const contributor of contributors) { |
| 335 | +let insertAt = selected.length; |
| 336 | +for (let index = 0; index < selected.length; index += 1) { |
| 337 | +if (contributor.chars > selected[index].chars) { |
| 338 | +insertAt = index; |
| 339 | +break; |
| 340 | +} |
| 341 | +} |
| 342 | +if (insertAt < 3) { |
| 343 | +selected.splice(insertAt, 0, contributor); |
| 344 | +if (selected.length > 3) { |
| 345 | +selected.pop(); |
| 346 | +} |
| 347 | +} else if (selected.length < 3) { |
| 348 | +selected.push(contributor); |
| 349 | +} |
| 350 | +} |
| 351 | +return selected; |
| 352 | +} |
| 353 | + |
330 | 354 | function containsRealConversationMessages(messages: AgentMessage[]): boolean { |
331 | 355 | return messages.some((message, index, allMessages) => |
332 | 356 | hasRealConversationContent(message, allMessages, index), |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。