fix: load_dotenv before heavy imports in issue1586_fu_caveatfix_figures.py (thread-caps red on main)
kind: infra
track:Highlight text on any card (body, plan, or an event) to anchor a comment, or leave a whole-task comment here. Mention @claude to summon a reply.
No comments yet.
Overview / Motivation
Filed by the #1660 orchestrator from an implementer-surfaced finding (2026-07-24): a test red on pristine origin/main, polluting every Step 9c / merge-gate baseline until fixed. NOT a workflow-surface fix — experiment-script code (#847 thread-caps class).
Goal
Bring scripts/issue1586_fu_caveatfix_figures.py into the #847 thread-caps contract (dotenv/env setdefault BEFORE heavy imports) so tests/test_shared_vm_thread_caps.py::test_no_new_torch_before_dotenv_vm_entrypoints passes on main.
Bug
- Observed:
scripts/issue1586_fu_caveatfix_figures.py(landed81d2400b05) imports matplotlib/numpy +explore_persona_space.analysis.paper_plotsat module top with ZEROload_dotenv()call, so the shared-VM thread-caps setdefault (orchestrate/env.py, #847) never fires before the heavy stack initializes. The pinned invarianttest_no_new_torch_before_dotenv_vm_entrypointsflags it — red on pristine main. - Fix shape: the standard 2-line fix —
from explore_persona_space.orchestrate.env import load_dotenv+load_dotenv()placed BEFORE the heavy imports (match the pattern used by sibling issue scripts that pass the invariant). - verified-at-filing:
grep -c "load_dotenv" scripts/issue1586_fu_caveatfix_figures.py→ 0; module-topimport matplotlib.pyplot/numpy/paper_plotsat ~L27; landed commit81d2400b05(2026-07-24 grep + git log).
Scope
scripts/issue1586_fu_caveatfix_figures.pyonly. The fix must keep figure output byte-stable (import-order change only).
Activity