From 9e1c800f01c59b96d712214e42f5d8135db02be7 Mon Sep 17 00:00:00 2001 From: Youssef Aitousarrah Date: Fri, 10 Apr 2026 11:12:36 -0700 Subject: [PATCH] fix(hypotheses): symlink .env into worktree for local dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit load_dotenv() in tradingagents/config.py searches the cwd for .env. Worktrees in /tmp/ don't have one, so symlink the main repo's .env into the worktree root before running discovery. In CI, secrets are passed as env vars directly — symlink is a no-op. Co-Authored-By: Claude Sonnet 4.6 --- scripts/run_hypothesis_runner.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/run_hypothesis_runner.py b/scripts/run_hypothesis_runner.py index 179b8794..383b3eca 100644 --- a/scripts/run_hypothesis_runner.py +++ b/scripts/run_hypothesis_runner.py @@ -131,6 +131,13 @@ def run_hypothesis(hyp: dict) -> bool: run(["git", "fetch", "origin", branch], check=False) run(["git", "worktree", "add", worktree, branch]) + # Symlink .env from main repo into worktree so load_dotenv() finds it locally. + # In CI, secrets are env vars already — the symlink is a no-op there. + env_src = ROOT / ".env" + env_dst = Path(worktree) / ".env" + if env_src.exists() and not env_dst.exists(): + env_dst.symlink_to(env_src) + try: result = subprocess.run( [