Destination Organization overrides (org-level and per-repo destinationOrg) only worked on the single-repo mirror path. Bulk Mirror Organization and crash recovery had their own destination logic instead of using the canonical resolver, causing the following
Org/repo destination overrides silently ignored on bulk mirror. Repos landed in whatever target the strategy would normally pick, as if no override had been set
mixed strategy falling into the flat-user fallback on bulk mirror, dumping org repos into the personal account.
Starred repos in a bulk mirror not following starred-repo mode under preserve/single-org (routed into the org target) and mixed (personal account).
Recovered jobs re-routing repos by GitHub org name via the legacy(?) preserveOrgStructure flag.
Apply the organization-level destinationOrg override before any strategy logic.
Resolve each repo in the per-repo loop through getGiteaRepoOwnerAsync(), then route to the pre-created target org, the user account, or an on-demand org. This fixes overrides, mixed, and starred handling in one place, so the bulk path can no longer drift from the single-repo path.
src/lib/recovery.ts
Recovered mirror jobs now always go through mirrorGithubRepoToGitea(), which resolves the destination itself, instead of pre-routing org repos by GitHub org name.
No schema, API, or UI changes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/RayLabsHQ/gitea-mirror/pull/344
**Author:** [@YuzuZensai](https://github.com/YuzuZensai)
**Created:** 7/15/2026
**Status:** 🔄 Open
**Base:** `main` ← **Head:** `main`
---
### 📝 Commits (2)
- [`847e751`](https://github.com/RayLabsHQ/gitea-mirror/commit/847e751e8639d01c282372ce624fc041ff32bc51) 🐛 fix: honor destination overrides when recovering interrupted mirror jobs
- [`67eb345`](https://github.com/RayLabsHQ/gitea-mirror/commit/67eb3455316921e9049406ee3bdfc484e11fc94a) 🐛 fix: resolve bulk org mirror destinations correctly
### 📊 Changes
**2 files changed** (+35 additions, -24 deletions)
<details>
<summary>View changed files</summary>
📝 `src/lib/gitea.ts` (+29 -8)
📝 `src/lib/recovery.ts` (+6 -16)
</details>
### 📄 Description
## Summary
Fixes: #343
Destination Organization overrides (org-level and per-repo `destinationOrg`) only worked on the single-repo mirror path. Bulk **Mirror Organization** and crash recovery had their own destination logic instead of using the canonical resolver, causing the following
- Org/repo destination overrides silently ignored on bulk mirror. Repos landed in whatever target the strategy would normally pick, as if no override had been set
- `mixed` strategy falling into the flat-user fallback on bulk mirror, dumping org repos into the personal account.
- Starred repos in a bulk mirror not following starred-repo mode under `preserve`/`single-org` (routed into the org target) and `mixed` (personal account).
- Recovered jobs re-routing repos by GitHub org name via the legacy(?) `preserveOrgStructure` flag.
See #343 for the full root cause writeup.
## Changes
**`src/lib/gitea.ts`, `mirrorGitHubOrgToGitea()`**
- Apply the organization-level `destinationOrg` override before any strategy logic.
- Resolve each repo in the per-repo loop through `getGiteaRepoOwnerAsync()`, then route to the pre-created target org, the user account, or an on-demand org. This fixes overrides, `mixed`, and starred handling in one place, so the bulk path can no longer drift from the single-repo path.
**`src/lib/recovery.ts`**
- Recovered mirror jobs now always go through `mirrorGithubRepoToGitea()`, which resolves the destination itself, instead of pre-routing org repos by GitHub org name.
No schema, API, or UI changes.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/344
Author: @YuzuZensai
Created: 7/15/2026
Status: 🔄 Open
Base:
main← Head:main📝 Commits (2)
847e751🐛 fix: honor destination overrides when recovering interrupted mirror jobs67eb345🐛 fix: resolve bulk org mirror destinations correctly📊 Changes
2 files changed (+35 additions, -24 deletions)
View changed files
📝
src/lib/gitea.ts(+29 -8)📝
src/lib/recovery.ts(+6 -16)📄 Description
Summary
Fixes: #343
Destination Organization overrides (org-level and per-repo
destinationOrg) only worked on the single-repo mirror path. Bulk Mirror Organization and crash recovery had their own destination logic instead of using the canonical resolver, causing the followingOrg/repo destination overrides silently ignored on bulk mirror. Repos landed in whatever target the strategy would normally pick, as if no override had been set
mixedstrategy falling into the flat-user fallback on bulk mirror, dumping org repos into the personal account.Starred repos in a bulk mirror not following starred-repo mode under
preserve/single-org(routed into the org target) andmixed(personal account).Recovered jobs re-routing repos by GitHub org name via the legacy(?)
preserveOrgStructureflag.See #343 for the full root cause writeup.
Changes
src/lib/gitea.ts,mirrorGitHubOrgToGitea()destinationOrgoverride before any strategy logic.getGiteaRepoOwnerAsync(), then route to the pre-created target org, the user account, or an on-demand org. This fixes overrides,mixed, and starred handling in one place, so the bulk path can no longer drift from the single-repo path.src/lib/recovery.tsmirrorGithubRepoToGitea(), which resolves the destination itself, instead of pre-routing org repos by GitHub org name.No schema, API, or UI changes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.