-
Notifications
You must be signed in to change notification settings - Fork 9
fix(review): write PR comments in author's language, not file's #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,6 +135,10 @@ ${sideFieldDescription} | |
| </schema_details> | ||
| </output_spec> | ||
|
|
||
| <language> | ||
| Write every review comment (priority tag aside) — titles, paragraphs, suggestion-block prose, and the \`reviewSummary.body\` — in the language the PR author is using. Detect the language from the PR description and title at \`${descriptionPath}\`; fall back to English if uncertain. Do **not** mirror the language of the source files being reviewed: when the diff includes localized files (translations, \`docs/jp/...\`, \`docs/ko/...\`, \`.es.mdx\`, etc.), still write comments in the PR author's language, not the file's. Priority tags (\`[P0]\`/\`[P1]\`/\`[P2]\`/\`[P3]\`) and the \`[security]\` marker remain in English regardless. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] [security] Treat PR description as untrusted input for language detection The prompt now explicitly instructs reading the PR title/description at |
||
| </language> | ||
|
|
||
| <critical_constraints> | ||
| **DO NOT** post to GitHub. | ||
| **DO NOT** invoke any PR mutation tools (inline comments, submit review, delete/minimize/reply/resolve, etc.). | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,10 @@ If the diff is large, read in chunks (offset/limit). **Do not proceed until you | |
| 2. Preserve ordering: keep results in the same order as candidates. | ||
| 3. **Posting rule (STRICT):** Only post comments where \`status === "approved"\`. Never post rejected items. | ||
|
|
||
| ### Language | ||
|
|
||
| Approved comments and the review summary must be in the language the PR author is using. Detect the language from the PR description and title at \`${descriptionPath}\`; fall back to English if uncertain. Do **not** mirror the language of the source files being reviewed (localized files, translations, \`docs/jp/...\`, etc.) — match the PR author's language. If a candidate was written in the wrong language (e.g., Japanese on an English PR because the diff touched JP docs), rewrite the body into the correct language while preserving meaning, the priority tag (\`[P0]\`/\`[P1]\`/\`[P2]\`/\`[P3]\`), and any \`[security]\` marker. Approve it if the underlying finding is otherwise valid; do not reject solely on language. Priority tags and the \`[security]\` marker remain in English regardless. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Don’t rewrite code when translating candidate bodies The validator is told to “rewrite the body into the correct language”, but without an explicit rule to keep fenced code blocks (especially |
||
|
|
||
| ### Output: Write \`${reviewValidatedPath}\` | ||
|
|
||
| \`\`\`json | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,5 +206,6 @@ The report file should follow this structure: | |
| 2. **Patches**: Test all generated patches before committing. Ensure they don't break functionality. | ||
| 3. **PR Description**: Update the PR body with actual finding counts before creating. | ||
| 4. **Commit Messages**: Use semantic commit format: \`fix(security): [VULN-XXX] Description\` | ||
| 5. **Language**: Write the human-readable parts of the report (titles, descriptions, exploitation, impact, recommended fix, PR body) in the repository's primary language — detect this from the existing README, top-level docs, and any prior PR/issue text. Fall back to English when uncertain. Do **not** mirror the language of source files inside the scan when those files are localized translations (e.g., \`docs/jp/...\`). Severity labels (CRITICAL/HIGH/MEDIUM/LOW), CWE identifiers, severity tags, file paths, and code snippets stay in their canonical form regardless. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Make the PR-body example consistent with the new report language rule This prompt now requires the PR body to be written in the repository’s primary language, but the embedded |
||
| `; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] Keep priority tags consistent across the prompt schema
This template’s schema text describes comment bodies as starting with
[P0|P1|P2], but the new language guidance references[P3]; that mismatch can confuse Pass 1/2 and produce outputs that downstream tooling treats as out-of-spec. Align the allowed priority tag set end-to-end (either remove[P3]here or update the schema/field descriptions everywhere to explicitly allow it).