Default retrieval to 6 chunks instead of 2

chunks is a total per request, split across the attached sources, so an
agent with two sources and the default of 2 got a single chunk from each,
and its answers changed with whichever chunk won. 6 gives three per
source for about 4-5k more input tokens per retrieval turn.

Every literal default moves from 2 to 6: the request default, the
retrievers, the internal search tool, workflow agent nodes, scheduled and
headless runs, agent create/update/import, the source retrieval config and
the frontend forms. Existing agents and sources keep what they store; a
source saved with chunks=2 now counts as configured at 2, which is pinned
by a test.

Headless runs also read chunks=0 as unset (`or 2`), so an agent with
retrieval switched off retrieved anyway on scheduled runs; 0 now stays 0.
This commit is contained in:
arc53-machine committed 2026-09-28 14:34:50 +01:00
1 parent 1c19ed8ce2
commit ab3dbfa1be
33 files changed
+187 -46

No files matched your search

@@ -698,7 +698,7 @@ class StreamProcessor:
"retriever": src_retriever or "classic",
"chunks": (
src_chunks if src_chunks is not None
else data.get("chunks", "2")
else data.get("chunks", "6")
),
# Per-source behaviour contract (lenient read).
"retrieval": SourceConfig.parse(
@@ -729,7 +729,7 @@ class StreamProcessor:
"retriever": src_retriever or "classic",
"chunks": (
src_chunks if src_chunks is not None
else data.get("chunks", "2")
else data.get("chunks", "6")
),
"retrieval": SourceConfig.parse(
source_doc.get("config")
@@ -1056,7 +1056,7 @@ class StreamProcessor:
)
retriever_name = "classic"
chunks = 2
chunks = 6
if self._agent_data is not None:
# Agent-bound: agent wins, body's retriever/chunks are dropped.
@@ -1068,7 +1068,7 @@ class StreamProcessor:
except (ValueError, TypeError):
logger.warning(
f"Invalid agent chunks value: {self._agent_data['chunks']}, "
"using default value 2"
"using default value 6"
)
else:
if "retriever" in self.data:
@@ -1079,7 +1079,7 @@ class StreamProcessor:
except (ValueError, TypeError):
logger.warning(
f"Invalid request chunks value: {self.data['chunks']}, "
"using default value 2"
"using default value 6"
)
# A source that configured its own retrieval knobs outranks the
# request body: the owner tuned top-k for that corpus, a client
@@ -1893,7 +1893,7 @@ class StreamProcessor:
"retriever_name": self.retriever_config.get(
"retriever_name", "classic"
),
"chunks": self.retriever_config.get("chunks", 2),
"chunks": self.retriever_config.get("chunks", 6),
"doc_token_limit": self.retriever_config.get(
"doc_token_limit", 50000
),