Skip to content

fix(i18n): localize hosted review creation errors - #33368

Merged
nwparker merged 1 commit into
stablyai:mainfrom
seijikohara:fix/i18n-hosted-review-creation-errors
Oct 27, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
seijikohara:fix/i18n-hosted-review-creation-errors

Conversation

@seijikohara

@seijikohara seijikohara commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca can't create a pull request or merge request (for example, you have uncommitted changes, haven't pushed, or aren't signed in), it shows an error. Until now that error was always in English, even when Orca was set to Japanese or another language. Now the host sends a short reason code with the error, and the app turns that code into a message in your language. If the host is older and sends no code, you still see the original English message.

What Changed

Before: Main built every create failure as an English sentence ({ ok: false, code, error }) and the renderer showed result.error verbatim. The pre-create blocked notice (resolveBlockedCreateReviewNoticeMessage) hard-coded English templates and only localized the PR/MR label inside them. The dropdown auth_required hint interpolated an untranslated "Run gh auth login".

After: These messages show up in the UI language in the Source Control notice, the Checks panel, the pre-create blocked notice, and the dropdown sign-in hint.

Mechanism:

  • CreateHostedReviewResult / CreateStackedHostedReviewResult (src/shared/hosted-review.ts) get an optional reason (plus a trimmed base for base_not_on_remote). Main sets it for every failure Orca writes itself: blocking checks, hosted-review-creation, and the GitHub/GitLab/Bitbucket/Gitea/Azure DevOps creators. The English error stays the same.
  • The new src/renderer/src/components/right-sidebar/hosted-review-create-failure-copy.ts maps each reason to translate() copy with the provider's review label. An unknown or missing reason falls back to the host's English error.
  • The provider sign-in steps (commands and env vars) now live in one table that both the notice and the dropdown hint use. The old English-only resolveHostedReviewAuthInstruction is removed.
  • New sourceControl.createReviewFailure.* keys in all 7 locales (en/es/fr/ja/ko/pt/zh). Commands and env var names are left untranslated.

Why

Issue #33321 (from the i18n gap list in #32207): the host built these errors as English text, so the renderer had nothing to translate. Sending a reason code alongside the English text keeps the change additive and safe across mixed versions. Older clients, mobile and logs keep reading error. Older hosts send no reason, so newer clients fall back to the English text. A newer host's unknown reason also falls back. Translating on the host instead would tie the message to the host's locale, not the viewer's. A switch with static keys is used instead of dynamic key building because localization extraction needs literal translate keys.

Linked Issue

Fixes #33321

Visual Proof

N/A for screenshots: no component fixture covers these notices, and they only appear after a real create attempt fails against a hosting provider. Here is the before/after behavior from a probe with i18n set to ja:

Before (main):

Create MR failed: commit or discard local changes before creating a MR.
Create PR failed: push this branch before creating a PR.
Create PR failed: Azure DevOps is not authenticated. Next step: Set ORCA_AZURE_DEVOPS_TOKEN in this environment.
Create PR failed: Orca could not confirm whether this branch already has a PR. Retry once the GitHub lookup succeeds.

After (this branch):

MR の作成に失敗しました: MR を作成する前に、ローカルの変更をコミットするか破棄してください。
PR の作成に失敗しました: PR を作成する前に、このブランチをプッシュしてください。
PR の作成に失敗しました: Azure DevOps が認証されていません。次の手順: この環境で ORCA_AZURE_DEVOPS_TOKEN を設定してください。
PR の作成に失敗しました: このブランチに PR がすでにあるかどうかを Orca が確認できませんでした。GitHub での確認が成功してから再試行してください。

The probe also checked these cases:

  • A base branch named a&b<c> comes through without HTML escaping.
  • An older host with no reason keeps its English detail.
  • An unknown reason falls back to the English error.

Testing

  • Reproduced on main with a scratch vitest (i18n.changeLanguage('ja') + resolveBlockedCreateReviewNoticeMessage({ provider: 'github', blockedReason: 'auth_required', ... })). Main returns English and the branch returns Japanese.

  • pnpm test on the changed test files and src/renderer/src/i18n: 21 files, 171 tests pass. During review, src/renderer/src/components/right-sidebar/ (2531 tests) and pnpm tc:web also passed.

  • The verify:localization-* catalog, extraction, coverage and runtime scripts exit 0. A script confirmed that the {{...}} placeholders and literal commands/env vars match en in every locale.

  • oxlint, oxfmt, anti-slop oxlint, the code-quality native plugins, ast-grep, and check-changed-code-quality are clean on the touched files.

  • Platforms: macOS (tests). This change only touches strings, with no platform-specific paths. SSH/remote: covered by the mixed-version fallback above, and the hostedReview.create RPC passes the result through unchanged. Folder workspaces are unaffected (the hosted review flow applies to git repos only).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Notes

  • English wording changes slightly in a few places:
    • "run gh auth login" is now lowercase in the pre-create notice, matching the existing notice.
    • The Bitbucket notice now also mentions ORCA_BITBUCKET_* env credentials.
    • The unsupported-remote message is reworded.
  • Errors from the stacked-PR flow and required-field errors still have no reason code, so they stay English. That gap predates this PR and is out of scope.
  • Mobile ignores the new optional fields and keeps showing English error.

