[Bug] Duplicate backtest input reruns the same cell within one sweep
Version
0.5.1 (main at 35543d0)
How you run it
Backtest (run_backtest or tradingagents backtest)
LLM provider and models
Any; source-level finding, no live LLM call
Ticker and analysis date
AAPL, 2026-09-01
What happened, and what you expected
In run_backtest, done is initialized once from entries already in the decision log. After a successful graph.propagate(ticker, date, ...), the code increments cells_run but never adds (ticker, date) to done (backtest.py lines 151–165).
If either input list contains a duplicate, the same cell is analyzed again within that sweep, including LLM and vendor calls. The decision-log idempotency guard prevents a duplicate entry only at the end of the second analysis; it cannot prevent the extra work or the inflated cells_run count.
Expected: each unique ticker/date cell is propagated once per successful sweep, and later duplicates count as skipped.
Suggested fix: add done.add((ticker, date)) immediately after successful graph.propagate. Keep it outside the exception path if a failed duplicate is meant to be retried. Add a regression test with duplicate input that asserts one propagation and one skipped cell, plus a failure case documenting retry behavior. This preserves the existing resume-from-log behavior.
This is a deterministic source-level finding on version 0.5.1; I did not run a paid LLM-backed backtest.
Steps or code to reproduce
With an empty run log, call:
run_backtest(
tickers=["AAPL", "AAPL"],
dates=["2026-09-01"],
config=config,
)
Or mock `TradingAgentsGraph.propagate` and count calls without API cost. Expected: 1 propagation, 1 skipped cell. Current loop: 2 propagations and `cells_run == 2`. Duplicating the date instead has the same effect.Error output
No exception is raised. The symptom is repeated model/vendor work and an inflated cells_run count.Source: TauricResearch/TradingAgents