Describe the Bug
When a parent workflow run is created with resourceId, nested child workflows do not pass that resourceId through to persistWorkflowSnapshot. This causes child workflow snapshots/runs to lose tenant/resource association.
|
const run = isResume ? await this.createRun({ runId: resume.runId }) : await this.createRun({ runId }); |
Steps To Reproduce
const child = createWorkflow({...}).then(childStep)
child.commit()
const parent = createWorkflow({...}).then(child)
parent.commit()
const run = await parent.createRun({
runId: 'run-1',
resourceId: 'workspace-1',
})
await run.start({ inputData: { ok: true } })
Observed result:
parent snapshot calls include resourceId: 'workspace-1'
child snapshot calls have resourceId: undefined
Link to Minimal Reproducible Example
https://github.com/amitava82/mastra-demo
Expected Behavior
If a parent workflow is started with:
const run = await workflow.createRun({ runId: 'run-1', resourceId: 'workspace-1' })
then nested workflows invoked inside that workflow should also persist snapshots with resourceId: 'workspace-1'.
Environment Information
Verification
Describe the Bug
When a parent workflow run is created with resourceId, nested child workflows do not pass that resourceId through to persistWorkflowSnapshot. This causes child workflow snapshots/runs to lose tenant/resource association.
mastra/packages/core/src/workflows/workflow.ts
Line 2277 in 067b225
Steps To Reproduce
Observed result:
parent snapshot calls include resourceId: 'workspace-1'
child snapshot calls have resourceId: undefined
Link to Minimal Reproducible Example
https://github.com/amitava82/mastra-demo
Expected Behavior
If a parent workflow is started with:
then nested workflows invoked inside that workflow should also persist snapshots with resourceId: 'workspace-1'.
Environment Information
Verification