Original fix by @seijikohara in #33368.

@seijikohara
seijikohara marked this pull request as ready for review October 25, 2026 03:06
Copilot AI balanced review requested due to automatic review settings October 25, 2026 03:06

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1fe0c7a4-bf01-4802-afe5-669adfa676de
Commits

Reviewing files that changed from the base of the PR and between c6b438b and a3a012c.

Files selected for processing: 11
  • src/renderer/src/components/right-sidebar/hosted-review-create-failure-copy.ts
  • src/renderer/src/components/right-sidebar/source-control-create-review-blocked-action.test.ts
  • src/renderer/src/components/right-sidebar/source-control-create-review-blocked-action.ts
  • src/renderer/src/components/right-sidebar/source-control-dropdown-review-items.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/zh.json
Files skipped from review as they are similar to previous changes: 7
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/es.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

Hosted-review failure results now include machine-readable reason codes and, for some results, the submitted base branch. The renderer maps known reasons to localized messages and uses shared copy for creation and blocked-action notices. English, Spanish, French, Japanese, Korean, Portuguese, and Chinese catalogs gain failure text. Provider error conditions, codes, and existing English error messages remain unchanged.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Minimal · up to a3a01

The reviewed notice and authentication paths retain their expected behavior; no actionable merge-blocking issue remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Description check Passed The description clearly explains the user impact, implementation, compatibility behavior, linked issue, visual proof rationale, testing, platform coverage, and scope exclusions. It omits the template'…
Title check Passed The title accurately and concisely identifies the primary change: localizing hosted review creation errors.
Linked Issues check Passed [#33321] requires localized hosted-review creation failures and blocked-create notices in es, fr, ja, ko, pt, and zh. The change adds typed optional reason and base fields, sets reasons in the blo…
Out of Scope Changes check Passed The changed main-process files add reason metadata without changing failure classification or English error text. The shared types, renderer copy helper, notice integration, Checks panel integration, …
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Full details: Description check

Explanation

The description clearly explains the user impact, implementation, compatibility behavior, linked issue, visual proof rationale, testing, platform coverage, and scope exclusions. It omits the template's explicit Review, Agent skill upstream boundary, and Checklist sections, but the required information is otherwise substantially covered.

Full details: Linked Issues check

Explanation

[#33321] requires localized hosted-review creation failures and blocked-create notices in es, fr, ja, ko, pt, and zh. The change adds typed optional reason and base fields, sets reasons in the blocking flow and GitHub, GitLab, Bitbucket, Gitea, and Azure DevOps creation failures, and keeps the English error field. hosted-review-create-failure-copy.ts maps known reasons through literal translate keys and reuses the result for the creation notices, Checks panel, and blocked-create notice. Missing or unknown reasons fall back to result.error. The locale files and focused tests cover the required languages and fallback behavior. The excluded stacked and PR/MR operation errors are not required by #33321.

Full details: Out of Scope Changes check

Explanation

The changed main-process files add reason metadata without changing failure classification or English error text. The shared types, renderer copy helper, notice integration, Checks panel integration, locale entries, and tests directly support [#33321]. The dropdown change reuses the same provider sign-in guidance and localizes the related auth hint. It is connected supporting work, not an unrelated feature. No changed file introduces stacked-review behavior or PR/MR operation behavior.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI balanced review requested due to automatic review settings October 25, 2026 23:59

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Copilot AI balanced review requested due to automatic review settings October 27, 2026 02:17

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Main now tags each Orca-authored PR/MR create failure with a reason code
(the English error is unchanged for mobile, older clients and logs), and
the renderer maps the reason to translated copy in the Source Control
notice, the Checks panel and the pre-create blocked notice. Sign-in steps
are single-sourced across providers.

Fixes stablyai#33321

Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
@nwparker
nwparker force-pushed the fix/i18n-hosted-review-creation-errors branch from c6b438b to a3a012c Compare October 27, 2026 11:39
Copilot AI balanced review requested due to automatic review settings October 27, 2026 11:39

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@nwparker
nwparker merged commit 9b0170c into stablyai:main Oct 27, 2026
45 of 46 checks passed
@seijikohara
seijikohara deleted the fix/i18n-hosted-review-creation-errors branch October 27, 2026 13:23
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.

[Bug]: Pull and merge request creation errors show in English in every UI language

3 participants