Skip to content

Ask for what is missing

The escalation boundaryDashboardHTTPMCPconditionalassigneeform_schema

When a run lacks a fact it needs, it asks the one person who has it with a form for just that field, then continues.

The situation

An order arrives without a delivery phone number. Failing the run loses the order; guessing ships it wrong. The person who placed it can answer in ten seconds if someone asks them.

The recipe

workflows/fulfil-order.ts
import { Durable } from '@hotmeshio/hotmesh';
import { conditional, type LTEnvelope } from '@hotmeshio/long-tail';
export async function fulfilOrder(envelope: LTEnvelope) {
const { orderId, placedBy } = envelope.data;
let phone: string | undefined = envelope.data.phone;
if (!phone) {
const { workflowId } = Durable.workflow.workflowInfo();
const answer = await conditional<{ phone: string }>(`missing-phone-${workflowId}`, {
role: 'customer-contact',
assignee: placedBy,
description: `Order ${orderId} needs a delivery phone number`,
metadata: {
orderId,
form_schema: {
title: 'Delivery phone',
required: ['phone'],
properties: { phone: { type: 'string', format: 'tel', description: 'Number the carrier can call' } },
},
},
timeout: '48h',
});
if (!answer) return { data: { orderId, status: 'held' } };
phone = answer.phone;
}
return { data: { orderId, phone, status: 'ready-to-ship' } };
}

assignee places the row straight into one person’s list. The form asks for the single field the run is missing, and the answer validates before it reaches the workflow.

The guarantee

The run pauses durably on the gap instead of failing, the request reaches exactly one person, and the deadline returns false if nobody answers. See conditional.