Libra CodeHub

CedarCopilot/cedar-mail

Branch: staging

perf(crm): a conversation row's own event projection, plus the cal sidebar and coaching-agent levels

merged#2669CedarCopilot

CedarCopilot wants to merge 4 commits into staging from fix/dm-container-kind

Live on prod, no production signal yetTimeline and evidence
  1. Opened
    Sep 2, 2026, 11:16 PM
  2. Sep 3, 2026, 10:56 AM
  3. Merged
    Sep 3, 2026, 12:29 PM
  4. Live on prod
    Sep 3, 2026, 12:29 PM
  5. Observed 2 days
    Sep 3, 2026, 12:29 PM
  6. Pipelines steady after this deploy
    Sep 3, 2026, 12:29 PM
  7. Unobserved

    Live on prod, no production signal yet

    Sep 5, 2026, 9:44 PM

Behaviors Libra is checking

Conversation table, kanban, canvas, and row activity fields use server-computed whole-history timestamps for last meeting and inbound or outbound email activity instead of scanning the capped recent-events window.Inconclusivelow confidence

Verification reached its 130s outer budget before the verifier returned. Libra is keeping this intent verifying until the next check.

prod, checked Sep 5, 2026, 5:43 PM
An in-flight detail query is canceled before an optimistic conversation edit is written so a pre-edit response cannot overwrite the patched detail cache.Inconclusivelow confidence

Verification reached its budget before a verdict.

prod, checked Sep 5, 2026, 5:44 PM
Changing status, priority, or AOP invalidates conversation list queries so server-side filters, AOP grouping, and list-page membership are recalculated after the edit.Inconclusivelow confidence

Verification reached its budget before a verdict.

prod, checked Sep 5, 2026, 6:42 PM
Clicking an activity dot stores only its event ID, opens an accessible loading dialog immediately, and fetches the full conversation event details on demand using the shared conversation query cache.Inconclusivelow confidence

Verification reached its 120s wall-clock budget before a tied verdict. Libra is keeping this intent verifying until the next check.

prod, checked Sep 5, 2026, 6:44 PM
Conversation list, canvas, grouped, and sidebar rows use a lightweight event-overview projection containing the scalars needed for activity dots instead of full event bodies and type-specific joins.Inconclusivelow confidence

Unable to verify the intended behavior: no matching post-deploy `listConversations` spans were found, and the source read needed to map the production telemetry name was unavailable due to the source-read budget. Per the evidence contract, this is inconclusive rather than.

prod, checked Sep 5, 2026, 7:42 PM
Single and bulk conversation edits keep the edited fields visible across store, list, grouped, and sidebar surfaces while stale pre-edit payloads are ingested, and failed edits release the protection so refetches restore server truth.Inconclusivelow confidence

Verification reached its budget before a verdict.

prod, checked Sep 5, 2026, 7:43 PM

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

Summary

Three independent changes that accumulated on this branch.

perf(crm): conversation rows get their own event projection. Rows in the sidebar, canvas and kanban were reading the same wide event shape the timeline needs, so every list render paid for detail nobody was showing. The row path now projects only what a row draws, and the optimistic field-write layer (pending-conversation-field-writes.ts) keeps in-flight edits visible against that narrower shape instead of being dropped on the next refetch. Covered by four new test files , projection, classification, AOP-change consistency, and the pending-write buffer.

fix: cal sidebar UI. Sizing and layout corrections in the timeline overview, event detail dialog and empty-state suggestions.

fix(coaching): seed the agent document under the right playbook. seed-coaching-agent.ts always wrote its agent document to organisation/playbooks/… and always read it back from there, so a coaching agent one person owns but the team reads had no way to be filed under that person's playbook. Adds --level user|org (default org , existing behaviour unchanged), which picks the root for the write and both read-backs.

The read-backs also gained an owner predicate. A user/ playbook row carries its author's id and an organisation/ one carries none, so matching on (orgId, path) alone could return a teammate's playbook at the same path and wire the weekly trigger into the wrong person's file. This is deliberately independent of the agent's own namespace: key , a document in one person's playbook can still write into a team folder, which is exactly the shape a shared coaching agent wants.

