mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Expose lifecycle timestamps on app-server thread items (#57172)
## What changed - Add nullable `startedAtMs` and `completedAtMs` fields to `ThreadItem` in live notifications and turn history. Values are Unix milliseconds when recorded. - Preserve recorded item times through history reconstruction, pagination, and resume, including command start times recorded during approval. - Separate the Rust item payload into `ThreadItemPayload` while keeping the JSON payload flat, and update consumers, schemas, and generated TypeScript and Python types. ## Testing Extend coverage for timestamp serialization, history reconstruction, paginated reads and resume, and persisted Python SDK items. GitOrigin-RevId: ecbcee95af52db7c807b46a6e9deb30e5fba1f80
This commit is contained in:
@@ -1695,6 +1695,34 @@ pub enum EventMsg {
|
||||
SubAgentActivity(SubAgentActivityEvent),
|
||||
}
|
||||
|
||||
impl EventMsg {
|
||||
/// Returns the ID and start time of the command this approval opens.
|
||||
/// Stdin and network reviews have their own prompts for an existing operation.
|
||||
pub fn command_approval_start(&self) -> Option<(&str, i64)> {
|
||||
match self {
|
||||
Self::ExecApprovalRequest(request)
|
||||
if request.approval_id.is_none() && request.network_approval_context.is_none() =>
|
||||
{
|
||||
Some((&request.call_id, request.started_at_ms))
|
||||
}
|
||||
Self::GuardianAssessment(assessment)
|
||||
if assessment.status == GuardianAssessmentStatus::InProgress
|
||||
&& matches!(
|
||||
assessment.action,
|
||||
GuardianAssessmentAction::Command { .. }
|
||||
| GuardianAssessmentAction::Execve { .. }
|
||||
) =>
|
||||
{
|
||||
Some((
|
||||
assessment.target_item_id.as_deref()?,
|
||||
assessment.started_at_ms,
|
||||
))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS, EnumIter)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum HookEventName {
|
||||
|
||||
Reference in New Issue
Block a user