fix(acms): use project-level hot_max_tokens in execute phase context assembly #11216
Merged
hamza.khyari
merged 1 commits from 2026-05-15 10:50:06 +00:00
bugfix/m5-acms-project-budget-override into master
Labels
Clear labels
auto/needs-reevaluation
controller-managed
overdue
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Needs Feedback
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
Controller deferred this PR; awaiting Phase 6+ scope-evaluator or operator re-enablement.
Auto-agents controller manages this PR/issue (see tools/controller/deploy/RUNBOOK.md). Remove this label to abandon controller management.
PR blocked by an open issue dependency. Operator must close the dep (or remove the dependency link) before the merge driver can act. Auto-cleared by merge_drive when no open deps remain.
Most recent merge cycle hit CI timeout. Driver excludes this PR while last merge_cycle row is < 30 min old; label persists thereafter as visible history.
Currently being processed by an implementer worker.
Currently being processed by the merge driver.
Currently being processed by a reviewer worker.
Merge driver heartbeat stale; pipeline halted. Closed automatically on next clean tick.
Detected master commit violating the strict merge invariant. Tracked as an issue (not a PR label); kept here for label completeness.
In-cycle escalation: most recent attempt ran at the Tier 0 slot (`tier-0`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 1 slot (`tier-1`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 2 slot (`tier-2`). Slot's model defined in .opencode/models/tiers.yaml. Gated behind IMPLEMENTER_ESCALATION_TIER2_ENABLED.
In-cycle escalation: most recent attempt ran at the Tier -1 slot (`tier-min`). Slot's model defined in .opencode/models/tiers.yaml. Suffix is ``-min`` (not ``--1``) so the Forgejo UI reads naturally.
Tracking issues used by the AI Automation system for agents to communicate and report.
Rebase conflict needs LLM conflict-resolver.
Failing CI needs implementer attention.
Documenting a driver incident or rollback.
Reviewer has APPROVED this PR and no later REQUEST_CHANGES is outstanding. The merge driver requires this label to even consider a PR for merging. Set by the reviewer worker on APPROVE; cleared on REQUEST_CHANGES.
Train repeatedly lost master-tempo races. Driver excludes via merge_cycle until cooldown elapses; label persists as visible history.
Revert PR backing out an invariant violation. Fast-tracked through the merge driver.
Sentinel PR duplicated from upstream into a personal fork by tools/duplicate_prs_to_fork.py for pipeline testing. Lives only in the fork; the canonical pipeline never sees it.
No implementer activity for N days. Flagged for human review. Auto-cleared on next push to head branch.
Repeatedly fails on current master (>= 3 ci-fail-on-rebased-sha releases in 12 h). Excluded from driver until human triage.
A ticket in a blocked state and unable to complete until some other task is completed first.
Bounty
$100
A bounty of $100 for any open-source contributor who provides a MR that solves this issue
Bounty
$1000
A bounty of $1000 for any open-source contributor who provides a MR that solves this issue
Bounty
$10000
A bounty of $10000 for any open-source contributor who provides a MR that solves this issue
Bounty
$20
A bounty of $20 for any open-source contributor who provides a MR that solves this issue
Bounty
$2000
A bounty of $2000 for any open-source contributor who provides a MR that solves this issue
Bounty
$250
A bounty of $250 for any open-source contributor who provides a MR that solves this issue
Bounty
$50
A bounty of $50 for any open-source contributor who provides a MR that solves this issue
Bounty
$500
A bounty of $500 for any open-source contributor who provides a MR that solves this issue
Bounty
$5000
A bounty of $5000 for any open-source contributor who provides a MR that solves this issue
Bounty
$750
A bounty of $750 for any open-source contributor who provides a MR that solves this issue
MoSCoW
Could have
Could have feature in order to satisfy the epic/legendary.
MoSCoW
Must have
Must have feature in order to satisfy the epic/legendary.
MoSCoW
Should have
Should have feature in order to satisfy the epic/legendary.
There are questions in the ticket that can not be completed until the project owner provides clarity.
Points
1
1 man-hours worth of work for an expert with no learning curve.
Points
13
13 man-hours worth of work for an expert with no learning curve.
Points
2
2 man-hours worth of work for an expert with no learning curve.
Points
21
21 man-hours worth of work for an expert with no learning curve.
Points
3
3 man-hours worth of work for an expert with no learning curve.
Points
34
34 man-hours worth of work for an expert with no learning curve.
Points
5
5 man-hours worth of work for an expert with no learning curve.
Points
55
55 man-hours worth of work for an expert with no learning curve.
Points
8
8 man-hours worth of work for an expert with no learning curve.
Points
88
88 man-hours worth of work for an expert with no learning curve.
Priority
Backlog
This ticket has backlogged priority and is not to be worked on yet
Priority
CI Blocker
Critical priority issue that blocks CI/CD pipeline and prevents PR merges
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
A ticket for learning a tool or technology that is needed to be able to do future planning and design.
State
Completed
The ticket has been fully implemented, completed, and merged with the source code. This label should only be applied once a ticket is closed.
State
Duplicate
A ticket that represents the same content as an existing ticket.
State
In Progress
A ticket that is actively being developed.
State
In Review
A ticket that has had some code completed to implement but is waiting to pass peer review and is not yet merged in.
State
Paused
This ticket's work started but wasn't finished. It's on hold (likely in a feature branch) and will be resumed later, either due to a blocker or a delay.
State
Unverified
All new tickets start in this state. A developer may set it to show the ticket is unverified. This means we haven't agreed to work on it. It will either move to a verified state or be closed as wontdo.
State
Verified
The issue has been verified by a developer as legitimate. It will be worked on and verified tickets are now considered part of the backlog.
State
Wont Do
This ticket has been decided it wont be done. This may mean the bug has been determined to not be real (cant verify) or the feature is one we have decided we dont want to adopt.
Type
Automation
Any edits or discussion about the AI automated coding system.
Type
Bug
Something that doesnt work as intended.
Type
Discussion
Anytime a ticket represents a discussion about a subject and doesnt fall into one of the other categories.
Type
Documentation
An error or improvement needed in the documentation.
Type
Epic
Any first tier epic. That is, an epic which contains only issues as children and will not have sub-epics.
Type
Feature
Some new functionality not present.
Type
Legendary
A type of Epic which will contain other Epics.
Type
Refactor
A code change that restructures existing code without changing its external behavior.
Type
Support
Someone needs help using the project.
Type
Task
A generic task that doesnt fit into the other type categories.
Type
Testing
Work exclusively focusing on fixing or expanding testing.
Projects
Clear projects
No project
Assignees
aditya (Aditya Chhabra)
aleenaumair (Aleena Umair)
brent.edwards (Brent Edwards)
CoreRasurae (Luis Mendes)
drew (Drew Morris)
eugen.thaci (Eugen Thaci)
freemo (Jeffrey Phillips Freeman)
HAL9000 (HAL 9000)
HAL9001 (HAL9001)
hamza.khyari (Hamza Khyari)
hurui200320 (Rui Hu)
justin.morris
khird (Kyle Hird)
org.cleveragents
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cleveragents/cleveragents-core#11216
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "bugfix/m5-acms-project-budget-override"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Re-ships the ACMS project-level hot_max_tokens fix that was stranded after PR #11036 was merged with only the
CONTRIBUTORS.mdentry. This PR delivers the actual code fix.Changes
_resolve_effective_budget()method toACMSExecutePhaseContextAssemblerproject.settings.hot_max_tokensfrom each linked projectmax(project_budgets)when any project has an overrideself._hot_max_tokenswhen no override is setassemble()to use the resolved effective budget for bothCoreContextBudgetandContextRequest@tdd_issue @tdd_issue_11035tags verifying the pipeline receives the project-level budget### Fixedin## [Unreleased]as first itemCRPFragment/CRPProvenanceimports to module-level per project style rulesImpact
Users who set
agents project context set --hot-max-tokens 32000will now actually see source files in context that would previously have been excluded by the 16K default budget.Testing
@tdd_issue @tdd_issue_11035Reviewer Flags Addressed
bugfix/m5-acms-project-budget-override(followsbugfix/mN-convention, milestone v3.5.0)### Fixedin## [Unreleased]@tdd_issue @tdd_issue_11035tags, 2-space indentedCRPFragment/CRPProvenanceat top of step definitions fileDependency Links
Fixes: #11035
Fixes: #11215
cc449e8a7atof7d2d6867e[GROOMED] Quality analysis complete.
Checks performed:
Fixes applied:
none
Notes:
Automated by CleverAgents Bot
Supervisor: Grooming | Agent: grooming-worker
[GROOMED] Quality analysis complete.
Checks performed:
Fixes applied:
Notes:
Automated by CleverAgents Bot
Supervisor: Grooming | Agent: grooming-worker
Comment test
[GROOMED] Quality analysis complete.
Checks performed:
Fixes: #11035andFixes: #11215in body (auto-close on merge).Fixes applied:
Patched previous malformed backtick escaping in PR body from prior grooming run (code method names
_resolve_effective_budget(),self._hot_max_tokenscorrectly escaped now).Notes:
/issues/{id}/dependencies) returns HTTP 500 "IsErrRepoNotExist" — explicit block relationships could not be created via API. Closing keywords in PR body and explicit Blocks: documentation line serve as proxy linkage.stale_with_conflicts— CI is failing (ci_status=failing). These are code/CI implementation concerns for the implementor to address before merge.Automated by CleverAgents Bot
Supervisor: Grooming | Agent: grooming-worker
[GROOMED] Quality analysis complete.
Checks performed:
Fixes applied:
Notes:
[GROOMED] Quality analysis complete.
Checks performed:
Fixes applied:
Notes:
Automated by CleverAgents Bot
Supervisor: Grooming | Agent: grooming-worker
f7d2d6867etoee3f8fe86a[GROOMED] Quality analysis complete.
PR #11216: fix(acms) - use project-level hot_max_tokens in execute phase context assembly
Branch: bugfix/m5-acms-project-budget-override -> master
Author: hamza.khyari | Milestone: v3.5.0
Checks Performed:
Dependencies via Fixes keywords in PR body (#11035, #11215).
POST /issues/N/dependencies API returned IsErrRepoNotExist.
Issues Found:
Recommendation: Proceed with review once CI passes.
ee3f8fe86ato796e92197b[GROOMED] Re-analysis: PR #11216
Status update since initial grooming:
execute_phase_context_assembler_coverage_steps.py, execute_phase_context_assembler.py
Blockers:
Recommendation: Resolve CI and obtain approval from HAL9001 before attempting merge.
Code Review: PR #11216
Summary
This PR correctly fixes the ACMS execute-phase context assembler not respecting project-level
hot_max_tokensoverrides. The bug was that the assembler always used the constructor-injected global budget (default 4096) regardless of what users set viaagents project context set --hot-max-tokens, causing relevant source files to be excluded from LLM prompt context even when a project had configured a larger budget.What's Done Well
_resolve_effective_budget()that reads each linked project'ssettings.hot_max_tokens, takes the maximum, and falls back to the global default — simple and correct.hot_max_tokens=32000and asserting the pipeline received the correct value.# type: ignoresuppressions across all changed files.Minor Suggestions (non-blocking)
Missing Closes keyword in PR body
The CHANGELOG references issue #11035 but the PR description has no
Closes #11035orFixes #11035keyword. Per CONTRIBUTING.md PR requirements, closing keywords for linked issues are mandatory. Please addCloses #11035to the description.Commit message accuracy (commit
ef6829b6)The first commit claims to remove an unused
pathlib.Pathimport but also fixes indentation on line 501 ofllm_actors.py, removesstr()wrapping around full_path, and strips an unusedimport osfrompath_mapper.py. These are three separate concerns; either restructure into individual commits or update the commit message to reflect all changes accurately.Broad exception in _resolve_effective_budget
Line 85 (
except Exception: continue) swallows ALL exceptions during project lookup, including unexpected errors like memory failures. Consider narrowing toexcept (NotFoundError, KeyError):if those exceptions are defined, though the blanket catch is acceptable here for resilience.Conclusion
LGTM with minor suggestion #1 being the only actionable item before merge.
Review — PR #11216 | | Title:
fix(acms): use project-level hot_max_tokens in execute phase context assembly| Author: hamza.khyari | Milestone: v3.5.0 | ### OVERALL ASSESSMENT: REQUEST_CHANGES The core fix is sound —ACMSExecutePhaseContextAssembler._resolve_effective_budget()correctly reads project-level overrides and takes the maximum budget. The Behave regression test with@tdd_issue @tdd_issue_11035tags properly validates the override path. However, there are blocking issues to address before APPROVED status: ### BLOCKING ISSUES | #### 1. Missing Closing Keywords [CRITICAL] Per CONTRIBUTING.md requirement #12 on PR submission: > Closing keyword for every linked issueCloses #NorFixes #NThe PR description references issues #11035 and #11215 but the closing keywords appear only in the PR body (after ## Summary, after the changes list). This is correct — the PR DOES haveFixes: #11035andFixes: #11215. My apologies — upon re-reading I see the keywords ARE present. Moving this to suggestion only. |#### 2. Commit Message Mismatch [SUGGESTION] Reviewer #8937 noted commitef6829b6claims one thing but includes multiple unrelated changes (unused pathlib import, llm_actors.py indentation fix, path_mapper.py unused import removal). If this is a squashed single commit, the message should accurately summarize ALL changes or they should be split. |#### 3. Broad Exception Handler [SUGGESTION] In_resolve_effective_budget()around line 85:except Exception: continueswallows ALL exceptions during project budget lookup. A better approach would be to catch specific exception types (e.g.,ValueError,KeyError) to avoid silently masking real bugs like TypeError from malformed data or PermissionError from file access failures. Not blocking — the fallback behavior is safe. |### ASSESSMENT OF REVIEWER #8937 FEEDBACK I concur with review #8937's assessment. The fixes for CI passing, clean syntax, and notype: ignorecomments are noted and verified by inspection. The suggestions regarding Closes keyword (already present — confirmed), commit message accuracy, and the broad exception handler are all valid as non-blocking suggestions. |### VERDICT: PENDING WITH CONFIRMATION All changes in this PR align with the spec. The code is clean, well-tested, and solves the bug identified in #11035. No type suppressions found. The CI gates have passed (confirmed by green status checks). This review remains PENDING — no further REQUEST_CHANGES needed per my own analysis of the diff. |Approved in principle, pending: - Confirmation that closing keywords (#11035, #11215) are correctly recognized by Forgejo for issue auto-closureReview - PR #11216 | HAL9001%0A%0ATitle: fix(acms): use project-level hot_max_tokens in execute phase context assembly%0AAuthor: hamza.khyari | Milestone: v3.5.0 | Priority: Critical%0A### OVERALL ASSESSMENT: APPROVED%0A%0AMy review confirms PENDING review #8937 findings and upgrades status from PENDING to APPROVED.%0A%0A---%0A%0ACode Review%0A-
_resolve_effective_budget()correctly reads project-level hot_max_tokens overrides, takes max(), falls back to global constructor default 4096 when no override exists.%0A- The method properly handles malformed data via isinstance(budget, int) guard - non-int budgets are silently skipped (safe behavior).%0A-_to_context_fragment()has proper type guards on relevance and detail_depth with sensible defaults (relevance clamped to 0-1, detail_depth defaults to 1).%0A-assemble()chains all methods correctly, logging excluded fragment counts per category for observability.%0A%0AType Safety%0A- All function signatures and return types are annotated. No type: ignore found anywhere in the diff.%0A- New method_resolve_effective_budgetuseslist[int]type hints. Protocol compliance verified.%0A%0ATests Verified%0A- 39 Behave scenarios with comprehensive coverage including protocol, view resolution, path/resource matching (absolute/relative/globs), fragment conversion (type-safety edge cases), and the key budget override regression test.%0A- Budget override scenario (@tdd_issue @tdd_issue_11035) mocks project with hot_max_tokens=32000, verifies pipeline receives budget.max_tokens==32000 over default 4096.%0A- All test step definitions are clean with ep cov namespace and no cross-contamination between scenarios.%0A%0ACI%0AAll CI checks passed on head commit796e921.%0A%0A---%0A%0ACompliance Checklist Verified%0A- CHANGELOG updated under Fixed entry for #11035 (line 107)%0A- Behave regression test present with @tdd_issue tags%0A- Branch namebugfix/m5-acms-project-budget-overridematches milestone v3.5.0 convention%0A- Prior review #8937 suggestions (commit message accuracy, broad except as non-blocking) acknowledged%0A%0ANote on Broad Exceptions%0A- Lines 64 and 85 useexcept Exceptionrather than bare-except or specific types. This is a known pattern in this codebase and the prior reviewer flagged it as non-blocking. Safe fallback behavior ensures no data corruption.%0A%0APR blocks issue #11035 per contributor stated intent (per CONTRIBUTING.md, correct direction: PR to blocks to issue).%0A%0AApproved - all review blockers from prior assessments are resolved or acknowledged as non-blocking. The code is clean, well-tested, and correctly fixes bug #11035.%0A%0A---%0AAutomated by CleverAgents Bot | Supervisor: PR Review | Agent: pr-review-workerPR Review: fix(acms): use project-level hot_max_tokens in execute phase context assembly
CI Gate: PASS
796e9219combined CI status: success (12 checks, all passing).1. CORRECTNESS
The bug is clearly described and the fix addresses the root cause identified in #11035.
The
assemble()method was usingself._hot_max_tokens(the global default of 16K) insteadof respecting project-level overrides set via
agents project context set --hot-max-tokens.The new
_resolve_effective_budget()method correctly iterates over linked projects, readseach one's
settings.hot_max_tokens, and returns the maximum override - falling back to theglobal when no override exists.
The fix is applied in exactly the right place: after
viewsare resolved (line 176) andbefore
CoreContextBudget/ContextRequestconstruction (lines 254, 261).No incorrect behavior or edge case failures identified.
Verdict: PASS
2. SPECIFICATION ALIGNMENT
The fix aligns with the intended design: project-level context budgets should take precedence
over global defaults during execute-phase assembly. No ADR needed - this is a bug fix restoring
expected behavior, not an architectural change.
The method correctly mirrors how
_resolve_execute_view()already works - both useself._project_repository, both iterate overproject_names, and both fall back to globaldefaults when no override is found.
Verdict: PASS
3. TEST QUALITY
Behave BDD scenario added with
@tdd_issue @tdd_issue_11035tags:_make_assembler()helper pattern consistently.MagicMockfor the project repository.pipeline.assemble.call_argsto confirm the budget kwarg.Verdict: PASS
4. TYPE SAFETY
All new code is fully type-annotated:
_resolve_effective_budget(self, project_names: list[str]) -> int- correct signatureproject_budgets: list[int] = []- explicit type hintisinstance(budget, int)for runtime validation# type: ignoreanywhere in the diffVerdict: PASS
5. READABILITY
New code is clean and self-documenting:
project_budgets,effective_budget)CRPFragment/CRPProvenanceimports lifted to module level per project styleVerdict: PASS
6. PERFORMANCE
O(n) single pass over
project_names. No N+1 patterns or redundant I/O.The
getattr(project, "settings", None)pattern prevents exceptions on unexpected shapes.Verdict: PASS
7. SECURITY
No secrets, tokens, or credentials in the diff. Exception handling is broad but appropriate
for repository lookup - failures are non-fatal (continue to next project).
isinstance(budget, int) and budget > 0validates values before using them.Verdict: PASS
8. CODE STYLE
SOLID principles followed:
self._project_repositoryabstraction instead of direct DB accessCHANGELOG entry correctly placed as first item under
### Fixedin## [Unreleased].Branch name
bugfix/m5-acms-project-budget-overridefollowsbugfix/mN-<name>convention.Verdict: PASS
9. DOCUMENTATION
New method docstring explains behavior. CHANGELOG entry documents the fix for users.
PR description is comprehensive with Summary, Changes, Impact, Testing sections.
Verdict: PASS
10. COMMIT AND PR QUALITY
fix(acms):prefixVerdict: PASS
Summary
This is a clean, well-scoped bug fix addressing a clear root cause with minimal targeted changes.
The new method follows existing patterns, test coverage is adequate, and all CI gates pass.
No blockers identified. Approving for merge.
[HAL9001] PR Review Bot Signature
This is a signed-off review. All 10 categories passed:
796e92197btoc6aced91d4c6aced91d4to1baa888659