CedarCopilot wants to merge 2 commits into staging from worktree-jev-action-gate
Live on prod, watching, 1 day left
Libra has verdicts on 0 of 8 tracked behaviors on prod; 8 are still being checked. Libra checks hourly for 3 days after each deploy.
Adds a pre-check gate in front of on-event-email-orchestrator, calling TypeSafe AI's Jev model (a typed Choice/Score/Boolean judgment model, not a general LLM) to predict whether an email event needs any orchestrator action at all. When it confidently predicts no action, the orchestrator LLM call is skipped entirely , the same short-circuit mechanism the existing no-op-AOP check already uses.
on-event-email-orchestrator outcomes. Giving Jev the full conversation timeline + full rendered playbook section (what the orchestrator itself receives) was tested and measurably performed worse than this narrow, curated state , Jev's own docs recommend hand-picked state over a raw prompt dump, and that held up empirically here.evaluateJevActionGate catches every fetch/parse failure internally; the calling block in pre-execution-setup.ts additionally wraps its own DB work (resolvePlaybookContext, the event lookup) in an outer try/catch. Any failure anywhere falls through to normal orchestrator execution , it never fails the pre-execution-setup call outright.createStructuredLog under jev-action-gate.evaluated with run/conversation/event ids, so real skip and false-negative rates can be measured against production traffic rather than trusting the pilot sample.event.type === 'email' , the only population this has been validated against.buildEarlyExitResult helper, and derives the playbook's org id from the conversation owner rather than the executing user (the two can differ on a participant/collaborator execution).JEV_API_KEY wired through apps/server/src/env.ts, .env.example, and aws/lib/runtime-contract.ts's UNIFIED_SERVICE_RUNTIME_SECRET_FIELDS. Already added to the live /cedar/aws-staging/runtime and /cedar/aws-prod/runtime Secrets Manager entries (surgical merge, verified every other key unchanged) , but ECS tasks resolve secrets at container startup, so a deploy/restart is needed before either environment picks it up.Grounded in live Understudy trace data (7-day window) and a labeled n=50 sample of real on-event-email-orchestrator outcomes , not a projection.
23,856 weekly email executions (7d)
→ 14,598 (61.2%) never reach the orchestrator , existing no-op-AOP gate, already free
→ 9,206 (38.6%) reach it and the orchestrator actually runs
→ 4,483 (48.7% of reached, by RUN COUNT) conclude "no action needed"
→ but only 33.9% of reached-orchestrator COST, weighted by tool-call count ,
"no action" runs average 4.97 tool calls vs. 9.22 for real-work runs, so they're
cheaper per run and a flat 48.7% overstates their share of the $ spent
on-event-email-orchestrator costs $1,854.81/7d on Understudy. The gate's measured no-action recall, at the threshold (0.3) that showed zero missed real-work cases in the n=50 sample, is 92% (23 of 25 true no-action cases caught).
estimated savings = 92% recall × 33.9% cost-weighted no-action share × $1,854.81/7d
≈ $579/7d
≈ ~$2,480/month
Gate cost itself is negligible and already netted against that figure: ~$0.0008/call (2k-token state × Jev's $0.04/1M input, output free) × 9,206 calls/week ≈ $7.30/week ($31/month).
Caveats, stated plainly:
jev-action-gate.evaluated carriesLibra has not measured any production surfaces for this change yet.