Core: Move translation rules to system messages to prevent prompt leakage #225
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.
We now send translation rules as a system instruction and user content as the user message, avoiding prompt leakage (instructions leaking into outputs) and improving output cleanliness across providers.
Key changes
Why this change
Purpose
Move translation rules from the user prompt into system instructions to prevent prompt leakage (instructions appearing in model outputs). This improves the cleanliness and consistency of translated content across providers.
Description
This PR updates the markdown translation flow so that:
To achieve this with minimal surface change:
system(rules) anduser(content).Net effect: rules no longer leak into the translated output, improving translation quality while preserving the existing CLI and higher-level behavior.
Related Issue
N/A (preventative enhancement for prompt leakage)
Does this introduce a breaking change?
When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.
Notes:
Type of change
Checklist
Before submitting your pull request, please confirm the following: