Add runtime deadlines and observability#13
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds OpenTelemetry tracing and deadline-aware cooperative yielding to workflow core and runtime execution. New runtime context helpers, durable yield timers, telemetry exports, store spans, sweep budgeting, tests, documentation, and package release metadata are included. ChangesRuntime observability and cooperative execution
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant RuntimeDriver
participant RunStore
participant WorkflowEngine
participant WorkflowTelemetry
participant TimerStore
RuntimeDriver->>WorkflowTelemetry: start runtime or sweep span
RuntimeDriver->>RunStore: claim and load workflow state
RuntimeDriver->>WorkflowEngine: drive workflow with deadline
WorkflowEngine->>WorkflowTelemetry: record step spans and attempt events
WorkflowEngine->>TimerStore: schedule durable yield continuation
RuntimeDriver->>RunStore: synchronize timers and release lease
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🚀 Changeset Version Preview2 package(s) bumped directly, 6 bumped as dependents. 🟩 Patch bumps
|
More templates
@tanstack/react-template
@tanstack/react-template-devtools
@tanstack/solid-template
@tanstack/solid-template-devtools
@tanstack/template
@tanstack/template-devtools
@tanstack/workflow-cloudflare
@tanstack/workflow-core
@tanstack/workflow-netlify
@tanstack/workflow-railway
@tanstack/workflow-runtime
@tanstack/workflow-store-cloudflare-d1
@tanstack/workflow-store-drizzle-postgres
@tanstack/workflow-vercel
commit: |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/workflow-core/package.json (1)
58-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMove
@opentelemetry/apitopeerDependencies. These published libraries should not ship their own copy of the OpenTelemetry API; keep it inpeerDependencies(anddevDependenciesfor local builds/tests) in both package manifests so the host app’s tracer provider stays visible.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/workflow-core/package.json` at line 58, Move `@opentelemetry/api` from dependencies to both peerDependencies and devDependencies in packages/workflow-core/package.json and packages/workflow-runtime/package.json, preserving the existing version range so local builds/tests can resolve it while published packages reuse the host application’s API instance.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/workflow-core/src/telemetry.ts`:
- Around line 175-179: Update startActiveSpan to always pass
trace.wrapSpanContext(INVALID_SPAN_CONTEXT) to the callback when telemetry is
disabled, instead of falling back to trace.getActiveSpan(). Preserve the
existing async callback execution and return behavior.
---
Nitpick comments:
In `@packages/workflow-core/package.json`:
- Line 58: Move `@opentelemetry/api` from dependencies to both peerDependencies
and devDependencies in packages/workflow-core/package.json and
packages/workflow-runtime/package.json, preserving the existing version range so
local builds/tests can resolve it while published packages reuse the host
application’s API instance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 84578070-b222-4200-aa41-89968015bfa9
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (27)
.changeset/calm-clocks-yield.md.changeset/metal-shoes-observe.mddocs/api/runtime.mddocs/concepts/primitives.mddocs/config.jsondocs/cookbook/index.mddocs/guide/index.mddocs/guide/observability.mdpackages/workflow-cloudflare/package.jsonpackages/workflow-core/package.jsonpackages/workflow-core/src/engine/run-workflow.tspackages/workflow-core/src/index.tspackages/workflow-core/src/telemetry.tspackages/workflow-core/src/types.tspackages/workflow-core/tests/telemetry.test.tspackages/workflow-netlify/package.jsonpackages/workflow-railway/package.jsonpackages/workflow-runtime/package.jsonpackages/workflow-runtime/src/index.tspackages/workflow-runtime/src/run-store-adapter.tspackages/workflow-runtime/src/runtime-driver.tspackages/workflow-runtime/src/types.tspackages/workflow-runtime/tests/runtime-driver.test.tspackages/workflow-runtime/tests/telemetry.test.tspackages/workflow-store-cloudflare-d1/package.jsonpackages/workflow-store-drizzle-postgres/package.jsonpackages/workflow-vercel/package.json
What changed
ctx.runtimeand automatically yield before fresh durable work when the remaining budget is lowWhy
Applications currently have to hand-roll wall-clock checks and arbitrary queue batch sizes to avoid host execution limits. The runtime should own that policy and checkpoint cleanly without treating a yield as an error.
The timer identity change prevents sequential waits at the same timestamp from reusing an already-consumed signal delivery ID.
Impact
Existing workflows remain unbounded unless a runtime deadline or maximum duration is supplied. Step timeouts remain independent. Official context fields are grouped under the reserved
runtimenamespace.Verification
pnpm test:ciSummary by CodeRabbit
ctx.runtime(including helpers to check remaining time and pause/resume execution).