Skip to content

Remove legacy effective-token limits and ET surfacing; keep migration codemods - #37686

Merged
pelikhan merged 7 commits into
mainfrom
copilot/remove-max-tokens-computation
Jun 8, 2026
Merged

Remove legacy effective-token limits and ET surfacing; keep migration codemods#37686
pelikhan merged 7 commits into
mainfrom
copilot/remove-max-tokens-computation

Conversation

CopilotAI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This change removes max-effective-tokens / max-daily-effective-tokens from the Go compiler and CLI behavior, including legacy ET budget propagation and ET display paths. The only retained legacy behavior is codemod migration from effective-token fields to AI-credit fields.

  • Compiler budget handling

    • Drops EngineConfig.MaxEffectiveTokens and all parse/merge/default wiring for max-effective-tokens.
    • Removes AWF config emission of apiProxy.maxEffectiveTokens; max-ai-credits remains the budget control.
    • Simplifies token-steering disable logic to max-ai-credits semantics.
  • Schema + import processing

    • Removes top-level schema properties for max-effective-tokens and max-daily-effective-tokens.
    • Removes import accumulator/result fields and first-wins extraction for imported max-effective-tokens.
  • CLI surface cleanup

    • Removes effective-token computation/display from token-usage aggregation paths (keeps AI credits aggregation).
    • Removes default_max_effective_tokens from env defaults file bindings and validation.
  • Tests updated to new contract

    • Removes/rewrites tests that asserted acceptance/propagation of legacy effective-token limit fields.
    • Aligns token-usage expectations to ET-disabled behavior while preserving AIC-focused assertions.
  • Exception explicitly preserved (codemods)

    • Keeps codemods that rewrite legacy frontmatter keys to AI-credit equivalents.
# beforemax-effective-tokens: 5Mmax-daily-effective-tokens: 10k# after (via codemod)max-ai-credits: 500max-daily-ai-credits: 1

CopilotAIand others added 4 commits June 8, 2026 00:11
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
CopilotAI changed the title Remove max-effective token limits and effective-token CLI surfacingRemove legacy effective-token limits and ET surfacing; keep migration codemodsJun 8, 2026
CopilotAI requested a review from pelikhanJune 8, 2026 00:26
@pelikhan
pelikhan marked this pull request as ready for review June 8, 2026 00:27
CopilotAI review requested due to automatic review settings June 8, 2026 00:27

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes legacy effective-token (ET) budget limits and ET-related budget propagation/surfacing across the compiler, schema/import processing, and CLI token-usage reporting—while keeping codemods that migrate legacy frontmatter keys to AI-credits equivalents.

Changes:

  • Removes max-effective-tokens / max-daily-effective-tokens support from engine config extraction, import merging, schema validation, and AWF config emission.
  • Simplifies token-steering enable/disable behavior to max-ai-credits semantics only, and updates tests accordingly.
  • Updates CLI token usage aggregation/tests to stop computing ET-derived metrics and deltas, focusing on AIC.
Show a summary per file
FileDescription
pkg/workflow/threat_detection.goRemoves ET budget propagation from detection engine execution step construction.
pkg/workflow/importable_tools_test.goUpdates import tests to stop asserting ET limit import/lock emission.
pkg/workflow/engine.goDrops EngineConfig.MaxEffectiveTokens and stops extracting it from frontmatter.
pkg/workflow/engine_config_test.goRemoves ET-focused engine config extraction test cases/assertions.
pkg/workflow/engine_config_parser.goRemoves ET parsing helper; leaves AIC parsing as the remaining budget parser.
pkg/workflow/compilerenv/manager.goRemoves enterprise default env var and resolver for ET budgets.
pkg/workflow/compilerenv/manager_test.goRemoves tests for ET enterprise default resolver.
pkg/workflow/compiler_orchestrator_engine.goRemoves preserved/import-default handling for ET budgets during engine/import setup.
pkg/workflow/compiler_orchestrator_engine_test.goRemoves tests ensuring negative ET preservation through import expansion.
pkg/workflow/awf_config.goRemoves AWF apiProxy.maxEffectiveTokens emission and ET-based steering disable logic.
pkg/workflow/awf_config_test.goRemoves tests that assert AWF config ET emission and ET-negative steering behavior.
pkg/parser/schemas/main_workflow_schema.jsonRemoves max-effective-tokens and max-daily-effective-tokens from the main schema.
pkg/parser/schema_test.goRemoves schema validation tests for ET fields and updates max-limits validation messages.
pkg/parser/schema_deprecated_test.goStops expecting ET fields in deprecated-field discovery output.
pkg/parser/import_processor.goRemoves ET merged-field output from ImportsResult.
pkg/parser/import_field_extractor.goRemoves ET first-wins extraction/accumulation during import traversal.
pkg/parser/import_field_extractor_test.goUpdates extractor tests to stop asserting merged ET values.
pkg/constants/constants.goRemoves default ET budget constant.
pkg/cli/token_usage.goDisables ET computation/deltas and shifts JSON/console surfacing toward AIC-only reporting.
pkg/cli/token_usage_test.goUpdates token-usage tests to expect ET fields to remain unset/zeroed.
pkg/cli/env_command.goRemoves defaults-file binding/validation for ET enterprise default.
pkg/cli/env_command_test.goUpdates env defaults tests to exclude ET default key and reworks update-change assertions.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

