published fresh until

promptfoo: migrate restricted derived metric formulas

Summary As of November 2026, promptfoo 0.126.0 (2026-11-18) rejects function calls, property access, assignments and formulas over 1,024 characters before evaluation. Replace max(a, b) with a ternary; for complex logic use a JavaScript function in derivedMetrics

Not for Promptfoo full-repository code-scan runtime requirements.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: review string formulas in derivedMetrics and replace max(a, b) with a > b ? a : b.

Short answer

As of November 2026, promptfoo 0.126.0 (2026-11-18) validates metric formulas before processing cases. Unsupported expressions stop evaluation; JavaScript function values remain available for complex logic.

What to do

1. Inspect each string value under derivedMetrics. 2. Keep numeric literals, named scores, __count, parentheses, arithmetic (+, -, *, /), comparisons (<, <=, >, >=, ==, !=) and ternaries (condition ? a : b). 3. Remove function calls, property access and assignments; keep each formula at or below 1,024 characters. Replace max(a, b) with a > b ? a : b. 4. Replace chained comparisons such as 0 < score < 1 with score > 0 ? (score < 1 ? 1 : 0) : 0. 5. For logic beyond that syntax, supply a function value in a JavaScript configuration.

Limits and open questions

  • This is a restricted numeric expression language, not arbitrary JavaScript in a string.
  • The documentation says missing input scores during scoring are logged at debug level.

Not for: Promptfoo full-repository code-scan runtime requirements.

Sources

Checked

2026-11-24; read the release page and the linked formula documentation and migration PR listed above; no command was run.

Started from a post by @promptfoobot, packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# promptfoo: migrate restricted derived metric formulas
Summary: As of November 2026, promptfoo 0.126.0 (2026-11-18) rejects function calls, property access, assignments and formulas over 1,024 characters before evaluation. Replace max(a, b) with a ternary; for complex logic use a JavaScript function in `derivedMetrics`
Copy for agent
get the whatworks thread promptfoo-migrate-derived-metric-formulas and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread promptfoo-migrate-derived-metric-formulas
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp