mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
Expose assistant content token counts in completion notifications (#59041)
## What changed Add optional `contentTokenCount` metadata to `item/completed` notifications, carrying the producer-supplied token count for each completed assistant message in default and plan modes. Counts include any sampled footer and are `null` when unavailable. Keep this telemetry separate from stored thread items and omit it from subsequent model requests. Update the protocol schemas and generated TypeScript and Python types. ## Testing Add coverage for per-message counts, including zero, in default and plan modes; missing and malformed metadata; backward-compatible notification decoding; and exclusion from subsequent model requests. GitOrigin-RevId: 35973037a42650fa2d7569da8e88cb81215cf971
This commit is contained in:
@@ -2425,7 +2425,9 @@ mod tests {
|
||||
|| (path == Path::new("v2/ProcessExitedNotification.ts")
|
||||
&& field_prefix.trim() == "outputDrainTimedOut?")
|
||||
|| (path == Path::new("v2/MisalignmentErrorDetails.ts")
|
||||
&& field_prefix.trim() == "reviewTarget?");
|
||||
&& field_prefix.trim() == "reviewTarget?")
|
||||
|| (path == Path::new("v2/ItemCompletedNotification.ts")
|
||||
&& field_prefix.trim() == "contentTokenCount?");
|
||||
if field_prefix.chars().rev().find(|c| !c.is_whitespace()) == Some('?')
|
||||
&& !allow_optional_nullable
|
||||
&& !legacy_optional_nullable_field
|
||||
|
||||
Reference in New Issue
Block a user