Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/contracts/src/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,8 @@ export interface ChannelWorkflowStepMutationResponse {
}

export interface ChannelWorkflowStepStartResponse {
readonly status: "started" | "blocked";
readonly mode: ChannelWorkflowStepStartMode;
readonly workflowStep: ChannelWorkflowStep;
readonly workflow?: ChannelWorkflow;
readonly task?: Task;
Expand Down
4 changes: 4 additions & 0 deletions packages/daemon/src/features/channels/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,8 @@ async function handleChannelWorkflowStepStart(
const started = await prepareWorkflowStepStart(store, workflowStepId, input, cwd, validateRunRequest, secretResolver);
if (started.kind === "blocked") {
writeJson(response, 200, {
status: "blocked",
mode: input.mode,
workflow: store.getChannelWorkflow(started.workflowId),
workflowStep: store.getChannelWorkflowStep(workflowStepId),
blocker: started.blocker,
Expand All @@ -651,6 +653,8 @@ async function handleChannelWorkflowStepStart(
}
completeWorkflowIfStepsFinished(store, started.workflowId, finishedAt);
writeJson(response, 200, {
status: "started",
mode: "create_task",
Comment thread
gansx marked this conversation as resolved.
Resolved
workflow: store.getChannelWorkflow(started.workflowId),
workflowStep: store.getChannelWorkflowStep(workflowStepId),
task: started.task,
Expand Down
4 changes: 4 additions & 0 deletions packages/daemon/test/channel-workspace.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9351,6 +9351,8 @@ test("channel handoff workflows start steps, create tasks, and expose blockers",
mode: "create_task",
taskTitle: "Workflow generated task",
});
assert.equal(started.status, "started");
assert.equal(started.mode, "create_task");
assert.equal(started.workflow.status, "succeeded");
assert.equal(started.workflowStep.status, "succeeded");
assert.equal(started.task.title, "Workflow generated task");
Expand Down Expand Up @@ -9379,6 +9381,8 @@ test("channel handoff workflows start steps, create tasks, and expose blockers",
const blocked = await postJson(`${daemon.url}/workflow-steps/${encodeURIComponent(blockedWorkflow.workflowStep.id)}/start?cwd=${encodeURIComponent(cwd)}`, {
mode: "create_and_run_task",
});
assert.equal(blocked.status, "blocked");
assert.equal(blocked.mode, "create_and_run_task");
assert.equal(blocked.workflowStep.status, "blocked");
assert.match(blocked.blocker, /provider preset/i);

Expand Down
Loading