refactor(agents): remove stale compaction grace helper · openclaw/openclaw@20ea7a0
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
File tree
src/agents/embedded-agent-runner/run
| Original file line number | Diff line number | Diff line change |
|---|
@@ -832,13 +832,6 @@ vi.mock("./compaction-retry-aggregate-timeout.js", () => ({
|
832 | 832 | |
833 | 833 | vi.mock("./compaction-timeout.js", () => ({ |
834 | 834 | resolveRunTimeoutDuringCompaction: () => "abort", |
835 | | -resolveRunTimeoutWithCompactionGraceMs: ({ |
836 | | - runTimeoutMs, |
837 | | - compactionTimeoutMs, |
838 | | -}: { |
839 | | -runTimeoutMs: number; |
840 | | -compactionTimeoutMs: number; |
841 | | -}) => runTimeoutMs + compactionTimeoutMs, |
842 | 835 | selectCompactionTimeoutSnapshot: ({ |
843 | 836 | currentSnapshot, |
844 | 837 | currentSessionId, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,6 @@ import { describe, expect, it } from "vitest";
|
3 | 3 | import { castAgentMessage } from "../../test-helpers/agent-message-fixtures.js"; |
4 | 4 | import { |
5 | 5 | resolveRunTimeoutDuringCompaction, |
6 | | -resolveRunTimeoutWithCompactionGraceMs, |
7 | 6 | selectCompactionTimeoutSnapshot, |
8 | 7 | shouldFlagCompactionTimeout, |
9 | 8 | } from "./compaction-timeout.js"; |
@@ -90,15 +89,6 @@ describe("compaction-timeout helpers", () => {
|
90 | 89 | ).toBe("abort"); |
91 | 90 | }); |
92 | 91 | |
93 | | -it("adds one compaction grace window to the run timeout budget", () => { |
94 | | -expect( |
95 | | -resolveRunTimeoutWithCompactionGraceMs({ |
96 | | -runTimeoutMs: 600_000, |
97 | | -compactionTimeoutMs: 900_000, |
98 | | -}), |
99 | | -).toBe(1_500_000); |
100 | | -}); |
101 | | - |
102 | 92 | it("uses pre-compaction snapshot when compaction timeout occurs", () => { |
103 | 93 | const pre = [castAgentMessage({ role: "user", content: "pre" })] as const; |
104 | 94 | const current = [castAgentMessage({ role: "assistant", content: "current" })] as const; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,7 @@
|
4 | 4 | import type { AgentMessage } from "../../runtime/index.js"; |
5 | 5 | |
6 | 6 | /** Timeout state used to distinguish normal run deadlines from compaction stalls. */ |
7 | | -export type CompactionTimeoutSignal = { |
| 7 | +type CompactionTimeoutSignal = { |
8 | 8 | isTimeout: boolean; |
9 | 9 | isCompactionPendingOrRetrying: boolean; |
10 | 10 | isCompactionInFlight: boolean; |
@@ -34,16 +34,8 @@ export function resolveRunTimeoutDuringCompaction(params: {
|
34 | 34 | return params.graceAlreadyUsed ? "abort" : "extend"; |
35 | 35 | } |
36 | 36 | |
37 | | -/** Effective run timeout after adding the one-time compaction grace budget. */ |
38 | | -export function resolveRunTimeoutWithCompactionGraceMs(params: { |
39 | | -runTimeoutMs: number; |
40 | | -compactionTimeoutMs: number; |
41 | | -}): number { |
42 | | -return params.runTimeoutMs + params.compactionTimeoutMs; |
43 | | -} |
44 | | - |
45 | 37 | /** Candidate transcript snapshots available when a timeout fires during compaction. */ |
46 | | -export type SnapshotSelectionParams = { |
| 38 | +type SnapshotSelectionParams = { |
47 | 39 | timedOutDuringCompaction: boolean; |
48 | 40 | preCompactionSnapshot: AgentMessage[] | null; |
49 | 41 | preCompactionSessionId: string; |
@@ -52,7 +44,7 @@ export type SnapshotSelectionParams = {
|
52 | 44 | }; |
53 | 45 | |
54 | 46 | /** Snapshot chosen for retry/replay after a compaction-related timeout. */ |
55 | | -export type SnapshotSelection = { |
| 47 | +type SnapshotSelection = { |
56 | 48 | messagesSnapshot: AgentMessage[]; |
57 | 49 | sessionIdUsed: string; |
58 | 50 | source: "pre-compaction" | "current"; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。