Libra CodeHub

CedarCopilot/cedar-mail

Branch: staging

feat(tasks): org-admin read-only view of a teammate's tasks/agenda

open#2826CedarCopilot

CedarCopilot wants to merge 4 commits into staging from feat/org-admin-task-view

Not deployedTimeline and evidence
  1. Opened
    Sep 19, 2026, 9:02 AM
  2. Sep 20, 2026, 6:13 PM
  3. Merged, live on staging, live on prod, observed
    Pending
  4. 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.

Summary

  • Feature-flagged (cedar-task-admin-view PostHog flag, off by default) picker letting org owners/admins view a teammate's tasks , List, Kanban, and Agenda , reusing the real row/card/column components with every write path removed, rather than a parallel interactive surface.
  • userTasks.listUserTasks and taskGroups.listGroups accept targetUserId, authorized through the existing task:user (SELF_OR_ORG_ADMIN) policy in services/auth/authorize.ts , no policy table changes needed.
  • Agenda required the most care: editor.setEditable(false) alone doesn't stop a keymap-bound transaction from syncing to the teammate's live Y.Doc, so every mutating handler and keyboard shortcut in AgendaTaskNode/DateHeadingNode (8 + 2 handlers) now also checks editor.isEditable directly, and the drag extensions aren't mounted at all while administering.
  • Both read-only views wire useScopeHonoured/ScopeNotHonouredNotice , the existing runtime check (already used by /brain/playbooks) that catches a route silently answering with the caller's own rows instead of the teammate's.

Test plan

  • pnpm --filter @zero/mail run types , clean (only pre-existing unrelated errors in conversationTool.ts)
  • pnpm --filter @zero/server run types , clean (same pre-existing errors)
  • pnpm --filter @zero/mail exec jest tests/modules/administeredUser/contract-coverage.test.ts , 3/3 passing
  • pnpm deps:check , 0 violations
  • Manually traced every addKeyboardShortcuts() handler in AgendaTaskNode.tsx/DateHeadingNode.tsx for the editor.isEditable guard
  • Manual click-through in a running dev app (not done in this session , no browser access)
  • Create the cedar-task-admin-view PostHog flag in prod and roll out to a pilot admin before wider release

🤖 Generated with Claude Code

RetriggerConfidence Score: 3/5

The PR is not safe to merge until the read-only agenda stops exposing self-scoped mutations and the administered task views preserve tasks when group metadata is unavailable.

Findings

  1. P1 Footer Mutates Wrong Agenda
  2. P1 Group Loading Hides Tasks
  3. P2 Assertions Bypass Inferred Types
Fix with agent prompt
### Issue 1
apps/mail/modules/agentCanvas/components/AgendaDocument.tsx:1601-1603
When an administrator views a teammate's current agenda, this footer remains interactive even though the surface is read-only. Its count query and `agenda.refill`/`agenda.rerun` mutations do not carry `targetUserId`, and both server mutations operate on `ctx.sessionUser.id`. The footer therefore combines the teammate's displayed agenda with the administrator's task count, and clicking “Pull in more” or “Re-execute” unexpectedly modifies the administrator's own agenda. Hide or fully scope these controls while administering another us
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/administeredUser/contract.tsno production surface mapped
  • apps/mail/modules/agentCanvas/components/AgendaDocument.tsxno production surface mapped
  • apps/mail/modules/agentCanvas/components/DateHeadingNode.tsxno production surface mapped
  • apps/mail/modules/agentCanvas/extensions/AgendaTaskNode.tsxno production surface mapped
  • apps/mail/modules/userTasks/components/AdministeredTaskKanban.tsxno production surface mapped
  • apps/mail/modules/userTasks/components/AdministeredTaskList.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/hooks/use-administered-tasks.tsno production surface mapped
  • apps/mail/modules/userTasks/hooks/use-task-admin-view-flag.tsno production surface mapped
  • apps/mail/modules/userTasks/utils/group-tasks-by-task-group.tsno production surface mapped
  • apps/mail/modules/userTasks/utils/task-due-bucket.tsno production surface mapped
  • apps/mail/tests/modules/agentCanvas/agenda-editor.test.tsno production surface mapped
  • apps/mail/tests/modules/agentCanvas/helpers/agendaTaskHarness.tsxno production surface mapped
  • apps/server/src/services/posthog/posthog.tsno production surface mapped
  • apps/server/src/trpc/routes/__tests__/user-tasks-conversation-scope.test.tsno production surface mapped
  • apps/server/src/trpc/routes/task-groups.tsno production surface mapped
  • apps/server/src/trpc/routes/user-tasks.tsno production surface mapped