fix: render labeling queue payload with messages mode for LLM traces#1508
fix: render labeling queue payload with messages mode for LLM traces#1508IgnazioDS wants to merge 2 commits intolmnr-ai:mainfrom
Conversation
When traces from LLM spans are added to the labeling queue, the output
shows raw message array format ([{"role":"assistant","content":"..."}])
instead of the clean formatted view used in the evaluations trace viewer.
This change:
- Auto-detects if a queue item payload contains LLM message arrays
(objects with "role" and "content" fields)
- Defaults to "messages" rendering mode when detected, matching the
trace view behavior
- Adds MESSAGES to available modes so users can toggle between
formatted messages and raw JSON/YAML/TEXT views
Fixes lmnr-ai#639
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
Signed the CLA! Please recheck when ready. |
…m change
Bug 1: getPayloadDefaultMode detected messages inside payload.data/target
but ContentRenderer received the entire payload object. Renamed to
getPayloadRendering and now returns both the mode and the extracted value
so Messages component gets the correct data shape.
Bug 2: ContentRenderer only reads defaultMode in its useState initializer,
so navigating between queue items kept the stale mode. Added key={currentItem?.id}
to force remounting when the item changes.
Also memoized the payload rendering computation to avoid redundant calls.
Addresses cursor review feedback on lmnr-ai#1508
|
Addressed both issues from cursor review: Bug 1 (High) — Messages mode received entire payload instead of message array: Bug 2 (Medium) — Dynamic defaultMode ignored after initial render: Also memoized the rendering computation via |
|
@Rainhunter13 Hi! CLA is signed, and I've addressed both cursor review findings:
Ready for review when you have a moment! |

Summary
messagesrendering mode (same as the trace view)Problem
When an LLM trace is added to the labeling queue, the output renders as raw JSON:
[{"role":"assistant","content":"{\"score\":2}"}]But the same trace in the evaluations view renders cleanly via the Messages component, showing just the content under the role label.
Solution
Added a
looksLikeMessageArray()detector that checks if the payload (or itsdata/targetfields) contains arrays of objects withrole+contentfields. When detected, the ContentRenderer defaults to"messages"mode instead of"json".Users can still switch to raw JSON/YAML/TEXT via the mode dropdown — this aligns with the "show raw data" toggle approach mentioned in #639.
Test Plan
Fixes #639
Note
Low Risk
Low risk, frontend-only rendering changes limited to the labeling queue payload viewer; main risk is incorrect auto-detection causing an unexpected default view for some payload shapes.
Overview
Labeling queue payloads now auto-detect LLM chat message arrays (top-level or under
data/target) and defaultContentRenderertomessagesmode instead of alwaysjson.The payload viewer adds an explicit mode switcher (
MESSAGES/JSON/YAML/TEXT), passes the extracted payload value to render, and forces a remount on item change viakey={currentItem?.id}to avoid stale renderer state.Written by Cursor Bugbot for commit 4cc0059. This will update automatically on new commits. Configure here.