feat(frontend): session id plumbing into requests (#48048)

Signed-off-by: Karen Chung <karenc@nvidia.com>
This commit is contained in:
Karen Chung
2026-08-03 22:18:58 +00:00
committed by GitHub
parent e578de311c
commit f57123aa2d
39 changed files with 438 additions and 4 deletions
@@ -124,6 +124,9 @@ pub struct EngineCoreRequest {
/// standard `request_finished` hook.
#[serde(default)]
pub abort_immediately: bool,
/// Stable session identity shared by related requests.
#[serde(default)]
pub session_id: Option<String>,
}
impl EngineCoreRequest {
@@ -175,6 +178,7 @@ mod tests {
}),
arrival_time: 1234.5,
client_index: 7,
session_id: Some("session-1".to_string()),
..EngineCoreRequest::default()
};
@@ -185,12 +189,13 @@ mod tests {
other => panic!("expected array, got {other:?}"),
};
assert_eq!(array.len(), 20);
assert_eq!(array.len(), 21);
assert_eq!(array[0], Value::from("req-1"));
assert_eq!(array[2], Value::Nil);
assert_eq!(array[4], Value::Nil);
assert_eq!(array[10], Value::Nil);
assert_eq!(array[11], Value::from(7));
assert_eq!(array[20], Value::from("session-1"));
}
#[test]
@@ -162,6 +162,7 @@ fn sample_request_with_id(request_id: &str) -> EngineCoreRequest {
..EngineCoreSamplingParams::for_test()
}),
arrival_time: 42.5,
session_id: Some("session-1".to_string()),
..EngineCoreRequest::default()
}
}
@@ -75,6 +75,7 @@ class EngineCoreRequest(
reasoning_ended: bool | None = None
reasoning_parser_kwargs: dict[str, object] | None = None
abort_immediately: bool = False
session_id: str | None = None
class EngineCoreOutput(
@@ -137,6 +138,7 @@ request = EngineCoreRequest(
pooling_params=None,
arrival_time=42.5,
client_index=0,
session_id="session-1",
)
# All defaults -> empty map. Regression guard for the sparse-map decode.