Warn when skill catalogs exceed their context budget (#34997)

## Why

Skill catalog rendering can shorten descriptions or omit enabled skills to fit
the model context budget. Surface these reductions so users know when the
model-visible catalog has lost detail.

## What changed

- Emit a warning with the omitted skill count whenever entries do not fit.
- Warn when description shortening averages more than 100 characters per skill.
- Deduplicate executor catalog warnings across repeated world-state builds in a
  turn.

## Testing

- Cover the description-shortening threshold and omission warning text.
- Verify warnings through extension and production-turn catalogs, including
  per-turn deduplication.

GitOrigin-RevId: bd7fc3482e5dfd8c79072f772a2f54aa502478d9
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-07-23 19:44:12 +00:00
1 parent 7bafdada8b
commit 2c92af09cf
7 files changed
+283 -49

No files matched your search

+13
View File
@@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::collections::HashSet;
use std::future::Future;
use std::sync::Arc;
use std::sync::Mutex;
@@ -337,6 +338,18 @@ impl OrchestratorResourceCache {
}
}
#[derive(Default)]
pub(crate) struct EmittedCatalogBudgetWarnings(Mutex<HashSet<String>>);
impl EmittedCatalogBudgetWarnings {
pub(crate) fn insert(&self, warning: &str) -> bool {
self.0
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
.insert(warning.to_string())
}
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub(crate) struct SkillsTurnState {
pub(crate) catalog: SkillCatalog,