mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-19 16:55:02 +02:00
fix(core): Return the workflow of a running execution from the Instance AI executions tool (no-changelog)
executions(get) needs the workflow ID to report ranPublishedVersion. A running execution now returns its workflow ID and workflow version ID. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
b8b2b32a6c
commit
edbd976f3f
|
|
@ -386,6 +386,26 @@ describe('stop execution — workflow:execute scope', () => {
|
|||
'workflow:read',
|
||||
]);
|
||||
});
|
||||
|
||||
it('getStatus returns the workflow and version of a running execution', async () => {
|
||||
executionRepository.findSingleExecution.mockReset().mockResolvedValue({
|
||||
id: 'exec-1',
|
||||
workflowId: 'wf-1',
|
||||
workflowVersionId: 'version-1',
|
||||
} as never);
|
||||
workflowFinderService.findWorkflowForUser.mockResolvedValue({ id: 'wf-1' } as never);
|
||||
activeExecutions.has.mockReturnValue(true);
|
||||
|
||||
const ctx = service.createContext(user);
|
||||
const result = await ctx.executionService.getStatus('exec-1');
|
||||
|
||||
expect(result).toEqual({
|
||||
executionId: 'exec-1',
|
||||
workflowId: 'wf-1',
|
||||
workflowVersionId: 'version-1',
|
||||
status: 'running',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -2614,10 +2614,15 @@ export class InstanceAiAdapterService {
|
|||
},
|
||||
|
||||
async getStatus(executionId: string) {
|
||||
await assertExecutionAccess(executionId);
|
||||
const execution = await assertExecutionAccess(executionId);
|
||||
const isRunning = activeExecutions.has(executionId);
|
||||
if (isRunning) {
|
||||
return { executionId, status: 'running' } satisfies ExecutionResult;
|
||||
return {
|
||||
executionId,
|
||||
workflowId: execution.workflowId,
|
||||
workflowVersionId: execution.workflowVersionId ?? null,
|
||||
status: 'running',
|
||||
} satisfies ExecutionResult;
|
||||
}
|
||||
return await extractExecutionResult(executionId, allowSendingParameterValues, nodeTypes);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user