Skip to content

[BUG] Nested workflow runs drop resourceId before persistWorkflowSnapshot #15246

@amitava82

Description

@amitava82

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

@mastra/core: 1.24.1

Verification

  • I have searched the existing issues to make sure this is not a duplicate
  • I have included sufficient information for the team to reproduce and understand the issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions