CedarCopilot wants to merge 1 commit into staging from fix/cancel-deal-advancing-tasks-on-close
Not deployed
Libra has no production signal for this change yet because it has not deployed. Libra checks hourly for 3 days after each deploy.
A closed-won or closed-lost deal keeps carrying the tasks that existed to move it forward , the chase for a reply, the recap owed from a meeting, the response to a thread.
572 open tasks sit on closed deals today, across 52 accounts:
| overdue | future-scheduled | |
|---|---|---|
| follow-up | 163 | 34 |
| manual | 112 | 10 |
| response | 35 | 0 |
| post-meeting | 34 | 0 |
| reactivation | 25 | 138 |
| field-approval | 8 | 0 |
| calendar | 3 | 0 |
| total | 388 | 184 |
The 138 future-dated reactivations are deliberate work. The 388 overdue ones are residue.
Nothing cancels them: there is no stage-change handler anywhere in the codebase, and the one instruction that mentions the case tells the agenda agent the opposite , a terminal stage "is not a reason to cancel". That rule is right for deliberate reactivations and wrong for everything else, and it is stated without the distinction.
assembleNextStepsPrompt, not the seeded next-steps body:
Cancelled, never done. The work stopped being necessary; it did not happen. Recording it as
done says the rep did something they did not do, and inflates the completion metric the task
system is judged on.
Never cancelled, whatever the due date: reactivation, re-engagement, win-back, renewal, upsell, expansion, onboarding and customer-success work. Those are the path forward on a closed deal, not residue.
Defers to the user. The block says outright that a user's own next-steps instructions override it , a default, not a policy.
tsc -b on @zero/server , cleanvitest run over mastra/tools/task and mastra/routeHandlers , 246 passed, 2 skippednext-steps-prompt.test.ts covering the cancel instruction, the done
prohibition, every protected category by name, and the user-override clauseThe 388 already-stranded tasks. This stops the accrual; a backfill is separate, and I'd rather run it after watching this behave.
🤖 Generated with Claude Code
The PR adds an always-present next-steps prompt rule that cancels obsolete deal-advancing tasks when a deal closes while preserving reactivation and post-close work.
The conflicting seeded and terminal-stage instructions should be reconciled before merging so closed-lost deals reliably shed obsolete advancing tasks.
The assembled prompt can simultaneously tell the agent that closed-lost is not grounds for closing a task and that differing next-steps instructions override the new cleanup rule, undermining the feature for accounts using the seeded instructions.
Files Needing Attention: apps/server/src/mastra/tools/task/next-steps-prompt.ts
| Filename | Overview |
|---|---|
| apps/server/src/mastra/tools/task/next-steps-prompt.ts | Adds the terminal-stage cleanup rule, but its override clause leaves a conflicting seeded instruction able to suppress cleanup. |
| apps/server/src/mastra/tools/task/tests/next-steps-prompt.test.ts | Verifies the new text is present, but does not cover the assembled conflict with the existing seeded closure guidance. |
Libra has not measured any production surfaces for this change yet.