fix(evaluations): stop live eval billing for ignored signals - #4224
fix(evaluations): stop live eval billing for ignored signals#4224cursor[bot] wants to merge 1 commit into
Conversation
The muted→ignored backfill migration stamped ignored_at without archiving linked evaluations, so backfilled signals kept running live evals. Add a follow-up migration to soft-delete those evaluations, and skip live eval execution when the linked signal is ignored (including in-flight jobs). Co-authored-by: Gerard <gerard@latitude.so>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📝 WalkthroughWalkthroughChangesIgnored signal evaluation handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/domain/evaluations/src/use-cases/live/run-live-evaluation.ts`:
- Around line 355-363: Move the signal lookup and the issue.ignoredAt guard
before the embedding-readiness wait in the live evaluation flow, preserving the
existing signal-ignored result. Ensure ignored evaluations return immediately
with action "skipped" even when embeddings are unavailable, and add coverage for
an ignored evaluation whose script requires embeddings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fda95a90-015b-4429-9a0d-6b7af34db557
📒 Files selected for processing (4)
packages/domain/evaluations/src/use-cases/live/run-live-evaluation.test.tspackages/domain/evaluations/src/use-cases/live/run-live-evaluation.tspackages/platform/db-postgres/drizzle/.migration-lockpackages/platform/db-postgres/drizzle/20260725081621_backfill-ignored-signal-eval-soft-delete/migration.sql
| if (issue.ignoredAt !== null) { | ||
| return { | ||
| action: "skipped", | ||
| reason: "signal-ignored", | ||
| evaluationId: input.evaluationId, | ||
| traceId: input.traceId, | ||
| } satisfies RunLiveEvaluationResult | ||
| } | ||
|
|
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Check ignoredAt before the embedding wait.
For an ignored evaluation whose script requires embeddings, this branch is not reached while embeddings are unavailable; the job is requeued and returns awaiting-embeddings instead. Move the signal lookup/guard before the readiness gate and add coverage for this path.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/domain/evaluations/src/use-cases/live/run-live-evaluation.ts` around
lines 355 - 363, Move the signal lookup and the issue.ignoredAt guard before the
embedding-readiness wait in the live evaluation flow, preserving the existing
signal-ignored result. Ensure ignored evaluations return immediately with action
"skipped" even when embeddings are unavailable, and add coverage for an ignored
evaluation whose script requires embeddings.
|
📄 Generated an HTML walkthrough of this PR's diff against Published artifact: https://artifact-pr-4224-diff-review.magnetic-toothpaste.workers.dev Claim within 60 minutes: https://dash.cloudflare.com/claim-preview?claimToken=e-MWG31ED71v2LsCed08AcTuwh9EvgV75aMzV49ZNvU Self-contained artifact, no external requests. Generated for review purposes only. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 629f6befe3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (issue.ignoredAt !== null) { | ||
| return { | ||
| action: "skipped", | ||
| reason: "signal-ignored", | ||
| evaluationId: input.evaluationId, | ||
| traceId: input.traceId, | ||
| } satisfies RunLiveEvaluationResult |
There was a problem hiding this comment.
Move ignored-state check before embedding readiness
When an ignored signal uses semanticSimilarity() and the triggering trace lacks a current-model embedding, the readiness gate returns before reaching this check. Each queued evaluation can therefore publish up to three delayed retries and report awaiting-embeddings/embeddings-unavailable instead of signal-ignored, continuing unnecessary queue and database work for roughly six minutes. Load the signal and apply this guard before the embedding-readiness gate.
Useful? React with 👍 / 👎.
| -- The muted→ignored backfill (20260720152609) stamped ignored_at but did not archive linked | ||
| -- evaluations the way applySignalLifecycleCommand("ignore") does via softDeleteBySignalId. |
There was a problem hiding this comment.
Remove the transient migration commentary
These two lines narrate the preceding backfill and the implementation path that motivated this migration rather than documenting a lasting SQL constraint. That context becomes stale as migrations accumulate, and the repository explicitly requires comments to be rare, one line, and not anchored to transient development history; remove it or replace it with a single-line invariant that the SQL itself cannot express.
AGENTS.md reference: AGENTS.md:L14-L14
Useful? React with 👍 / 👎.
What does this PR do?
Fixes ongoing live-eval billing for ignored signals after the #4132 lifecycle restore.
The muted→ignored backfill migration (
20260720152609) stampedignored_atbut did not archive linked evaluations the way a user-initiatedignoredoes viasoftDeleteBySignalId. Backfilled signals kept matching and billing live evals while appearing archived in the UI.This PR adds a follow-up migration to soft-delete evaluations for ignored signals, and skips live eval execution when the linked signal has
ignoredAtset (covers in-flight jobs enqueued before ignore).Related issue (if applicable)
Follow-up to #4132 (
specs/signal-resolve-ignore.md§6.5 backfill parity).How was this tested?
reason: "signal-ignored"and records no billing events when the linked signal is ignored.pnpm --filter @domain/evaluations test -- run-live-evaluation.test.ts(181 tests passed).Checklist
Summary by CodeRabbit
Bug Fixes
Tests