mirror of
https://github.com/openai/codex.git
synced 2026-11-22 15:15:18 +00:00
Add configurable goal token budget limits (#37878)
## What changed - Add `goals.max_goal_token_budget` as a positive-integer configuration setting. - Use the configured maximum as the default budget for new goals and when `tokenBudget` is reset to `null`. - Reject goal creation and updates whose token budget exceeds the configured maximum, including requests through goal tools and `thread/goal/set`. - Respect managed configuration precedence and per-thread configuration overrides. ## Testing - Cover configuration parsing and managed overrides. - Cover defaulting, resetting, and rejecting oversized budgets through the goal service, goal tools, and app-server API. GitOrigin-RevId: f8d7e6418cdc237d454c8cf47bb32ba0d44a60cf
This commit is contained in:
1 parent
a603d7ca5c
commit
a9dee37f9c
14 files changed
+391
-26
No files matched your search
@@ -326,6 +326,28 @@ consolidation_model = "gpt-5.2"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn goal_max_token_budget_requires_positive_integer() {
|
||||
let config_toml = toml::from_str::<ConfigToml>("[goals]\nmax_goal_token_budget = 25000\n")
|
||||
.expect("positive goal token budget should deserialize");
|
||||
let config = Config::load_from_base_config_with_overrides(
|
||||
config_toml,
|
||||
ConfigOverrides::default(),
|
||||
tempdir().expect("tempdir").abs(),
|
||||
)
|
||||
.await
|
||||
.expect("positive goal token budget should load");
|
||||
assert_eq!(config.max_goal_token_budget, Some(25_000));
|
||||
|
||||
for invalid in ["0", "-1", "1.5", "\"100\""] {
|
||||
let config = format!("[goals]\nmax_goal_token_budget = {invalid}\n");
|
||||
assert!(
|
||||
toml::from_str::<ConfigToml>(&config).is_err(),
|
||||
"invalid goal token budget should be rejected: {invalid}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_bundled_skills_config() {
|
||||
let cfg: ConfigToml = toml::from_str(
|
||||
|
||||
Reference in new issue
Block a user