fix(agent): judge fails an assertion when one repeated value contradicts it

Merged
OK
2mo ago
+121-5

An external review of e2e found agent.assert passing a wrong checkout total because another summary on the same page showed the right one. The judge had no rule for a value shown twice.

  • New rule in JUDGMENT_REQUEST (packages/e2e/src/agent/prompts.ts): a value or state shown in more than one place holds only when every place agrees. One contradicting place is fails.
  • An instruction that names the place (the order summary total is $42.00) is judged on that place alone.
  • Scoped to one value shown twice. A claim about some item (a todo is marked done) still holds when one item matches.
  • Applies to waitFor too, since it uses the same judge.
  • Testbed /checkout page with a planted bug: after a quantity change the summary total updates, the "Pay" button keeps the old amount.
  • Four judgment tests in apps/testbed/tests-agent/judgments.e2e.ts: the conflicting total must fail, plus three controls that must still hold (the named summary total beside the stale pay button, a correct line total, and "a todo is marked done" with one of two done).

Verified

Ran it locally: yes

  • testbed agent suite, pnpm --filter @e2e-dev/testbed test:agent --grep ... --repeat-each N through the AI Gateway

The judge must reject "the order total is $42.00" when the summary shows $42.00 and the pay button shows $18.00:

modelmainthis branch
openai/gpt-6-luna-fast0/4 caught6/6 caught
anthropic/claude-sonnet-5-50/4 caught6/6 caught
  • Whole judgments.e2e.ts (all controls included) with --repeat-each 5: 45/45 on each model.
  • Without the named-place line, the order summary total is $42.00 failed 12/12 across both models; with it, it holds every time.
  • Full testbed agent suite on the default model: 26/26.