AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
autoindex: a stale resume plan is not ok
snmsoodan49f0c38bb6a0
diff --git a/engine/crates/xerj-autoindex/src/cli.rs b/engine/crates/xerj-autoindex/src/cli.rsindex d3eee3e87..be55c560f 100644--- a/engine/crates/xerj-autoindex/src/cli.rs+++ b/engine/crates/xerj-autoindex/src/cli.rs@@ -781,7 +781,8 @@ pub fn help_text_with(feedback: bool) -> String {\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x203 completed-with-junk (junk recorded, never fatal) — SUCCESS:\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20the index is searchable, and the summary on stdout opens\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20with a line starting `ok:` that says so (xerj-done carries\n\- \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ok=true). Treat 0 and 3 alike as a finished run. This\n\+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ok=true), except stale-resume-plan below. Treat 0 and 3\n\+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20alike as a finished run. This\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20includes a dataset whose mapping the server REFUSED: its\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20files are recorded as junk with the server's reason, the\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20xerj-done line carries datasets_refused / files_refused,\n\@@ -795,8 +796,11 @@ pub fn help_text_with(feedback: bool) -> String {\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20resume plan was frozen. They are not counted as junk.\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20`skipped_appeared` is the count; the summary names the\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20first few paths and says to re-run with --fresh to\n\- \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20rebuild the plan in place and include them. Read `reason`\n\- \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20to tell this apart from completed-with-junk;\n\+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20rebuild the plan in place and include them. This is the one\n\+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20exit 3 that is not a complete index: the xerj-done line\n\+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20carries ok=false and the summary opens with `not ok:`,\n\+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20because the files it skipped are not searchable. Read\n\+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20`reason` to tell this apart from completed-with-junk;\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20or files-removed — a graph-path rerun deleted documents,\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20catalog rows and edges for files that left the folder.\n\\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20The index matches the folder; the next unchanged rerun is\n\diff --git a/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs b/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rsindex a7a5cd7ba..0bca3de6d 100644--- a/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs+++ b/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs@@ -1659,7 +1659,9 @@ fn a_resume_whose_plan_predates_new_files_reports_a_stale_plan_not_junk() {.unwrap_or_else(|| panic!("no JSON done event:\n{stream}"));assert_eq!(done["exit"], 3, "{done}");assert_eq!(done["reason"], "stale-resume-plan", "{done}");- assert_eq!(done["ok"], true, "{done}");+ // #2411: exit 3 is not an error, but `ok` is not "the run finished" — it is+ // "the index covers this folder", and these files are not in it.+ assert_eq!(done["ok"], false, "{done}");assert_eq!(done["skipped_appeared"], 2, "{done}");assert_eq!(done["skipped_appeared_files"],diff --git a/engine/crates/xerj-autoindex/src/lib.rs b/engine/crates/xerj-autoindex/src/lib.rsindex 4d1395292..1cf89e66b 100644--- a/engine/crates/xerj-autoindex/src/lib.rs+++ b/engine/crates/xerj-autoindex/src/lib.rs@@ -1502,7 +1502,7 @@ pub(crate) fn is_stale_resume_skip(junk: &JunkFile) -> bool {/// note still lists up to [`REFUSAL_LIST_CAP`].const STALE_RESUME_SUMMARY_CAP: usize = 5;-/// Recovery sentence shared by the `ok:` headline, the path list, and the JSON field.+/// Recovery sentence shared by the headline, the path list, and the JSON field.////// One sentence, so the summary that names the paths also says `--fresh`/// right there (#2372).@@ -1527,7 +1527,7 @@ fn stale_resume_appeared_paths(junk: &[&JunkFile]) -> Vec<String> {/// Human lines for the stale-resume-plan summary.///-/// The `ok:` headline stays one line. These sit under it and name the files,+/// The headline stays one line. These sit under it and name the files,/// because a count alone sent an agent back to `--help` to find out what was/// skipped (#2372). Empty when nothing appeared, so a clean run's summary is/// unchanged.@@ -1775,7 +1775,10 @@ fn generated_exit_code(summary: &Value) -> i32 {/// mentioned the exit code at all. A finished run leads with one line that/// starts `ok:` and names the exit code in words; exit 3 also says what was/// recorded and where to look, so junk stays visible. A family-wide PDF-/// worker startup failure (#2336) leads with `not ok:` and exit 1.+/// worker startup failure (#2336) leads with `not ok:` and exit 1. So does an+/// index that does not cover the folder because a stale resume plan skipped+/// files (#2411): exit 3, `ok=false`, and the line says the skipped files are+/// not searchable.pub(crate) fn outcome_headline(code: i32,junk_files: u64,@@ -1797,9 +1800,14 @@ pub(crate) fn outcome_headline(}if stale_plan_files > 0 {let files = estimate::count_phrase(stale_plan_files, "file", "files");+ // #2411: `not ok:`, not `ok:`. The run finished and exit 3 is not an+ // error, but the index does not cover the folder, and the `ok:` prefix+ // was read as "this folder is searchable" by a caller that then saw+ // four of its five files missing from results.let mut line = format!(- "ok: indexed and searchable — exit 3 ({STALE_RESUME_PLAN_REASON}): {files} skipped \- because the resumed plan is stale and were not indexed. {STALE_RESUME_SUMMARY_ACTION}"+ "not ok: the index does not cover this folder — exit 3 \+ ({STALE_RESUME_PLAN_REASON}): {files} skipped because the resumed plan is stale and \+ were not indexed, so they are not searchable. {STALE_RESUME_SUMMARY_ACTION}");if junk_files > 0 || junk_records > 0 {let mut recorded = Vec::new();@@ -12728,8 +12736,14 @@ fn run_index_report_inner(if !appeared_json.is_empty() {pr.set_done_json(appeared_json.clone());}+ // #2411: `ok` means this run's index covers the folder, not merely that+ // nothing crashed. A stale resume plan leaves files that are on disk out of+ // the index, so the corpus is incomplete even though exit 3 is not an error+ // — `ok=true` told a reader the folder was indexed when four of its five+ // files were not.+ let complete = pdf_worker_unavailable.is_none() && skipped_appeared == 0;pr.finish(- pdf_worker_unavailable.is_none(),+ complete,code,// A worker that cannot start wins the `reason`: exit 3 would call a// missing PDF family success (#2336). A stale plan is next, because@@ -15004,6 +15018,12 @@ mod generation_contract_identity_tests {);let stale = outcome_headline(3, 0, 0, false, 2, None, 0);+ // #2411: the prefix is the contract. `ok:` says "this folder is+ // searchable"; a stale plan leaves files on disk out of the index, so+ // the line must not claim that.+ assert!(stale.starts_with("not ok:"), "{stale}");+ assert!(stale.contains("does not cover this folder"), "{stale}");+ assert!(stale.contains("not searchable"), "{stale}");assert!(stale.contains("exit 3 (stale-resume-plan)"), "{stale}");assert!(stale.contains("2 files skipped because the resumed plan is stale"),