Files
windmill/ai_evals/cases
Ruben FiszelandClaude Opus 4.8 248c8751b1 feat(ai-chat): let the session/global chat create email triggers (#10282)
* feat(ai-chat): let AI create email triggers for flows and scripts

The AI chat could not identify that it can create email triggers. The
`open_page` tool advertised `email` as a trigger kind (routing to
/email_triggers), but neither `write_trigger` (global/session chat) nor
`create_trigger` (flow chat) accepted `kind: "email"` — their enums stopped
at 10 kinds. Seeing email as a navigable page but having no tool to create
one, the model concluded email triggers were unsupported and faked them with
an HTTP webhook plus an external mail provider.

Add `email` to the shared trigger-schema generation (`WORKSPACE_TOOL_*` in
system_prompts/generate.py), which feeds both `triggerRequestSchemas` (global)
and `createTriggerToolSchema` (flow), then wire the kind through the global
chat draft path (TRIGGER_KINDS, draft-kind map, triggerServices/labels,
write_trigger config union) and the flow chat `triggerConfigs`. The backend
route, EmailTriggerService, `trigger_email` draft kind, and email UI drawers
already existed.

Add discovery eval guards (`flow-test17`, `global-test29`) that assert the
model selects `kind: email` for an implicit "run when an email is received"
request. They assert the recorded tool-call kind rather than the resulting
draft, so they hold on a CE backend where email trigger routes
(smtp+private-gated) are not compiled. A mocked unit test in global/core.test.ts
covers the full draft->read->deploy path.

Verified: flow guard 5/5, global guard 4/4 (sonnet); frontend unit tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(ai-chat): default email trigger workspaced_local_part before persist

The global chat forwards the write_trigger draft unchanged, but
workspaced_local_part maps to a NOT NULL column and the model may omit the
optional field — deploying such a draft would fail instead of creating the
trigger. Default it to false at draft-write time (as flow chat does at create),
and assert the deployed request carries it in the unit test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(ai-chat): make email trigger listing and edits robust

Two issues from adding the email kind to the global chat:

- list_workspace_items iterated every trigger kind and awaited each list
  unconditionally; email routes 404 without smtp+private (as do EE kinds on
  CE), so one unavailable kind threw and dropped the entire trigger listing.
  Skip a kind whose list endpoint is unavailable.

- Defaulting workspaced_local_part on the incoming config before the base
  merge reset an existing trigger's value: editing a workspaced trigger while
  omitting the optional field overwrote true with false, changing its
  receiving address. Default on the merged draft instead, so an omitted field
  keeps the existing value and only genuinely new drafts get false.

Adds regression tests for both.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(ai-chat): only skip 404 trigger-list failures, surface the rest

The prior fix caught every rejection from a per-kind trigger list, so an auth,
5xx, or network failure produced a successful-but-incomplete listing that could
make the chat treat existing triggers as absent. Skip only a 404 (route not
compiled in) and re-throw anything else. Adds a propagation test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 12:32:50 +02:00
..
2026-04-30 12:23:59 +00:00