Skip to content

ref(chat): Bound active thread scratch TTL - #1361

Closed
sentry-junior[bot] wants to merge 3 commits into
mainfrom
ref/thread-runtime-ttl
Closed

ref(chat): Bound active thread scratch TTL#1361
sentry-junior[bot] wants to merge 3 commits into
mainfrom
ref/thread-runtime-ttl

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Keep one shared thread scratch bag. Bound the whole bag to 24h while a turn is active or paused; otherwise keep the existing 7d cache TTL.

  • Leave sandbox refs in the same bag as conversation state
  • Add loadThreadRuntimeState() so callers get coerced runtime parts from one place
  • No separate processing/sandbox keys or terminal markers

This replaces the earlier split-key approach after review feedback about complexity.

Refs #1267

Checks: pnpm --filter @sentry/junior exec tsc --noEmit; focused Vitest 80/80; pnpm --filter @sentry/junior lint.

Requested by David Cramer.

--

View Junior Session [Sentry]

Co-Authored-By: David Cramer <david@sentry.io>
@vercel

vercel Bot commented Aug 9, 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 9, 2026 11:23pm

Request Review

Co-Authored-By: David Cramer <david@sentry.io>

@dcramer dcramer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

theres some excessively complexity in this change that needs resolved

Comment thread packages/junior/src/chat/app/factory.ts Outdated
Comment thread packages/junior/src/chat/app/factory.ts Outdated
Comment thread packages/junior/src/chat/app/factory.ts Outdated
Comment thread packages/junior/src/chat/app/factory.ts Outdated
Comment thread packages/junior/src/chat/runtime/thread-state.ts Outdated
Keep one shared thread bag. Use a short TTL only while processing is
active, leave sandbox with conversation state, and load runtime parts
through one helper.
@sentry-junior sentry-junior Bot changed the title ref(chat): Bound thread runtime state retention ref(chat): Bound active thread scratch TTL Aug 10, 2026
@dcramer
dcramer marked this pull request as ready for review August 10, 2026 01:35
@github-actions github-actions Bot added the risk: high PR risk score: high label Aug 10, 2026
export const JUNIOR_THREAD_STATE_TTL_MS = 7 * 24 * 60 * 60 * 1000;

/** Bound thread scratch while a turn is still active or paused. */
export const JUNIOR_ACTIVE_THREAD_STATE_TTL_MS = 24 * 60 * 60 * 1000;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thread state vs active thread state makes little sense...

@sentry-junior

sentry-junior Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Closing without merge.

Adaptive TTL and split-key scratch retention do not match the intended model: Redis should hold short-lived active thread state only (processing / maybe sandboxRef), with cold start from SQL. Artifacts still live only in the shared bag, so shortening TTL without a durable home is user-visible loss.

Salvaged as tracker design on #1267, not as code. Next real cut is artifacts durability, then vision, then short active-only scratch.

Refs #1267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant