Commit d755392
praisonai-bot
fix(agent): critical UnboundLocalError on Agent() without max_budget
PR #1635 introduced a local 'from ... import ExecutionConfig' inside
__init__ (line 743 inside 'if max_budget is not None:' branch).
Per Python scoping rules, a name assigned anywhere in a function is
treated as local throughout the entire function. When max_budget is
None (the common case), the local branch never executes but line 777
still hits 'ExecutionConfig' and raises UnboundLocalError, breaking
every Agent() instantiation without max_budget.
ExecutionConfig is already imported at module level (line 162-166).
Only resolve_execution needs the local lazy import.
Test: tests/unit/agent/test_scientific_writer_agent.py surfaced this;
now passes along with 311 other agent unit tests.1 parent a410bc8 commit d755392
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
740 | 740 | | |
741 | 741 | | |
742 | 742 | | |
743 | | - | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
744 | 749 | | |
745 | 750 | | |
746 | 751 | | |
| |||
0 commit comments