Skip to content

Conversation

@RogerHYang
Copy link
Contributor

@RogerHYang RogerHYang commented Feb 9, 2026

Before

Screenshot 2026-02-09 at 10 26 16 AM

After

Screenshot 2026-02-09 at 10 22 18 AM

Note

Low Risk
Localized change to message-shaping logic plus added test coverage; main risk is minor downstream expectations changing because arguments may now be dicts instead of JSON strings.

Overview
Improves dataset_helpers._get_message to JSON-decode function_call.arguments and tool_calls[].function.arguments when they are stored as JSON strings, while leaving invalid JSON as the original string and omitting empty tool call lists.

Adds typed message/tool/function structures (TypedDict) and expands unit tests to cover deserialization behavior and updates expected dataset input snapshots accordingly.

Written by Cursor Bugbot for commit 477080e. This will update automatically on new commits. Configure here.

@RogerHYang RogerHYang requested a review from a team as a code owner February 9, 2026 16:59
@github-project-automation github-project-automation bot moved this to 📘 Todo in phoenix Feb 9, 2026
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 9, 2026
@RogerHYang RogerHYang changed the title feat(dataset_helpers): deserialize JSON in message function/tool call arguments feat(dataset_helpers): deserialize JSON in message function/tool call arguments for experiment run outputs Feb 9, 2026
@RogerHYang RogerHYang changed the title feat(dataset_helpers): deserialize JSON in message function/tool call arguments for experiment run outputs fix: deserialize JSON in message function/tool call arguments for experiment run outputs Feb 9, 2026
@axiomofjoy axiomofjoy requested a review from a team as a code owner February 10, 2026 20:09
@RogerHYang RogerHYang force-pushed the feat/dataset-helpers-deserialize-message-arguments branch from c89c9af to cd34463 Compare February 11, 2026 16:55
@github-project-automation github-project-automation bot moved this from 📘 Todo to 👍 Approved in phoenix Feb 11, 2026
@RogerHYang RogerHYang force-pushed the feat/dataset-helpers-deserialize-message-arguments branch from cd34463 to d4d0340 Compare February 12, 2026 03:23
@RogerHYang RogerHYang requested review from a team as code owners February 12, 2026 03:23
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. size:L This PR changes 100-499 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. size:XL This PR changes 500-999 lines, ignoring generated files. labels Feb 12, 2026
const prefix = evaluatorName + ".";
if (annotationName.startsWith(prefix)) {
const configName = annotationName.slice(prefix.length);
matchedConfig = outputConfigs.find((c) => c.name === configName);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preview optimization matching fails with spaced names

Low Severity

computePositiveOptimization matches multi-output annotations using evaluatorName from store state, but preview annotation names are generated from trimmed payload.name. If the evaluator name has leading/trailing spaces, the prefix check fails and positiveOptimization is omitted in ExperimentAnnotationButton.

Additional Locations (1)

Fix in Cursor Fix in Web

@RogerHYang RogerHYang changed the base branch from version-13 to main February 12, 2026 03:30
@RogerHYang RogerHYang force-pushed the feat/dataset-helpers-deserialize-message-arguments branch from 346b3f8 to 5e89eaf Compare February 12, 2026 03:31
… arguments

- Add _deserialize_json_if_possible() and use it in _get_message() for
  MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON and TOOL_CALL_FUNCTION_ARGUMENTS_JSON
  so stored JSON strings are parsed to dicts; invalid JSON is left as string.
- Add tests for _get_message() using unflatten (role, content, name,
  function_call with valid/invalid JSON, tool_calls with valid/invalid JSON,
  empty/None tool_calls).
- Update test_get_dataset_example_input expected messages to use deserialized
  arguments.
@RogerHYang RogerHYang force-pushed the feat/dataset-helpers-deserialize-message-arguments branch from 5e89eaf to 477080e Compare February 12, 2026 04:01
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

if function_arguments is None:
function_arguments = arguments
function = _Function(name=function_name, arguments=function_arguments)
tool_calls.append(_ToolCall(function=function))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tool calls dropped without function names

Medium Severity

The new tool_calls loop only appends entries when TOOL_CALL_FUNCTION_NAME is truthy. Tool calls that have TOOL_CALL_FUNCTION_ARGUMENTS_JSON but no name are now discarded, causing loss of captured tool-call data in dataset_helpers.py.

Fix in Cursor Fix in Web

tool_calls.append(_ToolCall(function=function))
role = get_attribute_value(message, MESSAGE_ROLE) or "assistant"
content = get_attribute_value(message, MESSAGE_CONTENT)
msg = _Message(role=role)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing role now mislabeled as assistant

Medium Severity

_get_message now defaults role to "assistant" when MESSAGE_ROLE is absent. This changes previously missing/unknown roles into concrete assistant messages, which can misrepresent conversation data produced by dataset_helpers.py.

Fix in Cursor Fix in Web

function_call_arguments = _safely_json_decode(arguments)
if function_call_arguments is None:
function_call_arguments = arguments
function_call = _Function(name=function_call_name, arguments=function_call_arguments)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON null arguments stay as strings

Low Severity

_get_message treats a decoded None as a parse failure and falls back to the original string. Because _safely_json_decode("null") returns None, valid JSON null in MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON or TOOL_CALL_FUNCTION_ARGUMENTS_JSON is emitted as "null" instead of None.

Additional Locations (1)

Fix in Cursor Fix in Web

@RogerHYang RogerHYang merged commit 9af321f into main Feb 12, 2026
53 of 54 checks passed
@RogerHYang RogerHYang deleted the feat/dataset-helpers-deserialize-message-arguments branch February 12, 2026 05:03
@github-project-automation github-project-automation bot moved this from 👍 Approved to ✅ Done in phoenix Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants