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:
Riqwan Thamir 2026-10-02 09:15:38 +02:00 committed by GitHub
parent b8b2b32a6c
commit edbd976f3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 2 deletions

View File

@ -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',
});
});
});
// ---------------------------------------------------------------------------

View File

@ -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);
},