Skip to content

ref(chat): store complete Conversation Location - #1720

Draft
dcramer wants to merge 1 commit into
mainfrom
codex/1563-complete-slack-location
Draft

ref(chat): store complete Conversation Location#1720
dcramer wants to merge 1 commit into
mainfrom
codex/1563-complete-slack-location

Conversation

@dcramer

@dcramer dcramer commented Aug 27, 2026

Copy link
Copy Markdown
Member

Conversation records now store one complete optional Location in location_json. Location keeps a provider-neutral base with id and provider; Slack extends that base with teamId, channelId, and optional threadTs. Source and Delivery now receive the exact Slack Location instead of the earlier generic tenant and provider id fields.

The migration backfills current Slack Conversations from their linked destination and saved session Source. A marked read fallback covers rows written during deployment until old writers are gone and a post-deploy backfill runs. Junior-only and local Conversations continue to have no Location, and Location still does not grant Delivery.

Refs #1563

@vercel

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

Request Review

@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 3 potential issues.

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 0c3c052. Configure here.

}): Location | undefined {
if (args.location) {
return locationSchema.parse(args.location);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stored Location can drop threadTs

High Severity

conversationLocationForWrite returns a provided location immediately, so a first recordExecution write that has Slack destination but no sessionSource persists Location without threadTs. Later recordActivity reuses that stored value, and locationFromRow trusts location_json over session threadTs, so the thread is never filled in.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0c3c052. Configure here.

/** Complete Location types supported by Junior. */
export const locationSchema = z.discriminatedUnion("provider", [
slackLocationSchema,
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Old invocation sources fail to parse

High Severity

locationSchema is now a strict Slack union (teamId, channelId, optional threadTs). Agent invocations persist run.source, which already stored the previous {tenantId, providerId} Location. invocationFromRow parses that JSON with the new schema, and migration 0037 does not rewrite junior_agent_invocations.source_json.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0c3c052. Configure here.

slackSource.channelId !== row.providerDestinationId)
) {
throw new Error("Conversation Location does not match its session Source");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Location fallback throws on mismatch

Medium Severity

The deploy-window fallback throws when Slack sessionSource team or channel does not match the linked destination. Migration 0037 keeps Location and only omits threadTs in that case. Feed and store reads call this helper, so one unmatched row can fail the whole conversation list.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0c3c052. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant