Follow-up from #911 (PR #1003).
Problem
#911 made max_cost_usd real for the built-in ReAct engine — it reads the setting and blocks the run once _estimate_total_cost() reaches the cap. The other execution paths still ignore it entirely:
- Plan engine (
--engine plan, core/executor.py) — has no token or cost tracking at all. It sets max_tokens on its calls and records nothing, so there is no accumulated spend to compare against a cap.
- Delegated adapters (
--engine claude-code/codex/opencode) — the external CLI does its own spending and reports no token usage back, so CodeFRAME cannot see what a run cost.
A user on a non-default engine who sets a $5 cap still gets no cost limiting. #911 was scoped to "the field is read by something" rather than "the field is honoured everywhere"; the Settings control now carries a note naming the limitation, but the gap is real.
Why it was not fixed in #911
Both need work that dwarfs the original issue:
Suggested approach
- Give
core/executor.py the same token-record + _estimate_total_cost treatment as ReactAgent, then reuse _resolve_cost_cap — the resolver is already engine-agnostic.
- For delegated engines, decide explicitly: either parse usage where the CLI reports it, or keep the control disabled for those engines in the UI rather than showing a cap that cannot bind.
- Test: a low cap on
--engine plan terminates the run and leaves the task not DONE, mirroring tests/core/test_cost_cap_enforced_911.py.
Evidence
codeframe/core/executor.py — no token/cost tracking
codeframe/core/adapters/subprocess_adapter.py — no usage capture
codeframe/core/react_agent.py:_resolve_cost_cap — the reusable resolver
Follow-up from #911 (PR #1003).
Problem
#911 made
max_cost_usdreal for the built-in ReAct engine — it reads the setting and blocks the run once_estimate_total_cost()reaches the cap. The other execution paths still ignore it entirely:--engine plan,core/executor.py) — has no token or cost tracking at all. It setsmax_tokenson its calls and records nothing, so there is no accumulated spend to compare against a cap.--engine claude-code/codex/opencode) — the external CLI does its own spending and reports no token usage back, so CodeFRAME cannot see what a run cost.A user on a non-default engine who sets a $5 cap still gets no cost limiting. #911 was scoped to "the field is read by something" rather than "the field is honoured everywhere"; the Settings control now carries a note naming the limitation, but the gap is real.
Why it was not fixed in #911
Both need work that dwarfs the original issue:
ReactAgent._record_token_usagedoes) before a cap can mean anything.Suggested approach
core/executor.pythe same token-record +_estimate_total_costtreatment asReactAgent, then reuse_resolve_cost_cap— the resolver is already engine-agnostic.--engine planterminates the run and leaves the task not DONE, mirroringtests/core/test_cost_cap_enforced_911.py.Evidence
codeframe/core/executor.py— no token/cost trackingcodeframe/core/adapters/subprocess_adapter.py— no usage capturecodeframe/core/react_agent.py:_resolve_cost_cap— the reusable resolver