Libra CodeHub

CedarCopilot/cedar-mail

Branch: staging

fix(security,calendar,task-board): close the 2FA enrollment bypass, and a batch of board, calendar and document fixes

merged#2621CedarCopilot

CedarCopilot wants to merge 2 commits into staging from fix/skip-agent-runs-for-warmup-traffic

Live on prod, no production signal yetTimeline and evidence
  1. Opened
    Aug 29, 2026, 4:38 PM
  2. Aug 29, 2026, 5:00 PM
  3. Merged
    Aug 29, 2026, 5:51 PM
  4. Live on staging
    Aug 29, 2026, 5:51 PM
  5. Live on prod
    Aug 29, 2026, 5:51 PM
  6. Observed 12 hours
    Aug 29, 2026, 5:51 PM
  7. Pipelines steady after this deploy
    Aug 29, 2026, 5:51 PM
  8. Pipelines steady after this deploy
    Aug 29, 2026, 5:51 PM
  9. Unobserved

    Live on prod, no production signal yet

    Aug 30, 2026, 6:20 AM

Behaviors Libra is checking

Users whose sessions have not cleared the required second factor are held on a standalone /two-factor screen instead of reaching protected Cedar routes, and are sent to /mail only after successful verification.Inconclusivehigh confidence

Post-deploy production telemetry contains 0 matching spans or CloudWatch log lines for GET /two-factor, GET /mail, TWO_FACTOR_REQUIRED, two-factor/verify-totp, or two-factor/verify-backup-code. The only related API telemetry was 2 GET /api/auth/get-session spans (200, 0.

prod, checked Aug 29, 2026, 10:20 PM
A user required to use two-factor authentication but not yet enrolled is automatically guided through enrollment with a manually copyable authenticator setup secret, recovery codes, and six-digit TOTP confirmation.Inconclusivelow confidence

Verification reached its budget before a verdict.

prod, checked Aug 29, 2026, 10:21 PM
An enrolled user can clear the forced challenge with either an authenticator TOTP or a one-time recovery code, with rejected codes leaving the session blocked.Inconclusivemedium confidence

Since 2026-08-30T00:51:52Z, OTEL and CloudWatch showed no telemetry for verifyTotp, verifyBackupCode, two-factor verification, or equivalent verification routes. The only related auth evidence was 2 successful GET /api/auth/get-session spans from 1 user; no successful.

prod, checked Aug 29, 2026, 11:20 PM
Security settings expose working immediate two-factor enrollment, recovery-code regeneration, and disable controls, while the server refuses disabling the factor for users required to use it.Inconclusivelow confidence

Verification reached its budget before a verdict.

prod, checked Aug 29, 2026, 11:20 PM
Opening the calendar global canvas keeps the chat column and its event editor available while the calendar occupies only the context column, without changing the full-shell behavior of other canvases.Inconclusivehigh confidence

Since 2026-08-30T00:51:52Z in prod, telemetry shows 59 successful process_calendar_event_sync_only spans (2 users; p95 91.8 ms), 3 successful calendar.events.list.incremental spans (1 user; p95 888.2 ms), and one successful canvas.getCanvases request chain (1 user; server p95.

prod, checked Aug 30, 2026, 12:20 AM
The context menu for browser-only calendar previews and proposed slots offers Discard draft and clears local draft state without issuing a remote delete request.Inconclusivemedium confidence

Since 2026-08-30T00:51:52Z in prod, telemetry shows 59 process_calendar_event_sync_only spans (2 users, p95 91.8 ms) and 3 calendar.events.list.incremental spans / 3 successful GET /calendar/v3/calendars/primary/events requests (1 user, p95 888.2 ms). There are 0 calendar.

prod, checked Aug 30, 2026, 12:21 AM

Failures attributed to this change

No prod customers are affected while this is only in staging. If promoted, prod impact is unknown because Libra still needs a concrete exception, route, and failed user action before assigning severity. 0 hits · no retained affected-user count · no retained trace sample.Introducedmedium confidence

internal_only

staging, first seen Aug 29, 2026, 6:18 PM

Libra has verdicts on 0 of 17 tracked behaviors on prod; 17 are still being checked. Libra checks hourly for 3 days after each deploy.

Summary

This branch has accumulated twelve commits since staging. The load-bearing one is the security fix; the rest are feature work and reported-bug fixes across the board, calendar, composer and documents.

Security , the 2FA gate had a bypass. /api/auth/two-factor/ was allowlisted as a prefix, so an unverified session could reach two endpoints that defeat the gate outright:

  • enable deletes the account's two_factor row, mints a fresh secret and returns its totpURI , a stolen cookie could enrol a factor the attacker controls, verify it, and walk in, with the real user's factor destroyed.
  • disable flips two_factor_enabled off, which is exactly the flag requiresTwoFactor keys on for a self-enrolled user.

Neither is gated by a password=[redacted] is on because Cedar has no passwords, so better-auth's shouldRequirePassword relaxes for every Cedar user, and disable's sensitiveSessionMiddleware asks only for a valid session, not a fresh one.

The gate now classifies a path into allow / allow-if-not-enrolled / block, deny-by-default. Enrollment is the only conditional rung, and it stays open for the one case the gate exists to serve , an allowlisted user being walked into setup for the first time. That check reads two_factor_enabled from the user row, not from session.user: the 30-day cookie cache can answer getSession() with a stale false, which would reopen enable to an unverified session. Unknown users read as enrolled, so it fails closed.

Task board. The sort_order seed was guarded row-wise on sort_order = 0, which looks idempotent and is not , 0 is a value the placement function legitimately produces (a user's first unpinned task, and next - 1 whenever the top card sits at 1). Re-running the migration would have re-stamped exactly those rows by due date and undone wherever they had been placed. The guard is now per user on bool_and(sort_order = 0) AND bool_and(NOT sort_order_pinned). The list view also now sorts through the shared compareTasks, so manual stops silently falling through to due-asc, and the three optimistic task literals carry the two new columns.

Slack backfill. A container-id retry resolved the id and then threw it away, writing a row with container_id = NULL , unreachable by every reader and un-deduplicable, because the unique index it conflicts on is partial (WHERE container_id IS NOT NULL). The retry now keeps what it resolves.

Plus: calendar event composition on its own block with free/busy, Zoom meeting creation, pipeline and inbox filters that survive a refresh, recipient-badge drag from where the badge actually sits, in-document call playback seeked to the moment under discussion, and coaching-row and Drive-folder fixes.

TASK_REORDERING_HANDOFF.md is added alongside the design doc , it records what is live in the database, and one open defect worth reading before phase 3: placement is not concurrency-safe (29 collision groups / 26 due-date inversions measured on staging), currently masked in the browser only by a stable sort landing back on due-date order.

Test plan

  • pnpm run autofix:local , green. Mail Jest: 299 suites, 2826 tests. Server Vitest: 734 files, 7873 tests.
  • Re-run after merging origin/staging (67 files, clean merge) , still green, including the eight test files the merge brought in.
  • New unit coverage for the gate: classifyPathForUnverifiedSession is asserted to allow the two verify endpoints, return allow-if-not-enrolled for enable only, and block for disable, generate-backup-codes, get-totp-uri, tRPC data reads and /api/auth/token.
  • The sort-order migration was applied to staging and re-run to confirm the new guard makes it a no-op.

🤖 Generated with Claude Code

Greptile Summary

This PR hardens the two-factor challenge boundary and delivers broad fixes across calendar composition, task orde

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/app/(auth)/two-factor/page.tsxno production surface mapped
  • apps/mail/app/(auth)/two-factor/two-factor-client.tsxno production surface mapped
  • apps/mail/app/(routes)/settings/security/page.tsxno production surface mapped
  • apps/mail/app/globals.cssno production surface mapped
  • apps/mail/app/routes.tsno production surface mapped
  • apps/mail/components/layout/AppShell.tsxno production surface mapped
  • apps/mail/components/mail/NextEventWidget.tsxno production surface mapped
  • apps/mail/components/markdown-editor.tsxno production surface mapped
  • apps/mail/components/read-only-markdown-view.tsxno production surface mapped
  • apps/mail/components/ui/recipient-autosuggest.tsxno production surface mapped
  • apps/mail/components/ui/tabs.tsxno production surface mapped
  • apps/mail/config/shortcuts.tsno production surface mapped
  • apps/mail/modules/auth/components/two-factor-setup.tsxno production surface mapped
  • apps/mail/modules/auth/hooks/use-two-factor.tsno production surface mapped
  • apps/mail/modules/auth/utils/auth-client.tsno production surface mapped
  • apps/mail/modules/calendar/components/CalendarEventContextMenu.tsxno production surface mapped
  • apps/mail/modules/calendar/components/CalendarSidebar.tsxno production surface mapped
  • apps/mail/modules/calendar/components/CalendarView.tsxno production surface mapped
  • apps/mail/modules/calendar/components/DayColumn.tsxno production surface mapped
  • apps/mail/modules/calendar/components/DraggableCalendarEvent.tsxno production surface mapped
  • apps/mail/modules/calendar/components/EventComposerForm.tsxno production surface mapped
  • apps/mail/modules/calendar/components/EventComposerPopover.tsxno production surface mapped
  • apps/mail/modules/calendar/components/EventDetailsPopover.tsxno production surface mapped
  • apps/mail/modules/calendar/hooks/use-attendee-availability.tsno production surface mapped
  • apps/mail/modules/calendar/hooks/use-event-manipulation.tsno production surface mapped
  • apps/mail/modules/calendar/types/calendar-types.tsno production surface mapped
  • apps/mail/modules/calendar/utils/conferencing.tsno production surface mapped
  • apps/mail/modules/canvas/components/CanvasHeader.tsxno production surface mapped
  • apps/mail/modules/canvas/slice/canvasSlice.tsno production surface mapped
  • apps/mail/modules/cedar-os/src/store/agentConnection/responseProcessors/clientExecutionResponseProcessors.tsno production surface mapped
  • apps/mail/modules/cedar-os/src/store/messages/renderers/ProposedCalendarEventRenderer.tsxno production surface mapped
  • apps/mail/modules/conversations/components/ConversationTabs.tsxno production surface mapped
  • apps/mail/modules/conversations/components/LeftSidebarContent.tsxno production surface mapped
  • apps/mail/modules/conversations/components/files/DriveSection.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/InboxChannelToolbar.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/InboxTab.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/InboxThreadList.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/MeetingDetailContent.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/MeetingEventExpanded.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/TaskCreatorDialogue.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/inboxRowFilter.tsno production surface mapped
  • apps/mail/modules/conversations/components/timeline/useMeetingRecordingUrl.tsno production surface mapped
  • apps/mail/modules/conversations/hooks/use-conversation-back.tsno production surface mapped
  • apps/mail/modules/conversations/utils/findOpenEmptyChat.tsno production surface mapped
  • apps/mail/modules/crm/components/ConversationCellComponents/InlineTaskCreation.tsxno production surface mapped
  • apps/mail/modules/crm/components/ConversationView.tsxno production surface mapped
  • apps/mail/modules/crm/components/crm-kanban.tsxno production surface mapped
  • apps/mail/modules/crm/hooks/use-canvas-conversations.tsno production surface mapped
  • apps/mail/modules/crm/hooks/use-optimistic-conversation-actions.tsno production surface mapped
  • apps/mail/modules/crm/utils/compute-canvas-filters.tsno production surface mapped
  • apps/mail/modules/documents/coaching/MomentFenceNode.tsxno production surface mapped
  • apps/mail/modules/documents/coaching/moment-fence.tsno production surface mapped
  • apps/mail/modules/documents/recording/MeetingRecordingPlayer.tsxno production surface mapped
  • apps/mail/modules/documents/recording/RecordingFenceNode.tsxno production surface mapped
  • apps/mail/modules/documents/recording/recording-fence.tsno production surface mapped
  • apps/mail/modules/documents/recording/timestamps.tsno production surface mapped
  • apps/mail/modules/documents/recording/useRecordingPlayback.tsno production surface mapped
  • apps/mail/modules/drafting/components/__tests__/email-composer-send.test.tsxno production surface mapped
  • apps/mail/modules/drafting/components/__tests__/recipient-drag-registration.test.tsxno production surface mapped
  • apps/mail/modules/drafting/components/email-composer.tsxno production surface mapped
  • apps/mail/modules/store/index.tsno production surface mapped
  • apps/mail/modules/threads/threadList/hooks/use-mail-navigation.tsno production surface mapped
  • apps/mail/modules/userSettings/components/two-factor-settings.tsxno production surface mapped
  • apps/mail/modules/userTasks/TASK_REORDERING_DESIGN.mdno production surface mapped
  • apps/mail/modules/userTasks/TASK_REORDERING_HANDOFF.mdno production surface mapped
  • apps/mail/modules/userTasks/components/TaskCommandBar.tsxno production surface mapped
  • apps/mail/modules/userTasks/components/TaskKanbanBoard.tsxno production surface mapped
  • apps/mail/modules/userTasks/components/TaskListView.tsxno production surface mapped
  • apps/mail/modules/userTasks/components/TasksToolbar.tsxno production surface mapped
  • apps/mail/modules/userTasks/hooks/use-create-task-optimistic.tsno production surface mapped
  • apps/mail/modules/userTasks/hooks/use-task-list-view-options.tsno production surface mapped
  • apps/mail/modules/userTasks/slice/userTasksSlice.tsno production surface mapped
  • apps/mail/modules/userTasks/utils/task-order.tsno production surface mapped
  • apps/mail/tests/modules/calendar/attendee-availability.test.tsno production surface mapped
  • apps/mail/tests/modules/calendar/client-only-events.test.tsno production surface mapped
  • apps/mail/tests/modules/calendar/conferencing.test.tsno production surface mapped
  • apps/mail/tests/modules/calendar/eventComposerPopoverDismiss.test.tsxno production surface mapped
  • apps/mail/tests/modules/conversations/conversationBackFromFile.test.tsxno production surface mapped
  • apps/mail/tests/modules/conversations/conversationTabKeyNav.test.tsxno production surface mapped
  • apps/mail/tests/modules/conversations/filesTabDrive.test.tsxno production surface mapped
  • apps/mail/tests/modules/conversations/filesTabHarness.tsxno production surface mapped
  • apps/mail/tests/modules/conversations/findOpenEmptyChat.test.tsno production surface mapped
  • apps/mail/tests/modules/conversations/inboxRowFilter.test.tsno production surface mapped
  • apps/mail/tests/modules/crm/utils/compute-canvas-filters.test.tsno production surface mapped
  • apps/mail/tests/modules/documents/recording-fence-render.test.tsno production surface mapped
  • apps/mail/tests/modules/documents/recording-fence.test.tsno production surface mapped
  • apps/mail/tests/modules/documents/recording-timestamps.test.tsno production surface mapped
  • apps/mail/tests/modules/documents/taskListRowLayout.test.tsno production surface mapped
  • apps/mail/tests/modules/layout/calendarCanvasKeepsChat.test.tsxno production surface mapped
  • apps/mail/tests/modules/thread/mail-navigation-escape.test.tsxno production surface mapped
  • apps/mail/tests/modules/userTasks/taskOrder.test.tsno production surface mapped
  • apps/server/docs/inline-meeting-video-in-documents.mdno production surface mapped
  • apps/server/docs/meeting-provider-capabilities.mdno production surface mapped
  • apps/server/scripts/meeting-recording-probe.tsno production surface mapped
  • apps/server/src/container/__tests__/derive-other-stage-bucket.test.tsno production surface mapped
  • apps/server/src/container/__tests__/derive-other-stage-meetings-bucket.test.tsno production surface mapped
  • apps/server/src/container/aws-runtime-bindings.tsno production surface mapped
  • apps/server/src/db/__tests__/user-tasks-sort-order.test.tsno production surface mapped
  • apps/server/src/db/aop-schema.tsno production surface mapped
  • apps/server/src/db/migrations/two_factor_auth.sqlno production surface mapped
  • apps/server/src/db/migrations/user_tasks_sort_order.sqlno production surface mapped
  • apps/server/src/db/schema.tsno production surface mapped
  • apps/server/src/env.tsno production surface mapped
  • apps/server/src/http/app.tsno production surface mapped
  • apps/server/src/lib/auth.tsno production surface mapped
  • apps/server/src/lib/schemas.tsno production surface mapped
  • apps/server/src/lib/two-factor/README.mdno production surface mapped
  • apps/server/src/lib/two-factor/__tests__/policy.test.tsno production surface mapped
  • apps/server/src/lib/two-factor/policy.tsno production surface mapped
  • apps/server/src/lib/two-factor/session-verification.tsno production surface mapped
  • apps/server/src/mastra/tools/calendar/calendarTool.tsno production surface mapped
  • apps/server/src/mastra/tools/calendar/modifyCalendarEventTool.tsno production surface mapped
  • apps/server/src/mastra/workflows/chat/__tests__/apply-overrides.test.tsno production surface mapped
  • apps/server/src/mastra/workflows/chat/apply-overrides.tsno production surface mapped
  • apps/server/src/mastra/workflows/chat/run-chat-agent-sdk.tsno production surface mapped
  • apps/server/src/pipelines.tsno production surface mapped
  • apps/server/src/scripts/__tests__/backfill-slack-messages.rerun.test.tsno production surface mapped
  • apps/server/src/scripts/backfill-slack-messages.tsno production surface mapped
  • apps/server/src/scripts/publish-coaching-playbook.tsno production surface mapped
  • apps/server/src/services/calendar/__tests__/create-calendar-event-from-proposal.test.tsno production surface mapped
  • apps/server/src/services/calendar/create-calendar-event-from-proposal.tsno production surface mapped
  • apps/server/src/services/coaching/__tests__/seed-content.test.tsno production surface mapped
  • apps/server/src/services/coaching/seed-content.tsno production surface mapped
  • apps/server/src/services/drafting/__tests__/draft-inbox-visibility.test.tsno production surface mapped
  • apps/server/src/services/drafting/draft-inbox-visibility.tsno production surface mapped
  • apps/server/src/services/integrations/meetings/__tests__/fathom-transcript-timestamp.test.tsno production surface mapped
  • apps/server/src/services/integrations/meetings/circleback-search.tsno production surface mapped
  • apps/server/src/services/integrations/meetings/circleback.tsno production surface mapped
  • apps/server/src/services/integrations/meetings/fathom.tsno production surface mapped
  • apps/server/src/services/integrations/meetings/gong-recording.tsno production surface mapped
  • apps/server/src/services/integrations/meetings/gong.tsno production surface mapped
  • apps/server/src/services/integrations/meetings/recording-url.tsno production surface mapped
  • apps/server/src/services/integrations/meetings/types.tsno production surface mapped
  • apps/server/src/services/notifications/__tests__/login-notifier-device.test.tsno production surface mapped
  • apps/server/src/services/notifications/login-notifier.tsno production surface mapped
  • apps/server/src/services/user-tasks/sort-order.tsno production surface mapped
  • apps/server/src/services/users/user-setting-specs.tsno production surface mapped
  • apps/server/src/trpc/index.tsno production surface mapped
  • apps/server/src/trpc/routes/__tests__/calendar-conference-types.test.tsno production surface mapped
  • apps/server/src/trpc/routes/calendar.tsno production surface mapped
  • apps/server/src/trpc/routes/chat.tsno production surface mapped
  • apps/server/src/trpc/routes/crm.tsno production surface mapped
  • apps/server/src/trpc/routes/drafts.tsno production surface mapped
  • apps/server/src/trpc/routes/drive.tsno production surface mapped
  • apps/server/src/trpc/routes/mail.tsno production surface mapped
  • apps/server/src/trpc/routes/two-factor.tsno production surface mapped