Skip to content

chore: Keep product specific metadata out of turn signatures - #768

Open
sr07asthana wants to merge 1 commit into
mainfrom
sr-fix-headers-resolving
Open

sr07asthana wants to merge 1 commit into
mainfrom
sr-fix-headers-resolving

Conversation

@sr07asthana

@sr07asthana sr07asthana commented Sep 16, 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
Refactor that preserves existing header merge semantics; optional callback means callers without it behave as before.

Overview
Turn execution no longer accepts TrueFoundry-specific tfyMetadata on beginTurnExecution / startTurnInProcess. Instead, callers can pass an optional turnHeaders callback that runs after the turn id is minted and returns extra LLM/MCP headers.

createTurnResolver now takes precomputed turnHeaders instead of building x-tfy-metadata internally. The HTTP create-turn handler supplies turnHeaders when TrueFoundry mode is on (merging inbound header metadata with harness tfg.* stamps). mergeGatewayMetadata renames tfyMetadatarequestMetadata; unit tests follow.

Same runtime behavior for API turns in TrueFoundry mode; scheduled/in-process callers that omit turnHeaders still send no gateway metadata headers.

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

@changeset-bot

changeset-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4e5644c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Parse request metadata at create-turn and supply generic turnHeaders after the turn id exists, so beginTurnExecution no longer takes tfy-specific fields.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sr07asthana
sr07asthana force-pushed the sr-fix-headers-resolving branch 2 times, most recently from 781cd5f to 4e5644c Compare September 16, 2026 14:32

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4e5644c. Configure here.

session,
turnId,
tfyMetadata,
turnHeaders: turnHeaders?.({ session, turnId }) ?? {},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Scheduled turns drop gateway metadata

Medium Severity

TrueFoundry-mode x-tfy-metadata harness stamps now apply only on HTTP create-turn. startTurnInProcess callers such as schedule runs omit turnHeaders, so model and MCP gateway calls lose tfg.session_id, tfg.turn_id, and agent identity that were previously always overlaid.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by learned rule: Session metadata is public; omit leaves, {} clears

Reviewed by Cursor Bugbot for commit 4e5644c. Configure here.

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