Libra CodeHub

CedarCopilot/cedar-mail

Branch: staging

[2026-09-20] merging staging to main

merged#2853CedarCopilot

CedarCopilot wants to merge 2 commits into main from staging

Not deployedTimeline and evidence
  1. Opened
    Sep 20, 2026, 5:58 PM
  2. Sep 20, 2026, 6:16 PM
  3. Merged
    Sep 21, 2026, 12:05 AM
  4. Live on staging, live on prod, observed
    Pending
  5. Not deployed

    Not deployed

    Pending

Libra has no production signal for this change yet because it has not deployed. Libra checks hourly for 3 days after each deploy.

RetriggerConfidence Score: 2/5

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.

Findings

  1. P1 Gate table removal
  2. P1 Initialize reconnect settings
  3. P1 Reject stale deal links
  4. P2 Remove unsafe assertions
Fix with agent prompt
### 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.

Summary

  • Dropping the task-group conversation table can interrupt task creation for older server processes that still
Show production surfaces and changed-file mapping

Production surfaces

Libra has not measured any production surfaces for this change yet.

Changed files → surfaces

  • apps/mail/modules/userTasks/TASK_AXES_DESIGN.mdno production surface mapped
  • apps/mail/modules/userTasks/TASK_GROUPS_DESIGN.mdno production surface mapped
  • apps/mail/modules/userTasks/components/TaskGroupsPage.tsxno production surface mapped
  • apps/mail/tests/modules/userTasks/taskGroupsPage.test.tsxno production surface mapped
  • apps/server/docs/wiki/task-groups.mdno production surface mapped
  • apps/server/src/cli/task-groups.tsno production surface mapped
  • apps/server/src/db/aop-schema.tsno production surface mapped
  • apps/server/src/db/migrations/drop_task_group_conversations.sqlno production surface mapped
  • apps/server/src/db/migrations/scripts/split-post-meeting-task-group.tsno production surface mapped
  • apps/server/src/db/schema.tsno production surface mapped
  • apps/server/src/mastra/mcp/external/scope-map.tsno production surface mapped
  • apps/server/src/mastra/mcp/external/server.tsno production surface mapped
  • apps/server/src/mastra/operations/operation-registry.tsno production surface mapped
  • apps/server/src/mastra/routeHandlers/imessage/imessage-bot-chat.tsno production surface mapped
  • apps/server/src/mastra/routeHandlers/slack/slack-bot-chat.tsno production surface mapped
  • apps/server/src/mastra/routeHandlers/sms/sms-bot-chat.tsno production surface mapped
  • apps/server/src/mastra/tools/config/aop-write-tool.tsno production surface mapped
  • apps/server/src/mastra/tools/config/config-tool-shared.tsno production surface mapped
  • apps/server/src/mastra/tools/config/config-write-tool.tsno production surface mapped
  • apps/server/src/mastra/tools/event-execution/orchestrator-dispatch-tools.tsno production surface mapped
  • apps/server/src/mastra/tools/task/updateNextStepsAndTasksTool.tsno production surface mapped
  • apps/server/src/mastra/utils/__tests__/aop-selection-jev-branch.test.tsno production surface mapped
  • apps/server/src/mastra/utils/aop-selection.tsno production surface mapped
  • apps/server/src/mastra/utils/conversation-field-updates.tsno production surface mapped
  • apps/server/src/mastra/utils/execution/execute-analyzer.tsno production surface mapped
  • apps/server/src/mastra/utils/execution/execute-orchestrator.tsno production surface mapped
  • apps/server/src/mastra/utils/strategist-updates.tsno production surface mapped
  • apps/server/src/mastra/workflows/chat/chat-workflow.tsno production surface mapped
  • apps/server/src/mastra/workflows/event-execution/on-event-agent-execution-workflow.tsno production surface mapped
  • apps/server/src/scripts/task-groups-route-smoke.tsno production surface mapped
  • apps/server/src/services/aop/__tests__/create-aop.test.tsno production surface mapped
  • apps/server/src/services/aop/__tests__/jev-aop-selection.test.tsno production surface mapped
  • apps/server/src/services/aop/__tests__/update-selection-procedure.test.tsno production surface mapped
  • apps/server/src/services/aop/bound-object-resolution.tsno production surface mapped
  • apps/server/src/services/aop/create-aop.tsno production surface mapped
  • apps/server/src/services/aop/jev-aop-selection.tsno production surface mapped
  • apps/server/src/services/aop/update-selection-procedure.tsno production surface mapped
  • apps/server/src/services/aop/user-aops.tsno production surface mapped
  • apps/server/src/services/auth/__tests__/target-user-id-reaches-the-authority.test.tsno production surface mapped
  • apps/server/src/services/crm/stage-classification.tsno production surface mapped
  • apps/server/src/services/integrations/__tests__/provider-config.applyOrgCrmDefaults.test.tsno production surface mapped
  • apps/server/src/services/integrations/crm/attio.tsno production surface mapped
  • apps/server/src/services/integrations/crm/hubspot.tsno production surface mapped
  • apps/server/src/services/integrations/crm/salesforce.tsno production surface mapped
  • apps/server/src/services/integrations/provider-config.tsno production surface mapped
  • apps/server/src/services/integrations/superglue/superglue-client.tsno production surface mapped
  • apps/server/src/services/llm/models.tsno production surface mapped
  • apps/server/src/services/llm/resolve-model.tsno production surface mapped
  • apps/server/src/services/task-groups/routeTaskToGroup.tsno production surface mapped
  • apps/server/src/trpc/routes/integrations.tsno production surface mapped
  • apps/server/src/trpc/routes/task-groups.tsno production surface mapped
  • docs/design/crm-custom-object-linkage-leads.mdno production surface mapped