Structured logger metadata + fold in replay-timeout logging#1832
Closed
pranaygp wants to merge 2 commits into
Closed
Structured logger metadata + fold in replay-timeout logging#1832pranaygp wants to merge 2 commits into
pranaygp wants to merge 2 commits into
Conversation
Contributor
🦋 Changeset detectedLatest commit: b2b1587 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests💻 Local Development (2 failed)vite-stable (2 failed):
🐘 Local Postgres (2 failed)nuxt-stable (2 failed):
Details by Category❌ 💻 Local Development
✅ 📦 Local Production
❌ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
This was referenced Apr 23, 2026
14 tasks
Contributor
Author
|
Phase 4 stacked on top of this: #1836 — |
This was referenced Apr 24, 2026
Adds a `.child()` and `.forRun(runId, workflowName)` child-logger API to the structured logger so runtime/step code doesn't have to repeat `workflowRunId`/`workflowName`/`stepId` on every call. Normalizes error metadata to structured `errorName` / `errorMessage` / `errorStack` fields instead of ad-hoc `error: err.message` strings, and adds comments to silent catches that swallow expected idempotency conflicts. Also folds in the pending changes from #1812 so that PR can be closed: - Standardize the console prefix to `[workflow-sdk]`. - Split the replay-timeout log into a warn-while-retrying vs. error-when-giving-up, and surface the underlying error when we can't mark a timed-out run as failed. - Include the error stack in the "Fatal runtime error during workflow setup" log and in the top-level user-code workflow error log so the stack surfaces in flattened log drains. - Drop the `[Workflows] "<runId>" - ` prefix from `buildWorkflowSuspensionMessage` — the structured logger now attaches run context. Supersedes #1812. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
e84e7be to
b2b1587
Compare
44 tasks
Contributor
Author
|
Superseded by #1849 — consolidated friendlier-errors PR with all 8 phases + follow-up fixes (ANSI leak, non-retry semantics, shared captureStackTrace helper). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 3 of the friendlier-errors stack. Also folds in #1812 so that PR can close as superseded.
runtimeLogger/stepLogger/webhookLoggeretc. now expose.child(metadata)and.forRun(runId, workflowName, extra?), so runtime and step handlers don't have to repeatworkflowRunId/workflowName/stepIdon every log call.error: err.messagestrings are replaced with structurederrorName/errorMessage/errorStackfields so log drains can render and group them properly.EntityConflictError/RunExpiredErrorpaths that swallow expected idempotency conflicts now explain why it's safe to drop the error.Folded in from #1812 (supersedes it)
[workflow-sdk].[Workflows] "<runId>" -prefix frombuildWorkflowSuspensionMessage— the structured logger attaches run context now.Closes / supersedes: #1812
Manual test plan
All tests below use
workbench/nextjs-turbopack. Start withcd workbench/nextjs-turbopack && pnpm devand watch the terminal.[workflow-sdk]. Search logs for\[Workflows\]— should be zero hits (the old prefix is gone).runId,workflowName,stepIdas structured metadata (the object after the message), not interpolated into the message string.errorName,errorMessage, anderrorStackappear as structured metadata fields (in addition to the stack in the message).WORKFLOW_REPLAY_TIMEOUT_MS=50in env and run a workflow with any non-trivial work. On early replay attempts expect awarn-level line ("replay timed out, retrying"); after retries exhaust expect anerror-level line with the underlying failure cause visible.[Workflows] "<runId>" -— only[workflow-sdk], with run context in structured metadata.EntityConflictError/RunExpiredError) around idempotent step-completion paths. No user-visible test.Unit tests
src/logger.test.tscovers.child,.forRun, metadata merging, and conflict precedence (10 tests).src/util.test.tsupdated for new suspension-message format (23 tests pass).pnpm typecheckreports no new errors.📚 Friendlier errors stack
Multi-PR initiative inspired by @Schniz's stalled #706:
Ansirendering primitives + context-violation errorsSerializationErrorat serialization / stream / encryption boundariesdescribeError)throw new Error(...)sitesdescribeRunError+ public subpathWorkflowBuildError+ applications in@workflow/buildersfunctionNameleak, simplify docs framing, redirect stack to user codeEach PR is stacked on the previous one; merge in order.
🤖 Generated with Claude Code