fix(cypher-executor): trigger_workflow paused 不算失敗
watcher 實測 8/8 raw 跑通後發現 wait=true 把 wiki_synthesis paused (claude_api 等 callback resume 的正常狀態)回報成 success:false,造成 watcher 看起來「5/8 失敗」實際是「正在背景跑」。 改成: - isPaused 偵測「workflow paused at node X」error 字串 - isPaused → success:true, status:'paused_awaiting_resume' - 完整完成 → status:'completed' - 真失敗 → status:'failed' Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -211,7 +211,15 @@ function makeTriggerWorkflowRunner(env: Bindings): ComponentRunner {
|
|||||||
|
|
||||||
if (wait) {
|
if (wait) {
|
||||||
const r = await executeWebhookGraph(env, record.graph, triggerContext, workflowName, apiKey);
|
const r = await executeWebhookGraph(env, record.graph, triggerContext, workflowName, apiKey);
|
||||||
return { success: r.success, triggered_workflow: workflowName, sub_result: r };
|
// paused 是預期狀態(claude_api 等待外部 callback resume),不算失敗
|
||||||
|
// executeWebhookGraph 內部把 ExecutionError + "paused at node X" 包成 success:false + 含 error 字串
|
||||||
|
const isPaused = !r.success && typeof r.error === 'string' && /workflow paused/i.test(r.error);
|
||||||
|
return {
|
||||||
|
success: r.success || isPaused,
|
||||||
|
triggered_workflow: workflowName,
|
||||||
|
status: r.success ? 'completed' : (isPaused ? 'paused_awaiting_resume' : 'failed'),
|
||||||
|
sub_result: r,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
// fire-and-forget — 不 await,但因為沒拿到 ctx.waitUntil,這裡 promise 可能被 cancel
|
// fire-and-forget — 不 await,但因為沒拿到 ctx.waitUntil,這裡 promise 可能被 cancel
|
||||||
// 目前不啟用,留 wait=true 為預設。未來想要 fire-and-forget 需 plumb ExecutionContext
|
// 目前不啟用,留 wait=true 為預設。未來想要 fire-and-forget 需 plumb ExecutionContext
|
||||||
|
|||||||
Reference in New Issue
Block a user