CedarCopilot wants to merge 2 commits into main from staging
Not deployed
Libra has no production signal for this change yet because it has not deployed. Libra checks hourly for 3 days after each deploy.
Not safe to merge: reproduced failures can prevent task creation, omit intended CRM defaults, and route conversations using stale CRM records; the repository type-safety requirement also remains unmet.
### Issue 1
apps/server/src/db/migrations/drop_task_group_conversations.sql:10
If an older server process shares the database during a rolling deployment, this migration removes a table that its task-creation route still reads. Requests handled by that process then fail with `relation "task_group_conversations" does not exist`, preventing task creation until the old process is drained. Deploy the reader removal before a later migration drops the table.
### Issue 2
apps/server/src/services/integrations/provider-config.ts:302-312
For an existing CRM connection whose metadata has no `settings` object, these nested `jsonb_set` calls update the row but do not create the missing intermediate object. Reconnecting therefore leaves both organization defaults unset, so the connection does not receive the intended periodic-sync and external-push settings. Create or merge the parent `settings` object before setting its keys.
### Issue 3
apps/server/src/mastra/utils/aop-selection.ts:280-290
This branch routes to the Deals AOP from the first supported CRM entry with a `dealId`, without checking whether that deal is active, open, or current. A closed, inactive deal preceding an active one therefore forces Deals with full confidence and skips normal classification, misrouting the conversation. Select the deal with the established active-deal policy, or defer to normal classification when no eligible deal exists.
### Issue 4
apps/server/src/mastra/utils/aop-selection.ts:285
The new provider check uses a type assertion to widen `CRM_PROVIDER_IDS`, and the accompanying test fixtures use `as unknown as HydratedConversation` to treat partial values as complete conversations. This violates the repository directive to narrow values with runtime checks or derive their types rather than silence TypeScript. The repository requirement must be satisfied before merging.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Libra has not measured any production surfaces for this change yet.