Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(hooks): warn instead of silently swallowing spool retry-count persist failures

João Matheusd78b05fc7210
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 47f76067..eeb9484b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,9 +35,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
aliases still prefix-match later events into the same project.
- Updated `git2` to the patched 0.21 line to clear new RustSec unsoundness
advisories in libgit2 bindings.
+<<<<<<< HEAD
- Native Claude Code hooks now capture array-shaped `tool_response` content and
recognize the native `user-prompt-submit` event token, restoring prompt text
and tool output bodies for native installs.
+- The headless hook spool now warns (instead of silently swallowing) when it
+ cannot persist a bumped retry-attempt count back to disk, matching the v1.1.3
+ enqueue-failure fix. A failed atomic rewrite previously lost the in-memory
+ attempt bump, so a poison spool entry never reached `MAX_ATTEMPTS` and kept
+ retrying on every drain boundary with no operator signal until the 7-day
+ age-out pruned it. The warning is sanitized and carries no path (a raw spool
+ path can be a Windows verbatim `\\?\…` path).
## [1.1.3] - 2026-06-20
diff --git a/crates/ai-memory-cli/src/commands/hook_spool.rs b/crates/ai-memory-cli/src/commands/hook_spool.rs
index e83ff226..90880852 100644
--- a/crates/ai-memory-cli/src/commands/hook_spool.rs
+++ b/crates/ai-memory-cli/src/commands/hook_spool.rs
@@ -271,11 +271,20 @@ fn rewrite_entry(path: &Path, entry: &SpoolEntry) -> std::io::Result<()> {
std::fs::rename(&tmp, path)
}
-/// Report whether persisting a bumped retry count landed. A seam so the
-/// persist-outcome handling (warn-vs-not) is unit-testable without provoking a
-/// real FS fault. Fire-and-forget: the returned bool is consumed only by tests.
+/// Report whether persisting a bumped retry count landed; on failure, emit a
+/// sanitized stderr warning (no path — a raw spool path can be a Windows verbatim
+/// `\\?\…` path) instead of swallowing it, so a poison entry can't retry
+/// invisibly until it ages out. Fire-and-forget: warns only, never panics or
+/// blocks; the returned bool is consumed only by tests.
fn note_retry_persist(outcome: std::io::Result<()>) -> bool {
- outcome.is_ok()
+ if outcome.is_err() {
+ eprintln!(
+ "ai-memory hook warning: failed to persist spool retry count; \
+ event may retry until it ages out"
+ );
+ return false;
+ }
+ true
}
/// Resolve the bearer for a synchronous request (the session-start handoff