fix(sync): silent vector resume; nopdf resets to pending when PDF reappears

This commit is contained in:
Research Assistant 2026-05-18 22:26:48 +08:00
parent 0d3f3bfe98
commit ad445a52d9
2 changed files with 6 additions and 4 deletions

View file

@ -87,7 +87,7 @@ def run(args: argparse.Namespace) -> int:
except Exception as e:
print(f"memory: deferred ({e})")
# trigger vector resume (background, no output)
# background: trigger vector resume (silent, no output unless embed actually runs)
try:
import subprocess, sys
subprocess.Popen(
@ -96,8 +96,7 @@ def run(args: argparse.Namespace) -> int:
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP if sys.platform == "win32" else 0,
)
print("vector: resume started")
except Exception as e:
print(f"vector: deferred ({e})")
except Exception:
pass
return 0

View file

@ -291,6 +291,9 @@ def _build_entry(item: dict, vault: Path, paths: dict, domain: str, zotero_dir:
meta_path = paths["ocr"] / key / "meta.json"
meta = read_json(meta_path) if meta_path.exists() else {}
if meta:
has_valid_pdf_now = bool(pdf_attachments) and bool(resolved_pdf) # noqa: F821
if meta.get("ocr_status") == "nopdf" and has_valid_pdf_now:
meta["ocr_status"] = "pending"
validated_ocr_status, validated_error = validate_ocr_meta(paths, meta)
meta["ocr_status"] = validated_ocr_status
if validated_error: