fix(compaction): configurable summarizer tool_choice; wider overflow detection
Port of upstream grok-build 0.2.105 + 0.2.118. - CompactionToolChoice (auto default | none), resolved env KIGI_COMPACTION_TOOL_CHOICE > [features].compaction_tool_choice > remote settings. Some OpenAI-compatible servers reject tool_choice:"none" with tools attached, failing every long-session compaction; auto keeps them working (the summarization prompt already forbids tool use). Threaded from agent + subagent spawn through CompactionConfig into generate_session_compact; the Responses gate counts hosted tools too, so a hosted-only request still carries the configured choice. - is_context_length_error recognizes the "current message ... exceeds budget" phrasing, so that overflow is Fatal instead of burning the retry budget on a deterministic failure. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSy9S31pZNWXtRZNVJ1sDf
This commit is contained in:
1 parent
6a4bff0d45
commit
1ae803519e
18 files changed
+190
-13
No files matched your search
@@ -352,6 +352,7 @@ pub fn is_context_length_error(message: &str) -> bool {
|
||||
|| m.contains("maximum prompt length")
|
||||
|| m.contains("maximum context length")
|
||||
|| m.contains("context_length_exceeded")
|
||||
|| (m.contains("current message") && m.contains("exceeds budget"))
|
||||
}
|
||||
|
||||
/// Decide whether a [`reqwest::Error`] is worth retrying.
|
||||
@@ -387,6 +388,7 @@ mod tests {
|
||||
"This model's maximum context length is 200000 tokens",
|
||||
"invalid_request_error: prompt is too long: 300000 tokens > 200000 maximum",
|
||||
"error type: context_length_exceeded",
|
||||
"the current message exceeds budget: 120000 < 250000",
|
||||
] {
|
||||
assert!(is_context_length_error(msg), "should match: {msg}");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user