pkg/workflow/engine_config_parser.go:25

  • parseMaxAICreditsValue currently delegates to parseMaxEffectiveTokenLimitValue, which carries max-effective-tokens naming/logging semantics. Now that effective-token limits are removed, this coupling is confusing and can produce misleading log lines (e.g. "Parsed max-effective-tokens sentinel"). Consider parsing max-ai-credits directly here.
// parseMaxAICreditsValue parses max-ai-credits from either integer
// or numeric-string frontmatter values.
//
// A return value of 0 is a sentinel that means "not configured" (missing or
// invalid); explicit zero is not a valid user value. Negative values (-1) are
// passed through as-is and signal that budget enforcement and token steering
// should be disabled.
func parseMaxAICreditsValue(raw any) int64 {
if parsed, ok := parseMaxEffectiveTokenLimitValue(raw); ok {
return parsed
}
if raw != nil {
engineLog.Printf("Ignoring invalid max-ai-credits value of type %T: %v", raw, raw)
}
return 0
  • Files reviewed: 22/22 changed files
  • Comments generated: 4

Comment on lines 45 to 50
// AmbientContextMetrics captures token footprint for the first LLM invocation.
type AmbientContextMetrics struct {
InputTokens int `json:"input_tokens" console:"header:Ambient Input,format:number"`
CachedTokens int `json:"cached_tokens" console:"header:Ambient Cached,format:number"`
EffectiveTokens int `json:"effective_tokens" console:"header:Ambient Effective,format:number"`
EffectiveTokens int `json:"effective_tokens,omitempty"`
}
Comment on lines 60 to 65
TotalDurationMs int `json:"total_duration_ms"`
TotalResponseBytes int `json:"total_response_bytes"`
CacheEfficiency float64 `json:"cache_efficiency"`
TotalEffectiveTokens int `json:"total_effective_tokens" console:"header:Effective Tokens,format:number"`
TotalEffectiveTokens int `json:"total_effective_tokens,omitempty"`
TotalAIC float64 `json:"total_aic,omitempty"`
AmbientContext *AmbientContextMetrics `json:"ambient_context,omitempty"`
Comment on lines 89 to 99
type ModelTokenUsageRow struct {
Model string `json:"model" console:"header:Model"`
Provider string `json:"provider" console:"header:Provider"`
InputTokens int `json:"input_tokens" console:"header:Input,format:number"`
OutputTokens int `json:"output_tokens" console:"header:Output,format:number"`
CacheReadTokens int `json:"cache_read_tokens" console:"header:Cache Read,format:number"`
CacheWriteTokens int `json:"cache_write_tokens" console:"header:Cache Write,format:number"`
EffectiveTokens int `json:"effective_tokens" console:"header:Effective Tokens,format:number"`
EffectiveTokens int `json:"effective_tokens,omitempty"`
AIC float64 `json:"aic,omitempty"`
Requests int `json:"requests" console:"header:Requests"`
AvgDuration string `json:"avg_duration" console:"header:Avg Duration"`
Comment on lines 132 to 136
// parseTokenUsageFile parses a token-usage.jsonl file and returns the aggregated summary.
// Custom weights, when non-nil, override the built-in model multipliers and token class
// weights for effective token computation.
func parseTokenUsageFile(filePath string, customWeights *types.TokenWeights) (*TokenUsageSummary, error) {
func parseTokenUsageFile(filePath string, _ *types.TokenWeights) (*TokenUsageSummary, error) {
tokenUsageLog.Printf("Parsing token usage file: %s", filePath)
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot review all comments and review comments

@pelikhan
pelikhan merged commit 5363021 into mainJun 8, 2026
19 of 24 checks passed
@pelikhan
pelikhan deleted the copilot/remove-max-tokens-computation branch June 8, 2026 00:35
Copilot stopped work on behalf of pelikhan due to an error June 8, 2026 00:35
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@pelikhan