refactor: remove budget warning injection system (dead code)

The _get_budget_warning() method already returned None unconditionally —
the entire budget warning system was disabled. Remove all dead code:

- _BUDGET_WARNING_RE regex
- _strip_budget_warnings_from_history() function and its call site
- Both injection blocks (concurrent + sequential tool execution)
- _get_budget_warning() method
- 7 tests for the removed functions

The budget exhaustion grace call system (_budget_exhausted_injected,
_budget_grace_call) is a separate recovery mechanism and is preserved.
This commit is contained in:
Teknium
2026-04-11 16:56:27 -07:00
parent d99e2a29d6
commit 39cd57083a
3 changed files with 2 additions and 160 deletions

View File

@@ -2742,19 +2742,7 @@ class TestSystemPromptStability:
assert "Hermes Agent" in agent._cached_system_prompt
class TestBudgetPressure:
"""Budget pressure warning system — now only fires at budget exhaustion."""
def test_no_intermediate_warnings(self, agent):
"""No warnings at 70% or 90% — only at actual exhaustion."""
agent.max_iterations = 60
assert agent._get_budget_warning(30) is None # 50%
assert agent._get_budget_warning(42) is None # 70%
assert agent._get_budget_warning(54) is None # 90%
assert agent._get_budget_warning(59) is None # last iteration
def test_zero_max_iterations(self, agent):
agent.max_iterations = 0
assert agent._get_budget_warning(0) is None
"""Budget exhaustion grace call system."""
def test_grace_call_flags_initialized(self, agent):
"""Agent should have budget grace call flags."""