chore: Keep product specific metadata out of turn signatures - #768
sr07asthana wants to merge 1 commit into
Conversation
|
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>
781cd5f to
4e5644c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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 }) ?? {}, |
There was a problem hiding this comment.
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)
Triggered by learned rule: Session metadata is public; omit leaves, {} clears
Reviewed by Cursor Bugbot for commit 4e5644c. Configure here.


Summary
Closes #
Changes
How was this tested?
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,python/trueforge_sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
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
tfyMetadataonbeginTurnExecution/startTurnInProcess. Instead, callers can pass an optionalturnHeaderscallback that runs after the turn id is minted and returns extra LLM/MCP headers.createTurnResolvernow takes precomputedturnHeadersinstead of buildingx-tfy-metadatainternally. The HTTP create-turn handler suppliesturnHeaderswhen TrueFoundry mode is on (merging inbound header metadata with harnesstfg.*stamps).mergeGatewayMetadatarenamestfyMetadata→requestMetadata; unit tests follow.Same runtime behavior for API turns in TrueFoundry mode; scheduled/in-process callers that omit
turnHeadersstill 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.