Repository navigation
ref(chat): Load turn-session routing from SQL on resume - #1268
Merged
Merged
Conversation
Prefer redis source/destination when present, but fill gaps from junior_conversations so resume no longer depends on nested contracts surviving the turn-session redis hangover. Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Resume paths query junior_conversations for destination and session source instead of preferring nested redis contracts with a SQL fallback. Co-Authored-By: David Cramer <[email protected]>
dcramer
marked this pull request as ready for review
August 6, 2026 16:40
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Channel-level scheduled/event dispatch sources omitted threadTs, so normalizeSessionSource dropped them and SQL-only resume failed closed. Keep channel locators, rebuild from destination for existing rows, and write sessionSource when enqueueing dispatch conversations.
When sessionSource is missing, recover threadTs from slack conversation ids so resume routing stays complete for threaded turns and set-once SQL writes do not persist a channel-only source.
Resume routing now returns only the SQL destination and sessionSource columns. Missing sessionSource fails closed instead of reconstructing from destination or conversation id. Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 138b96c. Configure here.
Co-Authored-By: David Cramer <[email protected]>
Resume routing is SQL-authoritative and drops per-message timestamps. Update continuation/OAuth fixtures and expectations so local suite coverage matches the hard-fail contract. Co-Authored-By: David Cramer <[email protected]>
This was referenced Aug 7, 2026
dcramer
added a commit
that referenced
this pull request
Aug 7, 2026
…1285) Unblock mainline CI. Every job was dying in `packages/junior prepare` on a type error from #1268, on top of the earlier file-length and structured-link failures. **Slack source URL typecheck** Channel-level session sources omit `threadTs`. `sourceUrlFromConversation` now skips archive URL construction when that anchor is missing, so `packages/junior prepare` typechecks again. **Agent dispatch suite split** `agent-dispatch-work.test.ts` was over the 1000-line file-length limit. Recovery cases move into `agent-dispatch-recovery.test.ts`, and shared helpers land in `tests/fixtures/agent-dispatch.ts`. **Structured Slack link assertion** `message-content-behavior.test.ts` now hydrates conversation messages before asserting full structured link targets, matching how message text is actually stored. **Checks** - `pnpm --filter @sentry/junior lint` - `pnpm --filter @sentry/junior typecheck` - `pnpm file-length:check` - integration tests not re-run here (no Docker/Postgres in this sandbox) --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
dcramer
added a commit
that referenced
this pull request
Aug 7, 2026
Stop writing nested destination/source into turn-session state. Writers project through one explicit Zod schema (`.strip()`), so unknown/deprecated keys never land in durable records or summary indexes. SQL remains the authority for routing via conversation metadata dual-writes. **Projection schemas** `agentTurnSessionSummarySchema` is the shared field set. The stored record schema extends that same projection with resume-only fields (`committedSeq`, `runtimeContext`, …). Summary indexes intentionally omit the heavier fields; they are not a second domain model. **Write-path cleanup** Optional-field ternary walls in the turn-session service collapse behind `definedProps` + a shared `sessionWriteContext` helper so each persist path only fills state-specific bits. **Naming** Turn-session APIs keep `source` for the structured inbound Source. That maps to conversation-store `sessionSource` only at the SQL boundary, because the store already has a separate coarse `source` enum. Deploy after #1268 is in prod. Leaves actor dual-written for a later slice. Refs #1267 --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
dcramer
added a commit
that referenced
this pull request
Aug 7, 2026
Finish the nested-contract cutover for turn sessions after #1268/#1286. Singular execution `actor` leaves the Redis turn-session projection and summary indexes; resume rebuilds it from durable sources. **Identity model (simplified)** - Set `actor` first (who runs) - Derive `credentialContext` with `credentialContextForActor(actor, subject?)` - They name the same principal except system runs with delegated `subject` (scheduled/event-task creator tokens) - resource-event identity owned by `resource-events/actor.ts` **Resume** 1. caller routingContext (dispatch / OAuth already bound) 2. resource-event markers → system actor 3. Slack author + destination team **Also** - live resource-event turns set `routing.actor` to the system principal - plugin `run.actor` = instruction provenance, else dispatch - reply / dispatch / local runner use the same actor→credential projection **Checks** - `tsc --noEmit` ✅ - continue-runner, agent-continue-slack, plugin-tasks ✅ - subscribed-message-behavior, agent-dispatch-work/recovery, slack-runtime ✅ Refs #1267 --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Resume paths treat SQL
junior_conversationsas the authority for destination and session source. They no longer prefer nested redis turn-session contracts with a SQL fallback.Single routing path
resolveTurnSessionRoutingalways loadsdestinationandsessionSourcefrom the conversation store. Automatic continuation, stranded recovery, and OAuth/MCP OAuth resume use that path for reply routing. Missing SQL fields fail closed; readers do not rebuild or fall back.Dispatch / channel-level sources
Scheduled and event-task dispatches omit
threadTs. Session source normalization now keeps those channel-level locators, and dispatch enqueue writes them into SQL so resume has a durable source.This is slice 1 of #1267. It does not stop writing nested contracts yet, change TTLs, or drop summary indexes.
Checks
tests/unit/services/turn-session-routing.test.tspassedtests/unit/runtime/source.test.tspassedRefs #1267