feat: add tool execution idempotency cache

For tools that declare `is_idempotent() == true`, successful results are
cached per-job so repeated identical calls (common during self-repair
recovery, stuck job retries, or chat-mode retry loops) return instantly
without re-executing. Cache uses SHA-256 content hashing with TTL and
LRU eviction, scoped per job_id.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Illia Polosukhin
2026-02-18 18:40:11 -08:00
co-authored by Claude Opus 4.6
parent ffb1cc9be8
commit 322a048b39
16 changed files with 509 additions and 3 deletions
+4
View File
@@ -385,6 +385,9 @@ async fn run_task_isolated(params: TaskRunParams<'_>) -> TaskResult {
ironclaw::agent::cost_guard::CostGuardConfig::default(),
));
let idempotency_cache = Arc::new(ironclaw::tools::ToolIdempotencyCache::new(
ironclaw::tools::IdempotencyCacheConfig::default(),
));
let deps = AgentDeps {
store: None,
llm: instrumented.clone() as Arc<dyn LlmProvider>,
@@ -397,6 +400,7 @@ async fn run_task_isolated(params: TaskRunParams<'_>) -> TaskResult {
skills_config: ironclaw::config::SkillsConfig::default(),
hooks: Arc::new(ironclaw::hooks::HookRegistry::new()),
cost_guard,
idempotency_cache,
};
let mut channels = ChannelManager::new();