You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: auto-filter narrows by years that only appear in the agent's rewritten queries #18
In the agent graphs, the auto-filter runs on the agent's own search queries, not only the user's question. The year detector turns every four-digit year in those queries into a filter. When the model adds a year while rewriting a question, for example «… årsrapport 2024 …», retrieval is narrowed to that year even though the user never asked for it. Nothing in the answer says so.
server/src/digdir/skills/builtin/retrieval.clj:894–901: do-pass calls (auto-filter/detect-query-filters pass-queries docs-collection opts) on the queries of the pass. In agent mode these are the model's search queries.
server/src/digdir/rag/auto_filter.clj:153: detect-query-filters runs detect-year-title-filter (line 138) on all of them.
retrieval.clj, same function: effective-filter-by is (merge-filter-by filter-by detected-filter), so a detected year also narrows a caller's own filter.
Observed
2026-09-24, local stack, tenant kudos, dataset kudos-full (Kudos, 10 064 documents), agent agent-rag-graph-bundled. A question with no year in it got year filters for 2023 and 2024 added. We saw it in the frontend's thinking panel as the auto-filter, and the years were in the agent's rewritten queries, not in the question.
Why it matters
Silent narrowing. The answer can miss relevant documents from other years, and the reader can't tell why. The organisation detector reads the same queries, so the same can probably happen with organisation names the model adds. We haven't measured that.
Known, but not tracked
The description of skills.query-planner.expansion-mode (ensure-skill-config-definitions!) already warns that «auto-filter can interact with the expanded queries». This issue is the same effect, measured in the agent graph. #15 adds skills.retrieval.auto-filter (default true) and retrieve-auto-filter per call to switch it off, but it doesn't change what the detector reads.
Suggestions
Detect years, and perhaps organisations, from the user's turn only, for example the :user-intent the retrieval skill already carries, not from the model's rewrites.
Or move the year detector into the rules engine with a per-dataset switch, as plans/proposed/retrieval-configurable-fields-rules-plan.md describes.
Report the auto-detected filter back to the caller. Make tools/call filtering work end to end #15 adds filters_applied to structuredContent, and retrieve-auto-filter: false to switch it off per call. That helps, but the default behaviour stays.
Summary
In the agent graphs, the auto-filter runs on the agent's own search queries, not only the user's question. The year detector turns every four-digit year in those queries into a filter. When the model adds a year while rewriting a question, for example «… årsrapport 2024 …», retrieval is narrowed to that year even though the user never asked for it. Nothing in the answer says so.
Where (main, 267718d)
server/src/digdir/skills/builtin/retrieval.clj:894–901:do-passcalls(auto-filter/detect-query-filters pass-queries docs-collection opts)on the queries of the pass. In agent mode these are the model'ssearchqueries.server/src/digdir/rag/auto_filter.clj:153:detect-query-filtersrunsdetect-year-title-filter(line 138) on all of them.retrieval.clj, same function:effective-filter-byis(merge-filter-by filter-by detected-filter), so a detected year also narrows a caller's own filter.Observed
2026-09-24, local stack, tenant
kudos, datasetkudos-full(Kudos, 10 064 documents), agentagent-rag-graph-bundled. A question with no year in it got year filters for 2023 and 2024 added. We saw it in the frontend's thinking panel as the auto-filter, and the years were in the agent's rewritten queries, not in the question.Why it matters
Silent narrowing. The answer can miss relevant documents from other years, and the reader can't tell why. The organisation detector reads the same queries, so the same can probably happen with organisation names the model adds. We haven't measured that.
Known, but not tracked
The description of
skills.query-planner.expansion-mode(ensure-skill-config-definitions!) already warns that «auto-filter can interact with the expanded queries». This issue is the same effect, measured in the agent graph. #15 addsskills.retrieval.auto-filter(defaulttrue) andretrieve-auto-filterper call to switch it off, but it doesn't change what the detector reads.Suggestions
:user-intentthe retrieval skill already carries, not from the model's rewrites.plans/proposed/retrieval-configurable-fields-rules-plan.mddescribes.filters_appliedtostructuredContent, andretrieve-auto-filter: falseto switch it off per call. That helps, but the default behaviour stays.