Skip to content

fix(core): accept content object shorthands in eval validator#916

Closed
christso wants to merge 1 commit intomainfrom
fix/validator-accept-content-shorthand
Closed

fix(core): accept content object shorthands in eval validator#916
christso wants to merge 1 commit intomainfrom
fix/validator-accept-content-shorthand

Conversation

@christso
Copy link
Copy Markdown
Collaborator

@christso christso commented Apr 2, 2026

Summary

Changes

In packages/core/src/evaluation/validation/eval-validator.ts, added an early-continue check in validateMessages() after the isObject guard: if a message has a type field but no role field, it is treated as a content object shorthand and skipped, since the runtime wraps these implicitly.

Test plan

  • All 1318 existing tests pass (bun test in packages/core)
  • Pre-push hooks pass (Build, Typecheck, Lint, Test, Validate eval YAML files)
  • Verify that eval files with content object shorthands in input arrays no longer produce validation errors

🤖 Generated with Claude Code

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>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: da92fb8
Status: ✅  Deploy successful!
Preview URL: https://f8d8b532.agentv.pages.dev
Branch Preview URL: https://fix-validator-accept-content.agentv.pages.dev

View logs

@christso
Copy link
Copy Markdown
Collaborator Author

christso commented Apr 2, 2026

Closing — the validator behavior is correct. The failing eval file had a bare content object ({type: file, value: ...}) without role/content wrapping. The PR author fixed it in cd442a1. No validator change needed.

@christso christso closed this Apr 2, 2026
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.

Validator rejects valid eval input when role is missing (short-form input)

1 participant