mirror of
https://github.com/openai/codex.git
synced 2026-11-17 22:10:37 +00:00
## Why Extension warnings need a stable thread target even when they are emitted outside an active turn. ## What changed - Add `ExtensionWarning` and a dedicated `ExtensionEventSink::emit_warning` path with an explicit thread ID and optional turn ID. - Deliver extension warnings as thread-scoped app-server `warning` notifications, preserving listener ordering and waiting briefly for a subscriber when no listener is active. - Move skills warnings to the new path, limiting provider catalog warnings to four messages of 256 bytes each. ## Testing - Cover warning routing, ordering, UTF-8-safe truncation, subscriber fallback, and invalid thread IDs. - Verify skills warning bounds and app-server delivery of executor catalog budget warnings. GitOrigin-RevId: 4dcb1ba7f17c0edb1a9d548f9568e0c734bffc15
13 lines
338 B
Rust
13 lines
338 B
Rust
use crate::render::truncate_utf8_to_bytes;
|
|
|
|
const MAX_WARNINGS: usize = 4;
|
|
const MAX_WARNING_BYTES: usize = 256;
|
|
|
|
pub(crate) fn bounded_warnings(warnings: &[String]) -> Vec<String> {
|
|
warnings
|
|
.iter()
|
|
.take(MAX_WARNINGS)
|
|
.map(|warning| truncate_utf8_to_bytes(warning, MAX_WARNING_BYTES).0)
|
|
.collect()
|
|
}
|