Libra CodeHub

CedarCopilot/cedar-mail

Branch: staging

feat(coaching): seed wires triggers into named people's personal playbooks

merged#2935CedarCopilot

CedarCopilot wants to merge 1 commit into staging from feat/coaching-seed-personal-wiring

Customer behavior verdict

Libra exercised 3 changed behaviors; none regressed.

Who this touches

  • Trigger matching remains scoped to the exact coaching document identity: Libra cannot measure who uses this yet; it has not mapped this to a production entry point yet; it will trace it through the import graph on a coming run.
  • Named reps receive meeting coaching and the leader owns the weekly rollup: Libra cannot measure who uses this yet; it has not mapped this to a production entry point yet; it will trace it through the import graph on a coming run.
  • Coaching triggers are removed from the organization playbook: Libra cannot measure who uses this yet; it has not mapped this to a production entry point yet; it will trace it through the import graph on a coming run.
  • Repeated wiring does not duplicate personal triggers: Libra cannot measure who uses this yet; it has not mapped this to a production entry point yet; it will trace it through the import graph on a coming run.
  • Named reps receive meeting coaching and the leader owns the weekly rollup: Held on this PR; the scenario fails when this is broken on purpose.
  • Coaching triggers are removed from the organization playbook: Held on this PR; the scenario fails when this is broken on purpose.
  • Repeated wiring does not duplicate personal triggers: Held on this PR; the scenario fails when this is broken on purpose.

What Libra verified

  • Coaching triggers are removed from the organization playbook

    Libra ran this behavior against the change and confirmed the check detects when it breaks.

    Technical evidence
    • the organization playbook loses meeting and cron blocks for the coaching agent while an unrelated trigger block remains unchanged

    Changed code: seed-coaching-org.ts.

  • Named reps receive meeting coaching and the leader owns the weekly rollup

    Libra ran this behavior against the change and confirmed the check detects when it breaks.

    Technical evidence
    • each named rep’s personal playbook receives a bare meeting reference without a weekly cron
    • the named leader’s personal playbook receives one scheduled cron reference carrying the leader instruction and configured schedule and timezone

    Changed code: seed-coaching-org.ts.

  • Repeated wiring does not duplicate personal triggers

    Libra ran this behavior against the change and confirmed the check detects when it breaks.

    Technical evidence
    • applying personal wiring again leaves the already wired playbook XML unchanged
    • applying personal wiring again reports no newly added meeting or cron trigger

    Changed code: personal-wiring.test.ts.

Live on prod, watching, 2 days leftTimeline and evidence
  1. Opened
    Sep 24, 2026, 3:12 PM
  2. Sep 24, 2026, 3:23 PM
  3. Merged
    Sep 24, 2026, 8:15 PM
  4. Live on prod
    Sep 24, 2026, 8:15 PM
  5. Observed 3 hours
    Sep 24, 2026, 8:15 PM
  6. Watching

    Live on prod, watching, 2 days left

    Sep 24, 2026, 8:15 PM
  7. Pipelines steady after this deploy
    Sep 24, 2026, 8:15 PM

Behaviors Libra is checking

The named leader and every named manager receive a manager-role grant on the seeded coaching agent folder so they can access the coached reps' material.Not checked
prod
Each explicitly named rep receives a coaching meeting trigger in that rep's linked personal playbook, while unnamed users do not inherit the coaching scorer.Not checked
prod
Each person who is assigned a coaching trigger must resolve to a user in the target organization with a personal AOP linked to the supplied org AOP, otherwise the seed aborts instead of wiring an unknown or incorrect playbook.Not checked
prod
The seed run removes this coaching agent's meeting and cron triggers and any explicitly retired coaching references from the org playbook, leaving unrelated triggers intact so calls are not scored twice.Not checked
prod
Every personal playbook write is accepted only when guarded compilation returns a trigger manifest containing each meeting or cron trigger that was requested.Not checked
prod
Rerunning the seed does not duplicate already-wired personal trigger blocks or manager grants.Not checked
prod

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

Summary

  • seed-coaching-org.ts now wires coaching into named people's personal playbooks, not the org playbook: --reps get the meeting trigger, --leader gets the weekly cron too, and --leader plus --managers get a manager grant on the agent. Any coaching trigger already in the org playbook is removed in the same run.
  • Why: an org-playbook meeting trigger fires for everyone who inherits it (Aspire's CEO and CTO calls included, which forced a hand rewire), and an org-playbook cron fires once as whichever linked person has the healthiest connection, so the rollup's location was not predictable. Both customers are now on this shape.
  • The edit is pure string functions in services/coaching/personal-wiring.ts, tested without a database. Personal playbooks are written first and the org strip last, so a call is never left unscored.

Test plan

  • New personal-wiring.test.ts (7 cases: rep gets a bare meeting ref and no cron, leader cron carries the leader instruction, idempotent, another agent on the same trigger type is not mistaken for this one, missing <global> throws, removal leaves unrelated triggers). It caught a real regex bug (a bare <ref/> could swallow into a later </ref>); fixed.
  • Server typecheck clean for both touched files.
  • Ran the script against production Pirros with --execute: config rewritten identically, all three playbooks reported "already wired", Peter's manager grant "already held". Dry run against Aspire lists the expected five reps, Sahand as the cron leader and Arie and ak as managers.

Verify in prod

  • The script prints, per person, the compiled manifest (armed: meeting, email | 0 7 * * 2 …). A run that cannot arm what it added throws.
  • Next Tuesday's cron (Sep 29, 07:00 PT): the rollup runs as Peter (Pirros) and Sahand (Aspire) only. In Axiom ['cedar-prod'] | where message == "[agent] getTeamMembers" should show via of org_admin or agent_manager for the leaders.

Not in this PR

  • A rep-level weekly cron that writes each rep's own overview (reps still have only a log).
  • Changing the leader instruction so the weekly archive copies the full previous overview.

Customer: Aspire, Pirros

🤖 Generated with Claude Code

RetriggerConfidence Score: 0/5

The PR is not safe to merge until the rollout can grant a fresh leader access, handle unseeded personal playbooks, and reliably reconcile existing triggers.

Findings

  1. P1 Fresh leader grant can fail ▶
  2. P1 Missing personal playbook aborts rollout ▶
  3. P1 Former people retain triggers ▶
  4. P1 Cron changes are ignored ▶
  5. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v
Show production surfaces and changed-file mapping

Production surfaces

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

Changed files → surfaces

  • apps/server/src/scripts/seed-coaching-org.tsno production surface mapped
  • apps/server/src/services/coaching/__tests__/personal-wiring.test.tsno production surface mapped
  • apps/server/src/services/coaching/personal-wiring.tsno production surface mapped