[PR #162] [MERGED] fix: ensure correct open/closed status when mirroring issues (#161) #161

Closed
opened 2026-02-27 15:55:23 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/162
Author: @arunavo4
Created: 12/25/2025
Status: Merged
Merged: 2/24/2026
Merged by: @arunavo4

Base: mainHead: fix/issue-161-status-sync


📝 Commits (1)

  • bebbda9 fix: ensure correct open/closed status when mirroring issues (#161)

📊 Changes

1 file changed (+90 additions, -2 deletions)

View changed files

📝 src/lib/gitea.ts (+90 -2)

📄 Description

Add verification and explicit close fallback after issue creation to
handle Gitea API's two-step close process that can fail silently.

What was fixed:

  1. Issue Status Verification (mirrorGitRepoIssuesToGitea):
    - After creating an issue, verifies if the closed state was actually applied
    - If not closed, explicitly PATCHes the issue to close it
    - Logs warnings for debugging when the fallback is triggered
  2. PR Status Verification (mirrorGitRepoPullRequestsToGitea):
    - Same fix applied to both the enriched and basic issue creation paths
    - Verifies closed/merged PRs are actually closed in Gitea
    - Explicit PATCH fallback if the initial creation didn't apply the state
  3. Content Validation:
    - Added warning log when body content appears to be missing after sync
    - Helps identify repos with content sync issues

Root Cause:

Gitea's API first creates issues as open, then closes them separately. This two-step process can fail silently due to rate limiting, timeouts, or other errors - leaving issues in an incorrect open state.


🔄 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/162 **Author:** [@arunavo4](https://github.com/arunavo4) **Created:** 12/25/2025 **Status:** ✅ Merged **Merged:** 2/24/2026 **Merged by:** [@arunavo4](https://github.com/arunavo4) **Base:** `main` ← **Head:** `fix/issue-161-status-sync` --- ### 📝 Commits (1) - [`bebbda9`](https://github.com/RayLabsHQ/gitea-mirror/commit/bebbda946583ace663f05584dd7decc3686c1390) fix: ensure correct open/closed status when mirroring issues (#161) ### 📊 Changes **1 file changed** (+90 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/gitea.ts` (+90 -2) </details> ### 📄 Description Add verification and explicit close fallback after issue creation to handle Gitea API's two-step close process that can fail silently. What was fixed: 1. Issue Status Verification (mirrorGitRepoIssuesToGitea): - After creating an issue, verifies if the closed state was actually applied - If not closed, explicitly PATCHes the issue to close it - Logs warnings for debugging when the fallback is triggered 2. PR Status Verification (mirrorGitRepoPullRequestsToGitea): - Same fix applied to both the enriched and basic issue creation paths - Verifies closed/merged PRs are actually closed in Gitea - Explicit PATCH fallback if the initial creation didn't apply the state 3. Content Validation: - Added warning log when body content appears to be missing after sync - Helps identify repos with content sync issues Root Cause: Gitea's API first creates issues as open, then closes them separately. This two-step process can fail silently due to rate limiting, timeouts, or other errors - leaving issues in an incorrect open state. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 15:55:23 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gitea-mirror#161
No description provided.