Skip to content

ref(chat): Shorten turn session retention - #1308

Merged
dcramer merged 2 commits into
mainfrom
ref/turn-session-ttl-split
Aug 7, 2026
Merged

dcramer merged 2 commits into
mainfrom
ref/turn-session-ttl-split

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Turn-session Redis records and summary indexes no longer inherit chat-sdk's 30-day retention. Unfinished sessions retain a 24-hour resume lease; completed, failed, and abandoned sessions retain a one-hour diagnostic grace period.

Terminal cleanup

Terminal writes also drop volatile runtimeContext immediately, while SQL remains the durable history and execution authority. Explicit test TTL overrides remain supported.

Refs #1267

Requested by David Cramer.

--

View Junior Session [Sentry]

@vercel

vercel Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Aug 7, 2026 9:22pm

Request Review

@dcramer
dcramer marked this pull request as ready for review August 7, 2026 21:13
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Aug 7, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bde109e. Configure here.

Shared summary lists hold many sessions. A terminal write must not
shorten their TTL to the one-hour record grace and expire unfinished
siblings still under a resume lease.
@dcramer

dcramer commented Aug 7, 2026

Copy link
Copy Markdown
Member

is this just queued state? like the time window the agent has to ack the turn information? if so that can be reduced to like one hour

@sentry-junior

sentry-junior Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

not just queue ack.

unfinished turn-session redis is the resume lease for non-terminal turns (running / awaiting_resume): timeout slices, cooperative yield, retry, and auth pauses. cursors + runtimeContext live there so continue can rebuild the exact boundary over SQL history.

auth is the long tail today — MCP oauth attempts are already 24h (MCP_AUTH_SESSION_TTL_MS), so the unfinished lease was matched to that window. plain timeout/yield resumes are much shorter.

if we drop unfinished to 1h, auth callbacks after that lose the lease and fail closed even when the oauth attempt is still valid. happy to cut to 1h if we also want that auth behavior (or a later split: short default + auth-reason keeps longer). terminal stays 1h either way.

@dcramer
dcramer enabled auto-merge (squash) August 7, 2026 21:54
@dcramer
dcramer merged commit 104ea9b into main Aug 7, 2026
40 checks passed
@dcramer
dcramer deleted the ref/turn-session-ttl-split branch August 7, 2026 21:54

This branch was successfully deployed

1 active deployment
Preview – junior-docs — e552daad Deployed Aug 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant