Skip to content

Commit 926d651

Browse files
committed
对齐 OpenClaw: tool result 截断上限 400K→40K
1 parent dcb1d09 commit 926d651

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/src/main/java/com/xiaomo/androidforclaw/agent/context/ToolResultContextGuard.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ object ToolResultContextGuard {
3737
const val CONTEXT_INPUT_HEADROOM_RATIO = 0.75
3838
const val SINGLE_TOOL_RESULT_CONTEXT_SHARE = 0.5
3939
const val MAX_TOOL_RESULT_CONTEXT_SHARE = 0.3 // OpenClaw: max share of context for ALL tool results
40-
const val HARD_MAX_TOOL_RESULT_CHARS = 400_000 // OpenClaw: absolute max per single tool result
40+
const val HARD_MAX_TOOL_RESULT_CHARS = 40_000 // OpenClaw: DEFAULT_MAX_LIVE_TOOL_RESULT_CHARS (was 400K, reduced 10x)
4141

4242
const val CONTEXT_LIMIT_TRUNCATION_NOTICE = "[truncated: output exceeded context limit]"
4343
const val PREEMPTIVE_COMPACTION_PLACEHOLDER = "[compacted: tool output removed to free context]"

app/src/test/java/com/xiaomo/androidforclaw/agent/context/ContextWindowGuardConstantsTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import org.junit.Test
1010
* OpenClaw source reference:
1111
* - auth-profiles-DRjqKE3G.js line 374: const DEFAULT_CONTEXT_TOKENS = 2e5 (200,000)
1212
* - auth-profiles-DRjqKE3G.js line 96107: const MAX_TOOL_RESULT_CONTEXT_SHARE = .3
13-
* - auth-profiles-DRjqKE3G.js line 96114: const HARD_MAX_TOOL_RESULT_CHARS = 4e5 (400,000)
13+
* - tool-result-truncation.ts: DEFAULT_MAX_LIVE_TOOL_RESULT_CHARS = 40_000 (was 400K, reduced 10x)
1414
* - auth-profiles-DRjqKE3G.js line 97030: const EMBEDDED_COMPACTION_TIMEOUT_MS = 3e5 (300,000)
1515
* - auth-profiles-DRjqKE3G.js line 103642: const TOOL_RESULT_MAX_CHARS = 8e3 (8,000)
1616
*/
@@ -32,8 +32,8 @@ class ContextWindowGuardConstantsTest {
3232
}
3333

3434
@Test
35-
fun `HARD_MAX_TOOL_RESULT_CHARS matches OpenClaw value of 400000`() {
36-
assertEquals(400_000, ToolResultContextGuard.HARD_MAX_TOOL_RESULT_CHARS)
35+
fun `HARD_MAX_TOOL_RESULT_CHARS matches OpenClaw value of 40000`() {
36+
assertEquals(40_000, ToolResultContextGuard.HARD_MAX_TOOL_RESULT_CHARS)
3737
}
3838

3939
@Test

0 commit comments

Comments
 (0)