mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 22:09:34 +00:00
feat: add configurable tool loop detection
This commit is contained in:
@@ -138,6 +138,30 @@ export type MediaToolsConfig = {
|
||||
|
||||
export type ToolProfileId = "minimal" | "coding" | "messaging" | "full";
|
||||
|
||||
export type ToolLoopDetectionDetectorConfig = {
|
||||
/** Enable warning/blocking for repeated identical calls to the same tool/params. */
|
||||
genericRepeat?: boolean;
|
||||
/** Enable warning/blocking for known no-progress polling loops. */
|
||||
knownPollNoProgress?: boolean;
|
||||
/** Enable warning/blocking for no-progress ping-pong alternating patterns. */
|
||||
pingPong?: boolean;
|
||||
};
|
||||
|
||||
export type ToolLoopDetectionConfig = {
|
||||
/** Enable tool-loop protection (default: false). */
|
||||
enabled?: boolean;
|
||||
/** Maximum tool call history entries retained for loop detection (default: 30). */
|
||||
historySize?: number;
|
||||
/** Warning threshold before a warning-only loop classification (default: 10). */
|
||||
warningThreshold?: number;
|
||||
/** Critical threshold for blocking repetitive loops (default: 20). */
|
||||
criticalThreshold?: number;
|
||||
/** Global no-progress breaker threshold (default: 30). */
|
||||
globalCircuitBreakerThreshold?: number;
|
||||
/** Detector toggles. */
|
||||
detectors?: ToolLoopDetectionDetectorConfig;
|
||||
};
|
||||
|
||||
export type SessionsToolsVisibility = "self" | "tree" | "agent" | "all";
|
||||
|
||||
export type ToolPolicyConfig = {
|
||||
@@ -235,6 +259,8 @@ export type AgentToolsConfig = {
|
||||
exec?: ExecToolConfig;
|
||||
/** Filesystem tool path guards. */
|
||||
fs?: FsToolsConfig;
|
||||
/** Runtime loop detection for repetitive/ stuck tool-call patterns. */
|
||||
loopDetection?: ToolLoopDetectionConfig;
|
||||
sandbox?: {
|
||||
tools?: {
|
||||
allow?: string[];
|
||||
@@ -497,6 +523,8 @@ export type ToolsConfig = {
|
||||
exec?: ExecToolConfig;
|
||||
/** Filesystem tool path guards. */
|
||||
fs?: FsToolsConfig;
|
||||
/** Runtime loop detection for repetitive/ stuck tool-call patterns. */
|
||||
loopDetection?: ToolLoopDetectionConfig;
|
||||
/** Sub-agent tool policy defaults (deny wins). */
|
||||
subagents?: {
|
||||
/** Default model selection for spawned sub-agents (string or {primary,fallbacks}). */
|
||||
|
||||
Reference in New Issue
Block a user