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
@@ -282,6 +282,9 @@ impl TestHarnessBuilder {
max_actions_per_hour: None,
}));
let idempotency_cache = Arc::new(crate::tools::ToolIdempotencyCache::new(
crate::tools::IdempotencyCacheConfig::default(),
));
let deps = AgentDeps {
store: Some(Arc::clone(&db)),
llm,
@@ -294,6 +297,7 @@ impl TestHarnessBuilder {
skills_config: SkillsConfig::default(),
hooks,
cost_guard,
idempotency_cache,
};
TestHarness {