Skip to content

~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.

4.1 KB
Raw Blame

Search-engine entry, empty-result and query-rewriting messages now omit the explicit search text. BaseSearchEngine.run() already left the query out of its "returned no preview results" message, but it only reaches that line after the engine's own _get_previews() has run — and 20 engines logged the raw query on entry, several again in their own empty-result warning, so the same empty search wrote the query twice immediately before the sanitised message. The query-rewriting helpers those implementations call one frame down (PubMed query simplification and optimisation, Semantic Scholar and Guardian and Wikinews query optimisation, the Paperless LLM query expansion, the GitHub query builder, Wayback URL extraction) logged it too, on exactly the same path. All of those messages now carry the engine name, a result count and query lengths only, as do the two Cannot save search metrics warnings from the metrics recorder (one of which paired the query with your username).

The same sweep covers the sites that reached the query through something other than a bare query variable, which the static rule below cannot see: PubMed's Simplified query: {simplified} (INFO, on the empty-result retry path), NASA ADS's {str(params['q'])[:100]} (INFO, in the same _get_previews() the entry log was fixed in), and Paperless's {expanded[:500]} / {expanded[:200]} expansion previews and its query.lower().split() term list. PubMed's historical-focus check logged the LLM's raw answer, and the prompt it answers embeds the query, so a model that ignored the "answer ONLY yes/no" instruction could echo the query back into the log; it now logs the derived boolean. Queries are still recorded per search in the metrics database, so "why did this search return nothing" stays answerable.

A check-sensitive-logging pre-commit rule rejects recognized query expressions in log calls under web_search_engines/, at the shared logging levels and in any function — including via "{}".format(query), "..." + query, a brace placeholder filled from a keyword argument, and logger.bind(query=query) chains at the same levels as direct calls, debug included — all of which loguru writes to a sink — and truncated slices such as query[:100], which still reproduce the first hundred characters of what the user typed.

Still not covered by that rule: logging that reaches the query through something other than a bare query / *_query variable (a dict entry, an attribute, str(query), query.split() or any other call, a differently named local), logger.trace() / logger.success() — the two loguru-only levels the hook's shared level set omits — and the roughly 35 query-interpolating log calls elsewhere in the codebase, mostly advanced_search_system/, api.py and the news pipeline, which this change does not touch. Three call sites in web_search_engines/ did use those shapes and are fixed here: Semantic Scholar's last empty-result fallback logged longest_word, a differently named local holding the longest word of the query, Guardian overrides run() and logged a self._search_metadata dict whose original_query / optimized_query entries carried the query on every search that returned results, and PubChem's per-compound exception handler logged name — which, on the autocomplete-empty fallback, is the raw query itself, so a failure processing it wrote the query straight to the log. The static rule still cannot see a derived local or an attribute-carried value, which is why all three sites now also have a runtime test asserting that no word of a probe query reaches a captured log message.

Exemptions require an actual Python comment that opens with the marker, gives a reason of at least eight non-space characters, and sits on the physical line carrying the logging call's method name — a reason written about one part of a multi-line call does not exempt the rest of it. Marker text inside a string is not an exemption, including a PEP 701 comment inside an f-string replacement field. This change removes explicit query logging at the covered sites; provider responses, result content and exceptions are not subject to complete query tracking by this static rule.