Skip to content

Commit 8e2e2d5

Browse files
kagura-agentKagura Chen
andauthored
fix(reflect): disable source facts in search_observations to prevent context overflow (#669)
search_observations in the reflect agent hardcoded include_source_facts=True with max_source_facts_tokens=-1 (unlimited). For banks with many observations backed by thousands of facts, a single tool call could produce 300K+ tokens, exceeding the default 100K context budget and causing forced synthesis with an empty 'Retrieved Data' section. The reflect agent synthesizes from observations, not raw backing facts. Disable source facts to keep payloads proportional to observation count (~6K vs ~310K in the reporter's case). The consolidation path already has configurable source fact limits (PR #509, v0.4.17). The reflect path was not updated. Fixes #668 Co-authored-by: Kagura Chen <daniyuu19@sjtu.edu.cn>
1 parent 4a55068 commit 8e2e2d5

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • hindsight-api-slim/hindsight_api/engine/reflect

hindsight-api-slim/hindsight_api/engine/reflect/tools.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ async def tool_search_observations(
136136
pending_consolidation: int = 0,
137137
) -> dict[str, Any]:
138138
"""
139-
Search consolidated observations using recall with include_source_facts.
139+
Search consolidated observations using recall.
140140
141141
Observations are auto-generated from memories. Returns freshness info
142142
so the agent knows if it should also verify with recall().
@@ -165,8 +165,7 @@ async def tool_search_observations(
165165
tags=tags,
166166
tags_match=tags_match,
167167
tag_groups=tag_groups,
168-
include_source_facts=True,
169-
max_source_facts_tokens=-1, # No token limit — include all source facts
168+
include_source_facts=False,
170169
_connection_budget=1,
171170
_quiet=True,
172171
)

0 commit comments

Comments
 (0)