Files
triggerdotdev--trigger.dev/.changeset/giant-plums-smash.md
T
Eric Allam 14dcc76f93 feat: run.ctx tidying and additions (#2322)
* Cleanup context and execution creation, cache stuff, add parent and root task run ids

* more efficient by using friendly IDs instead of doing joins

* metadata.root/parent now reference current run when run has no root/parent

* Adding changeset

* try to make test less flaky

* Clean imports

* Another attempt to fix the flaky test

* Fix usage by still passing durationMs and costInCents to the execution, just not the run.ctx
2025-07-30 13:47:12 +01:00

661 B

@trigger.dev/sdk
@trigger.dev/sdk
patch

Added and cleaned up the run ctx param:

  • New optional properties ctx.run.parentTaskRunId and ctx.run.rootTaskRunId reference the current run's root/parent ID.
  • Removed deprecated properties from ctx
  • Added a new ctx.deployment object that contains information about the deployment associated with the run.

We also update metadata.root and metadata.parent to work even when the run is a "root" run (meaning it doesn't have a parent or a root associated run). This now works:

metadata.root.set("foo", "bar");
metadata.parent.set("baz", 1);
metadata.current().foo // "bar"
metadata.current().baz // 1