Skip to content

feat: add request ID correlation for Body Timeout logs in VercelAILLM - #1100

Open
thesujai wants to merge 1 commit into
mainfrom
feat/logs-llm-req-id
Open

thesujai wants to merge 1 commit into
mainfrom
feat/logs-llm-req-id

Conversation

@thesujai

@thesujai thesujai commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #

Changes

How was this tested?

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Low Risk
Observability and an extra outbound header on model calls; error handling behavior is unchanged aside from richer Body Timeout logs.

Overview
Adds request correlation for undici Body Timeout failures on Vercel AI SDK model calls.

Each streaming VercelAILLM.create call now sets x-tfy-request-id (new UUID) on outbound provider headers. When a Body Timeout is detected (including nested under fetch failed), logging uses a dedicated LLM Body Timeout path with tfy_request_id, model, and optional gateway_url instead of the generic stream/create error messages—so harness logs can be tied to AI Gateway traces.

Exports isBodyTimeoutError and bodyTimeoutLogFields with unit tests; patch changeset for @truefoundry/trueforge-core.

Reviewed by Cursor Bugbot for commit ec9c0fb. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ec9c0fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge-core Patch
@truefoundry/trueforge Patch

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

}

/** Fields for Body Timeout logs: gateway correlation id plus model and URL when known. */
export function bodyTimeoutLogFields(input: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be just for body Timeout errors - we can have a request ID for all TFY gateway requests, and log in all gateway errors.
cc @chiragjn

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants