Skip to content

[codex] add rollout token budget configuration (1/N)#28746

Merged
rka-oai merged 4 commits into
mainfrom
codex/rollout-budget-config
Jun 18, 2026
Merged

[codex] add rollout token budget configuration (1/N)#28746
rka-oai merged 4 commits into
mainfrom
codex/rollout-budget-config

Conversation

@rka-oai

@rka-oai rka-oai commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

What

This PR defines the structured configuration contract for shared rollout token budgets (across ALL agent threads under 1 rollout).

[features.rollout_budget]
enabled = true
limit_tokens = 100000
reminder_interval_tokens = 10000
sampling_token_weight = 1.0
prefill_token_weight = 0.1

The reminder interval defaults to 10% of the rollout limit. Sampling and prefill weights default to 1.0.

Scope

This PR only defines and validates configuration. It does not track usage, inject reminders, or stop a rollout. Accounting and reminders are implemented in the stacked follow-up #28494.

The existing token_budget feature remains unchanged. rollout_budget has its own feature key and configuration type.

Tests

The config test verifies that the structured fields resolve into RolloutBudgetConfig and do not enable the existing token_budget feature.

Local checks:

  • just write-config-schema
  • just test -p codex-core load_config_resolves_rollout_budget
  • cargo check -p codex-thread-manager-sample
  • git diff --check

The full workspace test suite was not run locally.

Comment thread codex-rs/core/src/config/mod.rs
@rka-oai rka-oai changed the title [codex] add rollout budget configuration [codex] add rollout token budget configuration Jun 17, 2026
@rka-oai rka-oai changed the title [codex] add rollout token budget configuration [codex] add rollout token budget configuration [varlength] Jun 17, 2026
@rka-oai rka-oai changed the title [codex] add rollout token budget configuration [varlength] [codex] add rollout token budget configuration (varlength 1/N) Jun 17, 2026
@rka-oai rka-oai marked this pull request as ready for review June 17, 2026 20:29
@rka-oai rka-oai requested a review from a team as a code owner June 17, 2026 20:29

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5596849a5c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core/src/config/mod.rs Outdated
Comment on lines +2510 to +2512
let reminder_interval_tokens = config
.reminder_interval_tokens
.unwrap_or_else(|| (limit_tokens / 10).max(1));

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.

P2 Badge Persist resolved rollout-budget defaults in config locks

These rollout-budget defaults are computed only during config load, but save_config_resolved_fields only materializes generic feature enablement and multi_agent_v2; it never writes config.rollout_budget back into the lock. When config-lock export/replay is used with a budget table that omits reminder_interval_tokens or either weight, the lock records only the partial TOML, so a later default change can replay the same session with different budget behavior while validation still passes. Serialize the resolved RolloutBudgetConfig into features.rollout_budget the same way multi_agent_v2 is handled.

AGENTS.md reference: AGENTS.md:L103-L110

Useful? React with 👍 / 👎.

@rka-oai rka-oai Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

followed existing precedent from the multi agent feature. handled in 38c5b92

@rka-oai rka-oai merged commit ecc4c30 into main Jun 18, 2026
31 checks passed
@rka-oai rka-oai deleted the codex/rollout-budget-config branch June 18, 2026 11:29
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 2026
@rka-oai rka-oai changed the title [codex] add rollout token budget configuration (varlength 1/N) [codex] add rollout token budget configuration (1/N) Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants