mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
Deliver gRPC code-mode notifications without truncation (#38645)
## What changed - Forward notification text to the session delegate without applying the previous 1,024-byte limit or appending a truncation suffix. - Update the gRPC host integration test to verify that oversized multibyte notification text is delivered unchanged. GitOrigin-RevId: 9a9e24b359a07540f70ec4e98b28524db3f7a4a0
This commit is contained in:
committed by
copyberry
parent
efa97f9bc6
commit
fe556c4b6c
@@ -16,9 +16,6 @@ use super::conversion;
|
||||
use super::deadline;
|
||||
use super::state::CallbackAdmission;
|
||||
|
||||
const MAX_NOTIFICATION_BYTES: usize = 1_024;
|
||||
const TRUNCATED_NOTIFICATION_SUFFIX: &str = "... [truncated]";
|
||||
|
||||
impl SessionInner {
|
||||
pub(super) fn spawn_session_events(
|
||||
self: &Arc<Self>,
|
||||
@@ -197,15 +194,8 @@ impl SessionInner {
|
||||
|
||||
fn handle_notification(
|
||||
self: &Arc<Self>,
|
||||
mut notification: grpc::Notification,
|
||||
notification: grpc::Notification,
|
||||
) -> Result<(), String> {
|
||||
if notification.text.len() > MAX_NOTIFICATION_BYTES {
|
||||
let boundary = notification
|
||||
.text
|
||||
.floor_char_boundary(MAX_NOTIFICATION_BYTES - TRUNCATED_NOTIFICATION_SUFFIX.len());
|
||||
notification.text.truncate(boundary);
|
||||
notification.text.push_str(TRUNCATED_NOTIFICATION_SUFFIX);
|
||||
}
|
||||
let admission = self
|
||||
.state
|
||||
.lock()
|
||||
|
||||
Reference in New Issue
Block a user