"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(hypotheses): honor a search limit of zero instead of returning one
Lanre Shittua31e3a54ca45
diff --git a/agent/src/hypotheses/registry.py b/agent/src/hypotheses/registry.pyindex 1d72aa88f..5f048e34d 100644--- a/agent/src/hypotheses/registry.py+++ b/agent/src/hypotheses/registry.py@@ -362,7 +362,10 @@ class HypothesisRegistry:if score > 0:scored.append((score, hyp))scored.sort(key=lambda item: (item[0], item[1].updated_at), reverse=True)- return [hyp for _, hyp in scored[: max(1, min(int(limit), 100))]]+ # limit=0 means zero results, not "at least one" -- the floor used to+ # be max(1, ...), silently returning one record even when the caller+ # (a tool argument an LLM fills in) explicitly asked for none.+ return [hyp for _, hyp in scored[: max(0, min(int(limit), 100))]]def list(self) -> list[Hypothesis]:"""Load all hypotheses from storage."""diff --git a/agent/tests/test_hypothesis_registry.py b/agent/tests/test_hypothesis_registry.pyindex ad7c7b9c7..1a7bf4c81 100644--- a/agent/tests/test_hypothesis_registry.py+++ b/agent/tests/test_hypothesis_registry.py@@ -151,6 +151,19 @@ def test_search_by_text_and_status(storage_path: Path) -> None:assert status_results[0].title == "Dividend drift"+def test_search_limit_zero_returns_no_results(storage_path: Path) -> None:+ registry = HypothesisRegistry()+ registry.create(+ title="Funding squeeze",+ thesis="Crowded negative funding predicts squeeze.",+ status="testing",+ universe="Crypto perps",+ )++ assert registry.search(query="funding", limit=0) == []+ assert registry.search(query="funding", limit=-5) == []++def test_tool_wrappers_use_env_isolated_storage(storage_path: Path) -> None:created = json.loads(CreateHypothesisTool().execute(title="Tool-created carry",