fix(acms): execute phase assembler ignores project-level hot_max_tokens budget #11035

Closed
opened 2026-05-08 11:03:50 +00:00 by hamza.khyari · 1 comment
Member

Summary

ACMSExecutePhaseContextAssembler.assemble() uses the global context_max_tokens_hot (default 16000) as its pipeline budget, ignoring the project-level --hot-max-tokens override set via agents project context set. This makes the per-project budget setting silently ineffective.

Steps to Reproduce

agents project context set local/my-project --hot-max-tokens 32000
agents plan execute <PLAN_ID>
# Pipeline still uses 16000 token budget despite project setting

Root Cause

execute_phase_context_assembler.py:229-236:

# Assembler resolves the execute view (which HAS hot_max_tokens=32000):
views = {name: self._resolve_execute_view(name) for name in project_names}
# ...but then ignores it and uses the constructor-injected global value:
budget = CoreContextBudget(max_tokens=self._hot_max_tokens, reserved_tokens=0)
# self._hot_max_tokens = container.settings().context_max_tokens_hot (16000)

The view is resolved at line 146 via _resolve_execute_view() which calls policy.resolve_view("execute") and correctly returns the project-level hot_max_tokens=32000. But the budget assembly at line 229 ignores the view and uses the global fallback.

Impact

  • --hot-max-tokens has NO effect on execute-phase context assembly
  • Large source files (>16K tokens) are excluded from LLM context regardless of project settings
  • Directly contributes to #10878 (incomplete/hallucinated plan results)

Fix

In assemble(), resolve the effective budget from the project view before creating the CoreContextBudget:

# After line 146:
views = {name: self._resolve_execute_view(name) for name in project_names}

# Before line 229 — use project-level override:
view_budgets = [
    v.hot_max_tokens for v in views.values()
    if hasattr(v, hot_max_tokens) and v.hot_max_tokens is not None
]
effective_budget = max(view_budgets) if view_budgets else self._hot_max_tokens
budget = CoreContextBudget(max_tokens=effective_budget, reserved_tokens=0)

Metadata

  • Commit Message: fix(acms): use project-level hot_max_tokens in execute phase context assembly
  • Branch: bugfix/acms-project-budget-override

Subtasks

  • Read project-level hot_max_tokens from resolved view in assemble()
  • Fall back to constructor-injected global if view has no override
  • Add Behave test verifying project-level budget is respected
  • Verify existing tests still pass
## Summary `ACMSExecutePhaseContextAssembler.assemble()` uses the global `context_max_tokens_hot` (default 16000) as its pipeline budget, ignoring the project-level `--hot-max-tokens` override set via `agents project context set`. This makes the per-project budget setting silently ineffective. ## Steps to Reproduce ```bash agents project context set local/my-project --hot-max-tokens 32000 agents plan execute <PLAN_ID> # Pipeline still uses 16000 token budget despite project setting ``` ## Root Cause `execute_phase_context_assembler.py:229-236`: ```python # Assembler resolves the execute view (which HAS hot_max_tokens=32000): views = {name: self._resolve_execute_view(name) for name in project_names} # ...but then ignores it and uses the constructor-injected global value: budget = CoreContextBudget(max_tokens=self._hot_max_tokens, reserved_tokens=0) # self._hot_max_tokens = container.settings().context_max_tokens_hot (16000) ``` The view is resolved at line 146 via `_resolve_execute_view()` which calls `policy.resolve_view("execute")` and correctly returns the project-level `hot_max_tokens=32000`. But the budget assembly at line 229 ignores the view and uses the global fallback. ## Impact - `--hot-max-tokens` has NO effect on execute-phase context assembly - Large source files (>16K tokens) are excluded from LLM context regardless of project settings - Directly contributes to #10878 (incomplete/hallucinated plan results) ## Fix In `assemble()`, resolve the effective budget from the project view before creating the `CoreContextBudget`: ```python # After line 146: views = {name: self._resolve_execute_view(name) for name in project_names} # Before line 229 — use project-level override: view_budgets = [ v.hot_max_tokens for v in views.values() if hasattr(v, hot_max_tokens) and v.hot_max_tokens is not None ] effective_budget = max(view_budgets) if view_budgets else self._hot_max_tokens budget = CoreContextBudget(max_tokens=effective_budget, reserved_tokens=0) ``` ## Metadata - **Commit Message**: `fix(acms): use project-level hot_max_tokens in execute phase context assembly` - **Branch**: `bugfix/acms-project-budget-override` ## Subtasks - [ ] Read project-level hot_max_tokens from resolved view in assemble() - [ ] Fall back to constructor-injected global if view has no override - [ ] Add Behave test verifying project-level budget is respected - [ ] Verify existing tests still pass
hamza.khyari added this to the v3.5.0 milestone 2026-05-08 11:03:50 +00:00
Owner

Blocked by PR #11229

Blocked by PR #11229
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#11035
No description provided.