fix(cli): document HITL pause exit code as 0, not 2 (#37737)

This commit is contained in:
Xiyuan Chen 2026-06-21 22:56:31 -07:00 committed by GitHub
parent ea3ef81396
commit 1acf6e7eb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 8 deletions

View File

@ -1,14 +1,15 @@
export const agentGuide = `
WHEN TO USE
Continue a workflow that paused for human input. run app (or a prior
resume app) exits 2 and prints a JSON object with status "paused",
resume app) exits 0 and prints a JSON object with status "paused",
form_token, workflow_run_id and resolved_default_values. Resume with:
difyctl resume app <app_id> <form_token> --workflow-run-id <id> \\
--inputs '{"name":"Alice"}' -o json
LOOP
A resume can pause again (exit 2 with a new form_token). Repeat until
exit 0. Pass --stream to print events live.
A resume can pause again (exit 0 with a new form_token and status
"paused"). Repeat until the output is no longer a pause. Pass --stream
to print events live.
ERROR RECOVERY
not logged in (exit 4) difyctl auth login

View File

@ -16,7 +16,7 @@ APP MODES
JSON object via --inputs.
agent-chat Conversational with autonomous tool use.
HITL PAUSE (exit code 2)
HITL PAUSE (exit code 0 success-with-pending)
When a workflow pauses for human input, stdout receives a JSON object
with status "paused", form_token, workflow_run_id, and resolved_default_values.
Resume with:

View File

@ -14,9 +14,9 @@ export type Contract = {
}
const EXIT_CODE_DESCRIPTIONS: Readonly<Record<number, string>> = {
[ExitCode.Success]: 'success',
[ExitCode.Success]: 'success (also a workflow paused for human input — check stdout for status "paused")',
[ExitCode.Generic]: 'generic error',
[ExitCode.Usage]: 'usage error (bad flag / missing arg), or a workflow paused for human input',
[ExitCode.Usage]: 'usage error (bad flag / missing arg)',
[ExitCode.Auth]: 'auth error (not logged in / token expired)',
[ExitCode.VersionCompat]: 'version / compatibility error',
}
@ -42,7 +42,7 @@ export const CONTRACT: Contract = {
},
hitl: {
description:
'When a workflow pauses for human input, `run app` exits 2 and writes a JSON object to stdout with status "paused", form_token, workflow_run_id and resolved_default_values.',
'When a workflow pauses for human input, `run app` exits 0 (success-with-pending) and writes a JSON object to stdout with status "paused", form_token, workflow_run_id and resolved_default_values.',
resume:
'difyctl resume app <app_id> <form_token> --workflow-run-id <id> [--inputs \'{"key":"value"}\']',
},

View File

@ -26,7 +26,7 @@ output formats, error envelope, HITL protocol). Treat that JSON as the
source of truth; this file only bootstraps you into it.
## The one non-obvious thing: HITL pauses are not failures
A run can pause for human input. It exits with **code 2** and emits a
A run can pause for human input. It exits with **code 0** and emits a
\`paused\` JSON payload — this is success-with-pending, NOT a crash.
Resume as the payload instructs (see \`difyctl resume app --help\`).