Skip to content

feat(worker): detect and call out model refusals (#30)#374

Draft
tuliren wants to merge 1 commit into
elmohq:mainfrom
tuliren:issue-30-refusal-detection
Draft

feat(worker): detect and call out model refusals (#30)#374
tuliren wants to merge 1 commit into
elmohq:mainfrom
tuliren:issue-30-refusal-detection

Conversation

@tuliren

@tuliren tuliren commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Detects when a model refuses to answer ("I can't help with that", "I must decline") and explicitly calls it out.

Changes

  • New packages/lib/src/refusal-detection.ts: detectRefusal() (opening-segment + short-response scan, curly-apostrophe tolerant).
  • Worker: refusals are logged, reported to telemetry as a prompt_refused event, and excluded from brand/competitor mention counting so they don't masquerade as visibility.

Testing

  • 8 unit tests in refusal-detection.test.ts; worker tsc --noEmit passes.

Note

This covers detection + exclusion + telemetry. Surfacing refusal rates in the dashboard UI (likely a schema column) would be a sensible follow-up.

Refs #30

🤖 Generated with Claude Code

Adds a tested refusal detector (packages/lib/refusal-detection) and wires it
into the worker: when a model declines to answer ("I can't help with that",
"I must decline"), the run is logged, reported to telemetry as a
prompt_refused event, and excluded from brand/competitor mention counting so
refusals don't masquerade as visibility. Surfacing refusal rates in the
dashboard UI is a follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

@tuliren is attempting to deploy a commit to the Blue Whale Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant