Heuristic:1jehuang Jcode Fail Closed Selection
| Knowledge Sources | |
|---|---|
| Domains | Memory, Reliability |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
Memory recall errors abort the entire selection, including already-scored batches, rather than returning partial or stale results.
Description
The Fail_Closed_Selection heuristic ensures that when the Jev Decisions API returns an error during memory relevance scoring, the entire selection process aborts — including batches that were already scored. There is no partial result returned, no cached answers used, and no fallback to lexical prefiltering. Oversized individual memories are skipped (and counted in a content-free log) but never truncated, because an unseen suffix must not be injected after scoring a prefix. The selection has a deadline, and if any request fails, the error propagates upward.
Usage
Use this heuristic when designing memory recall systems. If any part of the scoring fails, abort the entire selection rather than returning incomplete or potentially misleading results. This prevents injecting partially-scored memories that may be irrelevant or harmful.
The Insight (Rule of Thumb)
- Action: Abort the entire selection on any Jev API error; do not return partial results.
- Value: Errors propagate upward; no cached answers, no lexical fallback, no recent-memory cap.
- Trade-off: A single API failure blocks all memory recall for that request, even if some batches succeeded.
- Compatibility: Oversized memories are skipped (not truncated) to avoid injecting unseen suffixes after scored prefixes.
Reasoning
Returning partial results from a failed selection could inject irrelevant or misleading memories into the agent's context. If some batches were scored but a later batch failed, the scored batches may have been scored against a different context window size or candidate set. Aborting the entire selection ensures consistency: either all memories are scored against the same context or none are returned.
Code Evidence
Fail-closed design from crates/jcode-base/src/memory_jev.rs:1-6:
//! Direct, fail-closed typed relevance selection. No embeddings, lexical prefilter,
//! sidecar, cached answers, or recent-memory cap are used.
//!
//! Requests are sequential and the entire selection has a deadline. Oversized
//! individual memories are skipped (and counted in a content-free log), never
//! truncated: an unseen suffix must not be injected after scoring a prefix.
Error abort design from crates/jcode-base/src/memory_jev.rs:20-22:
/// Injectable decision transport. Errors abort the entire selection, including
/// already-scored batches. Implementations must return the full response object.