enrich: backfill filename dedup key on content-hash hit
Transcripts mined before the filename-key feature was added had content-hash keys (#h-) but no filename keys (#f-). The daemon's fast-path check only looks at filename keys, so these sessions were re-queued every tick, hitting the content-hash dedup (0.0s) but returning early before writing the filename key — a self-perpetuating loop burning Sonnet quota on ~560 phantom re-mines per minute. Fix: when the content-hash dedup fires and no filename key exists, backfill it before returning.
This commit is contained in:
parent
36cb3b641f
commit
841cfe035b
1 changed files with 9 additions and 0 deletions
|
|
@ -274,6 +274,15 @@ pub fn experience_mine(
|
|||
let dedup_key = format!("_mined-transcripts.md#h-{:016x}", hash);
|
||||
|
||||
if store.nodes.contains_key(&dedup_key) {
|
||||
// Backfill filename key if missing (transcripts mined before this key existed)
|
||||
let fname_key = transcript_filename_key(jsonl_path);
|
||||
if !store.nodes.contains_key(&fname_key) {
|
||||
let mut node = new_node(&fname_key, &format!("Backfilled from {}", dedup_key));
|
||||
node.category = store::Category::Task;
|
||||
node.provenance = store::Provenance::AgentExperienceMine;
|
||||
let _ = store.upsert_node(node);
|
||||
store.save()?;
|
||||
}
|
||||
println!(" Already mined this transcript ({}), skipping.", &dedup_key[24..]);
|
||||
return Ok(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue