Skip to content

Handle manual form submissions in evals-cli#305

Open
swissspidy wants to merge 4 commits into
mainfrom
fix/form-submit
Open

Handle manual form submissions in evals-cli#305
swissspidy wants to merge 4 commits into
mainfrom
fix/form-submit

Conversation

@swissspidy

@swissspidy swissspidy commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #66

When WebMCP forms do not use the toolautosubmit attribute, the browser activates the form and fires a toolactivated DOM event rather than automatically submitting. In a headless evals-cli session, this previously caused the browser evaluation to hang indefinitely.

This PR addresses the issue by handling toolactivated events gracefully, adding tool execution result verification to evals, and reflecting result comparisons in both the console and HTML reports.

Changes

  1. Graceful toolactivated Handling in BrowserToolRegistry:

    • Listens for the toolactivated DOM event when executing browser tools.
    • If no auto-submission occurs within a 1-second timeout after toolactivated fires, resolves the tool execution with "pending form submission".
    • Cleans up unused listToolsFromPage function.
  2. Tool Execution Result Matching (result in expectedCall):

    • Added an optional result?: unknown; field to FunctionCall and ToolCall types.
    • Updated VercelBackend to capture the tool execution return value on each executed ToolCall.
    • Updated functionCallOutcome in utils.ts to evaluate expected.result against actual.result using matchesArgument (supports exact match, objects, regex $pattern, $contains, etc.).
  3. Report and Console Enhancements:

    • Added a "Result" comparison row to the HTML report's Step Details table.
    • Added a "Details" column to the console summary table to clearly display failure reasons (such as result mismatches).
  4. Example Evals for French Bistro Demo:

    • Updated evals.json to assert "result": "pending form submission" when testing manual form submission behavior.
    • Added evals-toolautosubmit.json to assert "result": { "$contains": "welcoming you" } when testing auto-submission behavior.

Examples

Expecting manual form submission:

manual-submission-success

Expected auto form submission:

toolautosubmit-success

Expecting manual form submission on a form with toolautosubmit results in an error:

expected-manual-submission-but-got-autosubmit

Expecting auto form submission ohn a form without toolautosubmit results in an error:

Screenshot 2026-07-20 at 15 36 24

@swissspidy
swissspidy requested a review from Kulikowski July 20, 2026 13:37
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.

[Feature Request] Handle manual form submission in evals-cli

1 participant