Add auto-compaction fallback token-budget settings (#33243)

## What changed

- Add `auto_compact_fallback_prompt` and
  `auto_compact_fallback_buffer_tokens` to `features.token_budget` and the
  generated configuration schema.
- Trim empty fallback prompts, limit prompts to 2,000 bytes, require a buffer
  when a prompt is configured, and reject non-positive buffer values.
- Preserve the new settings when locking resolved session configuration.

## Testing

- Cover config resolution and validation for overlong prompts, missing
  buffers, and non-positive buffers.
- Extend the configuration-lock test to cover both settings.

GitOrigin-RevId: 6463f963ba1dbd633d76601b8344360a8c85cf8b
This commit is contained in:
rka-oai
2026-07-15 04:48:45 +00:00
committed by copyberry
parent fca51f6daf
commit 8aae858958
5 changed files with 135 additions and 0 deletions
+4
View File
@@ -249,6 +249,8 @@ mod tests {
reminder_threshold_tokens: Some(16_000),
reminder_message_template: "Locked reminder: {n_remaining} tokens.".to_string(),
guidance_message: Some("Locked context-window guidance.".to_string()),
auto_compact_fallback_prompt: Some("Write notes before rollover.".to_string()),
auto_compact_fallback_buffer_tokens: Some(8_000),
});
config
.features
@@ -342,6 +344,8 @@ mod tests {
"Locked reminder: {n_remaining} tokens.".to_string()
),
guidance_message: Some("Locked context-window guidance.".to_string()),
auto_compact_fallback_prompt: Some("Write notes before rollover.".to_string()),
auto_compact_fallback_buffer_tokens: Some(8_000),
}))
);