Skip to content

fix(feedback): send Langfuse score once per feedback action - #925

Merged
miurla merged 1 commit into
mainfrom
claude/relaxed-gates-8322bb
Aug 2, 2026
Merged

fix(feedback): send Langfuse score once per feedback action#925
miurla merged 1 commit into
mainfrom
claude/relaxed-gates-8322bb

Conversation

@miurla

@miurla miurla commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Message feedback (thumbs up/down) recorded two scores on the same Langfuse trace per action: the feedback API route sent user_feedback, then updateMessageFeedback sent user-feedback to the same traceId.

This PR unifies score submission in one place:

  • The API route (app/api/feedback/route.ts) remains the single owner of Langfuse score submission, using the name user_feedback. It keeps the client-supplied comment and works for requests without messageId.
  • updateMessageFeedback (lib/actions/feedback.ts) no longer creates a Langfuse score and is now a pure database update. Unused LangfuseClient and isTracingEnabled imports removed.

Tests

  • lib/actions/__tests__/feedback.test.ts: replaced the "sends to Langfuse when tracing enabled" test with a regression test asserting the action never calls Langfuse.
  • app/api/feedback/__tests__/route.test.ts: added an assertion that score.create is called exactly once.

Checks

  • bun lint
  • bun typecheck
  • bun format:check
  • bun run build
  • bun run test (283 passed, 1 skipped)

The feedback API route and updateMessageFeedback both sent a score
to the same trace, with inconsistent names (user_feedback and
user-feedback). Remove the duplicate submission from the server
action so the route owns score submission with the single name
user_feedback. The action is now a pure database update.
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
morphic Ready Ready Preview Aug 2, 2026 3:05am

Request Review

@miurla
miurla merged commit 2b2fafd into main Aug 2, 2026
7 checks passed
@miurla
miurla deleted the claude/relaxed-gates-8322bb branch August 2, 2026 03:07
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