Libra CodeHub

CedarCopilot/cedar-mail

Branch: staging

merging staging to main

merged#2881CedarCopilot

CedarCopilot wants to merge 27 commits into main from staging

Not deployedTimeline and evidence
  1. Opened
    Sep 22, 2026, 10:41 AM
  2. Merged
    Sep 23, 2026, 3:17 AM
  3. Sep 23, 2026, 3:32 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: 3/5

Not safe to merge until the concurrent cleanup and cross-thread rewrite failures are fixed, and the repository type-safety requirement is satisfied.

Findings

  1. P1 Shared draft cleanup race
  2. P2 Unsafe test type escape
Fix with agent prompt
### Issue 1
apps/server/src/services/user-tasks/tasks.ts:803-815
Two independent deletions of tasks that reference the same draft can both see the other task as live at this check. Each then clears only its own pointer and returns; after both tasks become deleted, no task references the Gmail draft and neither request deleted it. Serialize ownership by user and draft across every deletion path, or make the liveness check, pointer transition, and final cleanup decision atomic.

### Issue 2
apps/server/src/mastra/tools/event-execution/__tests__/draft-email-post-meeting-rewrite-thread.test.ts:90
This test casts the tool to `any` before asserting its desired execute shape, hiding type incompatibilities instead of checking the actual interface. This violates the repository directive against TypeScript assertions that silence type errors; the same `as unknown as DB` escape appears in `shared-draft-cleanup.integration.test.ts:132`. The repository requirement must be satisfied before merging by exposing or inferring the needed types without these assertions.

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

This change improves draft validation, post-meeting rewrite handling, and shared-draft cleanup. Two reproduced failures still need correction: concurrent independent cleanup can orphan a shared Gmail draft, and an unrelated email-thread draft can be rewritten as though it belonged to the requested thread. The changed tests also contain prohibited type escapes that must be removed before merging.

Reviews (1) · Last reviewed commit: "Merge pull request #2877 from CedarCopil..."

Show production surfaces and changed-file mapping

Production surfaces

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

Changed files → surfaces

  • .claude/skills/deploy-watch/SKILL.mdno production surface mapped
  • .claude/skills/eli5/SKILL.mdno production surface mapped
  • .claude/skills/send-it/SKILL.mdno production surface mapped
  • .claude/skills/send-it/references/implementation.mdno production surface mapped
  • .claude/skills/send-it/references/monitoring.mdno production surface mapped
  • .claude/skills/send-it/references/review.mdno production surface mapped
  • .github/workflows/ci.ymlno production surface mapped
  • apps/mail/modules/cedar-os/__tests__/__mocks__/trpc.tsno production surface mapped
  • apps/mail/modules/cedar-os/src/cedar-os-components/chatComponents/EmbeddedCedarChat.tsxno production surface mapped
  • apps/mail/modules/cedar-os/src/components/renderers/messageRenderers.tsxno production surface mapped
  • apps/mail/modules/cedar-os/src/components/renderers/toolCallDetails.tsno production surface mapped
  • apps/mail/modules/cedar-os/src/store/agentConnection/responseProcessors/toolResultResponseProcessor.tsno production surface mapped
  • apps/mail/modules/cedar-os/src/store/messages/ambientOpen.tsno production surface mapped
  • apps/mail/modules/cedar-os/src/store/messages/messagesSlice.tsno production surface mapped
  • apps/mail/modules/company/components/CompanyExplorer.tsxno production surface mapped
  • apps/mail/modules/conversations/components/LeftSidebarContent.tsxno production surface mapped
  • apps/mail/modules/documents/board/BoardCardTile.tsxno production surface mapped
  • apps/mail/modules/documents/board/BoardDocumentView.tsxno production surface mapped
  • apps/mail/modules/documents/board/CardDocumentView.tsxno production surface mapped
  • apps/mail/modules/documents/board/CardFieldList.tsxno production surface mapped
  • apps/mail/modules/documents/board/CardFieldValue.tsxno production surface mapped
  • apps/mail/modules/documents/board/utils/invalidate-board-cards.tsno production surface mapped
  • apps/mail/modules/drafting/utils/save-draft-error.tsno production surface mapped
  • apps/mail/modules/home/components/FileArtifactPanel.tsxno production surface mapped
  • apps/mail/modules/sharing/__tests__/links.test.tsxno production surface mapped
  • apps/mail/modules/sharing/components/LinkSection.tsxno production surface mapped
  • apps/mail/modules/sharing/types.tsno production surface mapped
  • apps/mail/modules/ux/layout/LayoutUrlSync.tsxno production surface mapped
  • apps/mail/modules/ux/layout/enterChatThread.tsno production surface mapped
  • apps/mail/tests/modules/chat-store/chatHistoryPopover.test.tsxno production surface mapped
  • apps/mail/tests/modules/documents/board/CardFieldList.test.tsxno production surface mapped
  • apps/mail/tests/modules/drafting/saveDraftError.test.tsno production surface mapped
  • apps/mail/tests/modules/home/DisplayArtifactPanel.test.tsxno production surface mapped
  • apps/mail/tests/modules/home/fileArtifactPanelRows.test.tsxno production surface mapped
  • apps/mail/tests/modules/ux/layout/chatSwitchReleasesUrlArtifact.test.tsxno production surface mapped
  • apps/server/.claude/skills/field-query/SKILL.mdno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/.gitignoreno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/_aaron_discoverability_scoped.pyno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/_arie_fire_rate.pyno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/_diag_arie.pyno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/_diag_rippling.pyno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/dump-response-style.tsno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/dump-skills-catalog.tsno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/field_query_completion_test.pyno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/field_query_corpus_eval.pyno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/field_query_discoverability_eval.pyno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/field_query_fire_rate_eval.pyno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/search-field-values-bridge.tsno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/write-document-bash-competition-eval.tsno production surface mapped
  • apps/server/.claude/skills/playbook-instruction-eval/write-document-mode-eval.tsno production surface mapped
  • apps/server/.claude/skills/run-sql/SKILL.mdno production surface mapped
  • apps/server/docs/agent-tool-calls-retention.mdno production surface mapped
  • apps/server/docs/chat-messages-not-persisted.mdno production surface mapped
  • apps/server/docs/sharing.mdno production surface mapped
  • apps/server/docs/usage-reports/taxonomy-glm-ground-truth-eval.jsonno production surface mapped
  • apps/server/scripts/heal-select-list-option-drift.pyno production surface mapped
  • apps/server/scripts/jev-taxonomy-quality-gates-prototype.tsno production surface mapped
  • apps/server/scripts/run-jev-taxonomy-quality-gates-prototype.mjsno production surface mapped
  • apps/server/scripts/run-taxonomy-glm-ground-truth-eval.mjsno production surface mapped
  • apps/server/scripts/taxonomy-glm-ground-truth-eval.tsno production surface mapped
  • apps/server/src/cron/__tests__/process-taxonomy-extraction-queue.test.tsno production surface mapped
  • apps/server/src/cron/process-taxonomy-extraction-backfill.tsno production surface mapped
  • apps/server/src/cron/process-taxonomy-extraction-queue.tsno production surface mapped
  • apps/server/src/db/aop-schema.tsno production surface mapped
  • apps/server/src/db/schema.tsno production surface mapped
  • apps/server/src/lib/__tests__/conversation-filter-schema.test.tsno production surface mapped
  • apps/server/src/lib/conversation-filter-schema.tsno production surface mapped
  • apps/server/src/mastra/agents/chat-agent.tsno production surface mapped
  • apps/server/src/mastra/agents/sub-agents/orchestrator-agent.tsno production surface mapped
  • apps/server/src/mastra/routeHandlers/event-execution/handleExecuteMeeting.tsno production surface mapped
  • apps/server/src/mastra/skills/crm/field-query.tsno production surface mapped
  • apps/server/src/mastra/skills/index.tsno production surface mapped
  • apps/server/src/mastra/skills/types.tsno production surface mapped
  • apps/server/src/mastra/tools/agenda/__tests__/reviewConversationFanOut.test.tsno production surface mapped
  • apps/server/src/mastra/tools/config/__tests__/config-read-output-schema.test.tsno production surface mapped
  • apps/server/src/mastra/tools/config/__tests__/configTool.test.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/conversation/__tests__/findCRMConversationsTool.test.tsno production surface mapped
  • apps/server/src/mastra/tools/conversation/conversationReasoningActions.tsno production surface mapped
  • apps/server/src/mastra/tools/conversation/findCRMConversationsTool.tsno production surface mapped
  • apps/server/src/mastra/tools/document/__tests__/boardTool.test.tsno production surface mapped
  • apps/server/src/mastra/tools/document/boardTool.tsno production surface mapped
  • apps/server/src/mastra/tools/document/documentTool.schemas.tsno production surface mapped
  • apps/server/src/mastra/tools/document/documentTool.tsno production surface mapped
  • apps/server/src/mastra/tools/document/tableTool.tsno production surface mapped
  • apps/server/src/mastra/tools/document/writeDocumentTool.tsno production surface mapped
  • apps/server/src/mastra/tools/event-execution/__tests__/draft-email-post-meeting-rewrite-thread.test.tsno production surface mapped
  • apps/server/src/mastra/tools/event-execution/onEventExecutionDraftEmailTool.tsno production surface mapped
  • apps/server/src/mastra/tools/notify/notifyTool.tsno production surface mapped
  • apps/server/src/mastra/tools/notify/notifyUserTool.tsno production surface mapped
  • apps/server/src/mastra/tools/run-sql-query/__tests__/sql-guard.test.tsno production surface mapped
  • apps/server/src/mastra/tools/run-sql-query/sql-guard.tsno production surface mapped
  • apps/server/src/mastra/utils/__tests__/chat-turn-durability.test.tsno production surface mapped
  • apps/server/src/mastra/utils/__tests__/determine-thread-id.test.tsno production surface mapped
  • apps/server/src/mastra/utils/chat-message-persistence.tsno production surface mapped
  • apps/server/src/mastra/utils/context-items/attach-on-write.test.tsno production surface mapped
  • apps/server/src/mastra/utils/context-items/attach-on-write.tsno production surface mapped
  • apps/server/src/mastra/utils/threadMetadataUtils.tsno production surface mapped
  • apps/server/src/mastra/workflows/chat/chat-workflow.tsno production surface mapped
  • apps/server/src/mastra/workflows/sync/__tests__/update-external-crm-workflow.test.tsno production surface mapped
  • apps/server/src/mastra/workflows/sync/update-external-crm-workflow.tsno production surface mapped
  • apps/server/src/runtime/worker-entry.tsno production surface mapped
  • apps/server/src/services/access/requests.tsno production surface mapped
  • apps/server/src/services/agent-action-queue/types.tsno production surface mapped
  • apps/server/src/services/agent-workspace/__tests__/meeting-recorders.test.tsno production surface mapped
  • apps/server/src/services/agent-workspace/meeting-providers.tsno production surface mapped
  • apps/server/src/services/agents/share.tsno production surface mapped
  • apps/server/src/services/aop/__tests__/create-aop.test.tsno production surface mapped
  • apps/server/src/services/aop/__tests__/list-fields.test.tsno production surface mapped
  • apps/server/src/services/aop/create-aop.tsno production surface mapped
  • apps/server/src/services/aop/list-fields.tsno production surface mapped
  • apps/server/src/services/crm-sql/__tests__/execute.test.tsno production surface mapped
  • apps/server/src/services/crm-sql/__tests__/field-id-mismatches.test.tsno production surface mapped
  • apps/server/src/services/crm-sql/execute.tsno production surface mapped
  • apps/server/src/services/crm-sql/field-id-mismatches.tsno production surface mapped
  • apps/server/src/services/crm-sql/sql-guard.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/conversation-field-definitions.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/conversation-lookup.event-filter-conditions.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/conversation-lookup.filter-conditions.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/conversation-lookup.timestamptz-guard.integration.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/conversations.event-filter-conditions.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/conversations.json-persist.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/jev-canonicalization.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/jev-judgment-grounding.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/taxonomy-chunking.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/taxonomy-extraction-run.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/taxonomy-judgments.test.tsno production surface mapped
  • apps/server/src/services/crm/__tests__/taxonomy-model.test.tsno production surface mapped
  • apps/server/src/services/crm/conversation-field-definitions.tsno production surface mapped
  • apps/server/src/services/crm/conversation-lookup.tsno production surface mapped
  • apps/server/src/services/crm/conversations.tsno production surface mapped
  • apps/server/src/services/crm/deal-metrics.tsno production surface mapped
  • apps/server/src/services/crm/event-types.tsno production surface mapped
  • apps/server/src/services/crm/jev-canonicalization.tsno production surface mapped
  • apps/server/src/services/crm/jev-judgment-grounding.tsno production surface mapped
  • apps/server/src/services/crm/taxonomy-chunking.tsno production surface mapped
  • apps/server/src/services/crm/taxonomy-extraction-queue.tsno production surface mapped
  • apps/server/src/services/crm/taxonomy-extraction-step.tsno production surface mapped
  • apps/server/src/services/crm/taxonomy-extraction-stream.tsno production surface mapped
  • apps/server/src/services/crm/taxonomy-judgments.tsno production surface mapped
  • apps/server/src/services/crm/taxonomy-model.tsno production surface mapped
  • apps/server/src/services/documents/board/__tests__/board-view.test.tsno production surface mapped
  • apps/server/src/services/documents/board/board-ops.tsno production surface mapped
  • apps/server/src/services/documents/board/board-templates.tsno production surface mapped
  • apps/server/src/services/documents/board/board-types.tsno production surface mapped
  • apps/server/src/services/drafting/__tests__/check-existing-draft-thread-scoping.test.tsno production surface mapped
  • apps/server/src/services/drafting/__tests__/create-draft-cross-mailbox-recovery.test.tsno production surface mapped
  • apps/server/src/services/drafting/drafting.tsno production surface mapped
  • apps/server/src/services/drafting/thread-id-recovery.tsno production surface mapped
  • apps/server/src/services/field-values/__tests__/defaults-equivalence.test.tsno production surface mapped
  • apps/server/src/services/field-values/__tests__/instance-batching.test.tsno production surface mapped
  • apps/server/src/services/field-values/__tests__/jev-canonicalization-wiring.test.tsno production surface mapped
  • apps/server/src/services/field-values/crm-custom-field-values.tsno production surface mapped
  • apps/server/src/services/field-values/defaults/call-level.tsno production surface mapped
  • apps/server/src/services/field-values/defaults/qualification.tsno production surface mapped
  • apps/server/src/services/integrations/crm/__tests__/salesforce-multipicklist.test.tsno production surface mapped
  • apps/server/src/services/integrations/crm/__tests__/salesforce-partial-field-validation.test.tsno production surface mapped
  • apps/server/src/services/integrations/crm/driver.tsno production surface mapped
  • apps/server/src/services/integrations/crm/external-crm-field-mapping.tsno production surface mapped
  • apps/server/src/services/integrations/crm/salesforce.tsno production surface mapped
  • apps/server/src/services/llm/__tests__/resolve-model.test.tsno production surface mapped
  • apps/server/src/services/llm/understudy.tsno production surface mapped
  • apps/server/src/services/notifications/__tests__/primary-channel.test.tsno production surface mapped
  • apps/server/src/services/notifications/deliver-to-user.tsno production surface mapped
  • apps/server/src/services/notifications/primary-channel.tsno production surface mapped
  • apps/server/src/services/user-tasks/__tests__/cleanup-draft-pointer.test.tsno production surface mapped
  • apps/server/src/services/user-tasks/__tests__/shared-draft-cleanup.integration.test.tsno production surface mapped
  • apps/server/src/services/user-tasks/tasks.tsno production surface mapped
  • apps/server/src/trpc/routes/__tests__/crm-update-conversation-partial-failure.test.tsno production surface mapped
  • apps/server/src/trpc/routes/__tests__/crm-upsert-working-memory-partial-failure.test.tsno production surface mapped
  • apps/server/src/trpc/routes/agent.tsno production surface mapped
  • apps/server/src/trpc/routes/crm.tsno production surface mapped
  • apps/server/src/trpc/routes/org-admin.tsno production surface mapped
  • apps/server/src/workflows/step-registry/conversation-sync/__tests__/taxonomy-step.test.tsno production surface mapped
  • apps/server/src/workflows/step-registry/conversation-sync/taxonomy-step.tsno production surface mapped
  • aws/lib/runtime-contract.tsno production surface mapped
  • aws/lib/stacks/app-stack.tsno production surface mapped
  • aws/lib/stacks/data-stack.tsno production surface mapped
  • aws/lib/stacks/workflow-state-machines.tsno production surface mapped
  • docs/design/jev-taxonomy-quality-gates.mdno production surface mapped
  • docs/design/taxonomy-model-switching-eval.mdno production surface mapped