Skip to content

Add request_id and turn_id as log context, clearly indicate model inference errors - #907

Open
chiragjn wants to merge 8 commits into
mainfrom
cj-improve-logging
Open

chiragjn wants to merge 8 commits into
mainfrom
cj-improve-logging

Conversation

@chiragjn

@chiragjn chiragjn commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Note

Low Risk
Observability and error-message changes only; no auth or persistence behavior changes beyond safer error logging.

Overview
Request-scoped logging adds request_id (from x-request-id or minted) on every HTTP request via AsyncLocalStorage and Winston, echoes it on responses, binds turn_id when a turn starts, and propagates request_id from schedule dispatch through the controller’s internal API client. The version field is removed from per-line JSON logs.

Model and error logging wraps LLM failures as Model request failed: <provider>/<model>: <reason> (aborts unchanged), deduplicates model errors so only AgentThread logs once, and tightens extractErrorLogFields: chained cause stacks, no JSON dumps that could leak SDK request bodies (prompts).

Tests cover toStreamError, cause stacks, and prompt redaction.

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

@changeset-bot

changeset-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e0adf15

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

@chiragjn
chiragjn requested review from ramantehlan and removed request for bhaveshpatel640, debajyoti-truefoundry and sr07asthana October 7, 2026 05:11

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.

1 participant