You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(agent): replace hardcoded * 4 / 5 token threshold with a named constant #417
Replace the hardcoded * 4 / 5 computations with a shared named threshold constant (e.g. reuse/promote tokenWarningThreshold = 0.80), computing int(float64(maxTokens) * threshold).
Keep the resulting value identical to the current integer arithmetic (verify rounding — x * 4 / 5 truncates; int(float64(x) * 0.80) should match for the relevant range, add a test if unsure).
Acceptance Criteria
No remaining hardcoded * 4 / 5 token-threshold computations in agent/scan.
The threshold is defined once as a named constant and reused.
Behavior is unchanged (same effective limit).
Tests pass (make test)
Code check passes (make check)
Context
Discovered during a codebase cleanup pass. Slightly more involved than a one-liner because the constant lives in a different package (llmloop) than the call sites (agent, scan), so contributors get a taste of cross-package refactoring. Watch out for integer-truncation vs float rounding when swapping the expression.
Activity
refactor(agent,scan): share one 80% token threshold (alibaba#421)
refactor(agent,scan): share one 80% token threshold (alibaba#421)