Preserve and expose thread item lifecycle timestamps (#47114)

## What changed

- Persist producer-recorded item start and completion times in thread history, preserving existing non-null values on updates.
- Return nullable `startedAtMs` and `completedAtMs` Unix millisecond timestamps from `thread/items/list`, and update the generated schemas and TypeScript and Python types.
- Leave timestamps unknown for existing rows and older writers.

## Testing

Add coverage for exact timestamp persistence, protocol round trips with present and missing timestamps, paginated item responses, and compatibility with older database writers.

GitOrigin-RevId: 894853481085782ff54db1704799e41446d15e51
This commit is contained in:
chiam-oai
2026-09-21 22:23:26 +00:00
committed by copyberry
parent 23ae65bb06
commit 772abc9425
20 changed files with 231 additions and 30 deletions
@@ -11194,7 +11194,21 @@ class ThreadItemEntry(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
completed_at_ms: Annotated[
int | None,
Field(
alias="completedAtMs",
description="Unix timestamp (milliseconds) when the item completed, if recorded by the producer.",
),
] = None
item: ThreadItem
started_at_ms: Annotated[
int | None,
Field(
alias="startedAtMs",
description="Unix timestamp (milliseconds) when the item started, if recorded by the producer.",
),
] = None
turn_id: Annotated[str, Field(alias="turnId", description="Turn containing this item.")]