Test plan

  • pnpm run autofix:local , green after merging origin/staging: 3,950 mail tests (410 suites) and 10,821 server tests (894 files), zero failures.
  • Merged origin/staging (through 29f286260, including the admin-config permissions revamp) with no conflicts, then re-ran the full gate.

One note on flakiness

An earlier pre-merge run failed src/services/integrations/credentials/__tests__/token-refresh.test.ts → "coalesces N concurrent resolves of one entry into a single grant" (expected 1 grant, got 2). It passes in isolation (16/16) and passed on the post-merge full run. The test holds a real 20ms setTimeout open and expects all five concurrent callers to register inside that window; under a fully-loaded 886-file run the event loop can stall long enough that the first grant settles and clears the in-flight map before the last caller arrives. That is a wall-clock assumption in the test, not a defect in the coalescing logic, and it is untouched by this PR , flagging it rather than rewriting an unrelated test here.

šŸ¤– Generated with Claude Code

Greptile Summary

The PR introduces a narrow CRM row-event projection and optimistic field-write masking, adjusts calendar-related UI layout, and adds user- versus organization-level placement to the coaching-agent seed script.

  • Adds overview event shapes and row-to-detail event loading across CRM list surfaces.
  • Protects optimistic conversation field updates and full detail timelines during list ingestion.
  • Updates timeline/dialog/empty-state presentation and event classification.
  • Adds scoped coaching-agent seeding and owner-aware document lookups.

Confidence Score: 3/5

The PR should not merge until list refetches retain fresh overview events and seeded trigger changes are compiled into the playbook manifest.

The current ingestion guard discards fresh row events whenever any nonempty event array already exists, while the seed script persists trigger XML through a path that leaves scheduler-visible manifest metadata unchanged.

Files Needing Attention: apps/mail/modules/conversations/slice/conversationsSlice.ts; apps/server/src/scripts/seed-coaching-agent.ts

Important Files Changed

| Filename |

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/docs/client-data-architecture.mdno production surface mapped
  • apps/mail/modules/agentCanvas/components/EventCard.tsxno production surface mapped
  • apps/mail/modules/cedar-os/src/cedar-os-components/chatComponents/EmptyStateSuggestions.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/ConversationActivityOverview.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/EventDetailDialog.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/ScheduledTasksSection.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/TimelineTaskItem.tsxno production surface mapped
  • apps/mail/modules/conversations/components/timeline/helpers.tsxno production surface mapped
  • apps/mail/modules/conversations/slice/conversationsSlice.tsno production surface mapped
  • apps/mail/modules/conversationsPage/hooks/use-conversations-sidebar-conversations.tsno production surface mapped
  • apps/mail/modules/crm/components/ConversationCellComponents/FutureActionDisplay.tsxno production surface mapped
  • apps/mail/modules/crm/components/VirtualizedTableRow.tsxno production surface mapped
  • apps/mail/modules/crm/components/conversation-canvas/ConversationItem.tsxno production surface mapped
  • apps/mail/modules/crm/components/kanban-canvas/CanvasKanbanCard.tsxno production surface mapped
  • apps/mail/modules/crm/hooks/use-canvas-conversations.tsno production surface mapped
  • apps/mail/modules/crm/hooks/use-crm-conversations.tsno production surface mapped
  • apps/mail/modules/crm/hooks/use-grouped-conversations.tsno production surface mapped
  • apps/mail/modules/crm/hooks/use-optimistic-conversation-actions.tsno production surface mapped
  • apps/mail/modules/crm/lib/pending-conversation-field-writes.tsno production surface mapped
  • apps/mail/modules/crm/store/crmSlice.tsno production surface mapped
  • apps/mail/modules/crm/types/index.tsno production surface mapped
  • apps/mail/tests/modules/conversations/timelineEventClassification.test.tsno production surface mapped
  • apps/mail/tests/modules/crm/aopChangeConsistency.test.tsxno production surface mapped
  • apps/mail/tests/modules/crm/overviewEventProjection.test.tsno production surface mapped
  • apps/mail/tests/modules/crm/pendingConversationFieldWrites.test.tsno production surface mapped
  • apps/server/src/scripts/seed-coaching-agent.tsno production surface mapped
  • apps/server/src/services/crm/conversations.tsno production surface mapped
  • apps/server/src/trpc/routes/crm.tsno production surface mapped