~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
test(queue): pin the claimed-row arm of the missing-parent sweep (#7607)
Lukase3b3e078819d
diff --git a/tests/web/queue/test_queue_processor_contracts.py b/tests/web/queue/test_queue_processor_contracts.pyindex 4c9d71fcf4..343eec9397 100644--- a/tests/web/queue/test_queue_processor_contracts.py+++ b/tests/web/queue/test_queue_processor_contracts.py@@ -566,6 +566,101 @@ def test_missing_parent_sweep_is_username_scoped(tmp_path):engine.dispose()+def _seed_claimed_orphan(session, username, research_id):+ """A claimed queue row whose parent ResearchHistory row is missing."""+ _seed_queued(+ session,+ username,+ research_id,+ position=1,+ is_processing=True,+ with_parent=False,+ with_metadata=False,+ )+ session.add(+ TaskMetadata(+ task_id=research_id, status="processing", task_type="research"+ )+ )+++def test_missing_parent_sweep_keeps_another_users_claimed_orphan(tmp_path):+ """Alice's sweep must not delete bob's claimed orphan either.++ The sweep cleans up with ``include_claimed=True``, so a claim does not+ protect a row; only the sweep's username scoping keeps bob's row.+ """+ engine = _ondisk_engine(tmp_path)+ make_session = sessionmaker(bind=engine)+ session = make_session()+ _seed_queued(session, "alice", "alice-ok", position=1)+ _seed_claimed_orphan(session, "bob", "bob-claimed-orphan")+ session.add(QueueStatus(active_tasks=1, queued_tasks=1))+ session.commit()++ processor = QueueProcessorV2()+ processor._start_research = _recording_start_research([])++ processor._start_queued_researches(+ session, Mock(), "alice", "pw", available_slots=10+ )++ try:+ bob_rows = [+ (row.research_id, row.is_processing)+ for row in session.query(QueuedResearch)+ .filter_by(username="bob")+ .all()+ ]+ assert bob_rows == [("bob-claimed-orphan", True)], (+ "alice's sweep deleted bob's claimed queue row"+ )+ assert [+ (task.task_id, task.status)+ for task in session.query(TaskMetadata)+ .filter_by(task_id="bob-claimed-orphan")+ .all()+ ] == [("bob-claimed-orphan", "processing")]+ finally:+ session.close()+ engine.dispose()+++def test_missing_parent_sweep_removes_the_users_own_claimed_orphan(tmp_path):+ """A missing parent leaves a claim nothing can dispatch, so alice's own+ claimed orphan is swept together with its metadata."""+ engine = _ondisk_engine(tmp_path)+ make_session = sessionmaker(bind=engine)+ session = make_session()+ _seed_claimed_orphan(session, "alice", "alice-claimed-orphan")+ session.add(QueueStatus(active_tasks=1, queued_tasks=0))+ session.commit()++ processor = QueueProcessorV2()+ processor._start_research = _recording_start_research([])++ processor._start_queued_researches(+ session, Mock(), "alice", "pw", available_slots=10+ )++ try:+ assert (+ session.query(QueuedResearch)+ .filter_by(research_id="alice-claimed-orphan")+ .count()+ == 0+ )+ assert (+ session.query(TaskMetadata)+ .filter_by(task_id="alice-claimed-orphan")+ .count()+ == 0+ )+ finally:+ session.close()+ engine.dispose()++# ---------------------------------------------------------------------# 7-8. Logout must not resurrect the decrypted DB or resume research# ---------------------------------------------------------------------