Skip to content

Fix Bergamot model download: migrate from GitHub LFS/API to Google Cloud Storage#601

Merged
Freeesia merged 5 commits intomasterfrom
copilot/fix-bergamot-plugin-download-issue
Mar 25, 2026
Merged

Fix Bergamot model download: migrate from GitHub LFS/API to Google Cloud Storage#601
Freeesia merged 5 commits intomasterfrom
copilot/fix-bergamot-plugin-download-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

mozilla/firefox-translations-models was archived in December 2025 and its GitHub LFS objects were deleted (LFS batch API returns 410 Gone), causing model downloads to fail.

Changes

  • Model listing: Replace GitHub API (Repository.Content.GetAllContents) with GCS db/models.json (https://storage.googleapis.com/moz-fx-translations-data--303e-prod-translations-data/db/models.json). The index is fetched at runtime and cached, so the plugin automatically picks up new models without code changes.
  • Model download: Use Google.Cloud.Storage.V1 (StorageClient.CreateUnauthenticated()) to stream model files directly from the GCS bucket. Both the JSON index fetch and binary downloads use the GCS library.
  • Model selection: Prefer releaseStatus == "Release" models, with architecture fallback order base → base-memory → tiny.
  • Removed dependencies: Octokit / IGitHubClient are no longer needed and have been removed from the plugin.
  • Added dependency: Google.Cloud.Storage.V1 4.14.0.
// Before: GitHub API for listing + media.githubusercontent.com for LFS downloads
var contents = await client.Repository.Content.GetAllContents(owner, repo, $"models/base/{langPair}");

// After: GCS db/models.json for listing + StorageClient for downloads
private const string BucketName = "moz-fx-translations-data--303e-prod-translations-data";
private const string ModelsJsonObject = "db/models.json";

using var stream = new MemoryStream();
await StorageClient.DownloadObjectAsync(BucketName, ModelsJsonObject, stream);
_cachedModels = await JsonSerializer.DeserializeAsync<GcsModelsRoot>(stream);
Original prompt

This section details on the original issue you should resolve

<issue_title>bergamot翻訳プラグインでモデルダウンロードに失敗する</issue_title>
<issue_description>ダウンロード先リポジトリを確認して、修正する</issue_description>

Comments on the Issue (you are @copilot in this section)


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI changed the title [WIP] Fix model download failure in bergamot translation plugin Fix Bergamot model download: migrate from GitHub LFS to Google Cloud Storage Mar 23, 2026
Copilot AI requested a review from Freeesia March 23, 2026 04:54
@Freeesia Freeesia marked this pull request as ready for review March 23, 2026 11:26
@Freeesia
Copy link
Copy Markdown
Owner

@copilot
そもそもモデル一覧の取得自体をGitHubではなくGCSから取得するようにして。
モデル一覧は以下のURLから取得可能。ランタイムでもこのURLを使って取得してモデルの更新に対応できるようにして。
https://storage.googleapis.com/moz-fx-translations-data--303e-prod-translations-data/db/models.json

可能であれば、GCSのライブラリ使って。

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 25, 2026

@copilot
そもそもモデル一覧の取得自体をGitHubではなくGCSから取得するようにして。
モデル一覧は以下のURLから取得可能。ランタイム�...

対応しました(コミット 0f4f696)。

主な変更点:

  • モデル一覧の取得: GitHub API (GetAllContents) から GCS の db/models.json (https://storage.googleapis.com/moz-fx-translations-data--303e-prod-translations-data/db/models.json) に変更。ランタイムで取得するためモデルの更新に自動追従します。
  • GCS ライブラリ: Google.Cloud.Storage.V1 (StorageClient.CreateUnauthenticated()) を使用。db/models.json の取得とモデルバイナリのダウンロードの両方に利用。
  • Octokit / IGitHubClient の削除: 完全に不要になったため除去。
  • モデル選択: releaseStatus == "Release" を優先し、次いで base → base-memory → tiny の順でフォールバック。
  • キャッシュ: db/models.jsonvolatile + ダブルチェックロックでスレッドセーフにキャッシュ。

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/mozilla/firefox-translations-models/contents/tests
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/repos/mozilla/firefox-translations-models/contents/tests/remote_settings
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/repos/mozilla/firefox-translations-models/contents/tests/remote_settings/create
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/repos/mozilla/firefox-translations-models/git/trees/e7957fc407441a5e3e35bbcbf9d60d9b35764618
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/repos/mozilla/translations/contents/.github/workflows/github-pages.yml
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/repos/mozilla/translations/contents/docs
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/repos/mozilla/translations/contents/tracking
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/repos/mozilla/translations/contents/tracking/translations_parser
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/repos/mozilla/translations/git/trees/HEAD
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/search/code
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://storage.googleapis.com/moz-fx-translations-data--303e-prod-translations-data/db/models.json
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Fix Bergamot model download: migrate from GitHub LFS to Google Cloud Storage Fix Bergamot model download: migrate from GitHub LFS/API to Google Cloud Storage Mar 25, 2026
ValidateAsyncメソッド内でダイアログを閉じる処理を、Application.Current.Dispatcher.Invokeを用いてUIスレッド上で実行するよう修正しました。これにより、UIスレッドでのみ許可される操作が安全に行われるようになります。また、usingディレクティブの整理も行いました。
Copilot AI requested a review from Freeesia March 25, 2026 12:01
@Freeesia Freeesia merged commit f2f5ef1 into master Mar 25, 2026
7 checks passed
@Freeesia Freeesia deleted the copilot/fix-bergamot-plugin-download-issue branch March 25, 2026 12:39
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.

bergamot翻訳プラグインでモデルダウンロードに失敗する

2 participants