ref(chat): store complete Conversation Location - #1720
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Reviewed by Cursor Bugbot for commit 0c3c052. Configure here.
| }): Location | undefined { | ||
| if (args.location) { | ||
| return locationSchema.parse(args.location); | ||
| } |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit 0c3c052. Configure here.
| /** Complete Location types supported by Junior. */ | ||
| export const locationSchema = z.discriminatedUnion("provider", [ | ||
| slackLocationSchema, | ||
| ]); |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 0c3c052. Configure here.
| slackSource.channelId !== row.providerDestinationId) | ||
| ) { | ||
| throw new Error("Conversation Location does not match its session Source"); | ||
| } |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit 0c3c052. Configure here.


Conversation records now store one complete optional Location in
location_json. Location keeps a provider-neutral base withidandprovider; Slack extends that base withteamId,channelId, and optionalthreadTs. 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