feat(session,config): add context memory budget with soft/hard thresholds#67
Merged
RyderFreeman4Logos merged 1 commit intomainfrom Feb 13, 2026
Merged
feat(session,config): add context memory budget with soft/hard thresholds#67RyderFreeman4Logos merged 1 commit intomainfrom
RyderFreeman4Logos merged 1 commit intomainfrom
Conversation
…olds (#sprint4) [MOTIVATION] Sessions need resource governance to prevent runaway token consumption. Without budget limits, a single session can consume unbounded tokens, especially in recursive/long-running agent workflows. [IMPLEMENTATION DETAILS] - Add TokenBudget struct to csa-session with soft (75%) / hard (100%) thresholds, remaining/usage tracking, and serde backward compat - Add token_budget and max_turns optional fields to TierConfig - Pipeline integration: budget initialization from tier config at session creation, pre-execution hard/soft threshold checks, post-execution token accumulation and turn counting - max_turns works independently of token_budget (uses u64::MAX sentinel) - Config validation rejects zero values for token_budget and max_turns - 17 new tests covering budget logic, serde roundtrips, and validation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TokenBudgetstruct tocsa-sessionwith soft (75%) / hard (100%) threshold enforcementtoken_budgetandmax_turnsoptional fields toTierConfigincsa-configmax_turnsworks independently oftoken_budget(usesu64::MAXsentinel when only turns configured)token_budgetandmax_turns#[serde(default)]for backward compatibility with existing TOML state filesTest plan
just pre-commit— 836 unit tests + 8 E2E all passcsa review --diff— 3 P1 issues found and fixedcsa review scope=range:main...HEAD— 0 findings, low risk🤖 Generated with Claude Code