fix(core): accept content object shorthands in eval validator#916
Closed
fix(core): accept content object shorthands in eval validator#916
Conversation
The eval validator's validateMessages() rejected input array items that
have a 'type' field (e.g., {type: "file", value: "..."}) but no 'role'
field, producing spurious errors about invalid role 'undefined'. The
runtime (shorthand-expansion.ts) silently filters these via
isTestMessage(), so the validator was stricter than actual execution.
Add an early-continue for content object shorthands (items with 'type'
but no 'role') so the validator accepts what the runtime accepts.
Closes #915
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Deploying agentv with
|
| Latest commit: |
da92fb8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f8d8b532.agentv.pages.dev |
| Branch Preview URL: | https://fix-validator-accept-content.agentv.pages.dev |
Collaborator
Author
|
Closing — the validator behavior is correct. The failing eval file had a bare content object ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validateMessages()in eval-validator to accept content object shorthands (items withtypebut norole) that the runtime already handles viashorthand-expansion.ts{type: "file", value: "..."}objects would produce spurious validation errors about invalid roleundefinedChanges
In
packages/core/src/evaluation/validation/eval-validator.ts, added an early-continue check invalidateMessages()after theisObjectguard: if a message has atypefield but norolefield, it is treated as a content object shorthand and skipped, since the runtime wraps these implicitly.Test plan
bun testin packages/core)🤖 Generated with Claude Code