{"record":{"id":"6ad92f0ae1b3a2dd","repo":"Hmbown/CodeWhale","slug":"continual-harness-is-full-max-entries-entries","errorCode":null,"errorMessage":"continual harness is full ({MAX_ENTRIES} entries); remove an obsolete entry before refining again","messagePattern":"continual harness is full \\((.+?) entries\\); remove an obsolete entry before refining again","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/continual_harness.rs","lineNumber":111,"sourceCode":"pub fn refine(workspace: &Path, refinement: HarnessRefinement) -> Result<HarnessEntry> {\n    let refinement = validate_refinement(refinement)?;\n    let path = state_path_for_write(workspace)?;\n    with_write_lock(&path, || {\n        // Reload *inside* the cross-process writer lock. Atomic publication\n        // protects readers from torn JSON, while this transaction prevents\n        // two approved refinements from both deriving changes from a stale\n        // snapshot and dropping one another's entry.\n        let mut state = load_state(&path)?;\n\n        if let Some(existing) = state.entries.iter().find(|entry| {\n            entry.kind == refinement.kind\n                && entry.title == refinement.title\n                && entry.content == refinement.content\n        }) {\n            return Ok(existing.clone());\n        }\n        if state.entries.len() >= MAX_ENTRIES {\n            bail!(\n                \"continual harness is full ({MAX_ENTRIES} entries); remove an obsolete entry before refining again\"\n            );\n        }\n\n        let entry = HarnessEntry {\n            id: format!(\"h_{}\", Uuid::new_v4().simple()),\n            kind: refinement.kind,\n            title: refinement.title,\n            content: refinement.content,\n            evidence: refinement.evidence,\n        };\n        state.schema_version = SCHEMA_VERSION;\n        state.entries.push(entry.clone());\n        save_state(&path, &state)?;\n        // Journalled after the state is durable: a logged edit that never\n        // landed would be worse than an unlogged one.\n        append_journal(&path, \"refine\", &entry)?;\n        Ok(entry)","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/continual_harness.rs#L93-L129","documentation":"The continual harness caps its persisted entry list at MAX_ENTRIES. refine() refuses to add new refinements once the cap is reached (exact duplicates still short-circuit earlier), requiring the caller to remove an obsolete entry first.","triggerScenarios":"Calling refine() when state.entries.len() >= MAX_ENTRIES and the refinement is not an exact duplicate of an existing entry. Hit by tests including refinement_persists_and_renders_as_untrusted_context, concurrent_refinements_merge_under_the_write_lock, and others.","commonSituations":"Long-lived workspaces that accumulate harness entries across many sessions until the journal is full.","solutions":["Call remove(workspace, id) on an obsolete entry, then retry refine().","Review the harness state file and prune stale entries.","Deduplicate refinements before calling refine."],"exampleFix":"// before\nharness::refine(ws, r)?; // fails when full\n// after\nif harness::list(ws)?.len() >= harness::MAX_ENTRIES {\n    harness::remove(ws, &oldest_id)?;\n}\nharness::refine(ws, r)?;","handlingStrategy":"validation","validationCode":"let ids: Vec<String> = continual_harness::list(ws)?.iter().map(|e| e.id.clone()).collect();\nif ids.len() >= continual_harness::MAX_ENTRIES {\n    continual_harness::remove(ws, &oldest_id)?;\n}","typeGuard":"fn harness_has_capacity(ws: &Path) -> bool {\n    continual_harness::list(ws).map(|e| e.len() < continual_harness::MAX_ENTRIES).unwrap_or(false)\n}","tryCatchPattern":"match harness::refine(ws, r) {\n    Err(e) if e.to_string().contains(\"harness is full\") => { harness::remove(ws, &pick_obsolete(ws)?)?; harness::refine(ws, r) }\n    other => other,\n}","preventionTips":["Prune obsolete entries periodically.","Check entry count against MAX_ENTRIES before refining.","Deduplicate refinements before calling refine."],"tags":["capacity","limit-exceeded","continual-harness"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}