fix: normalize Forgejo PR/issue state to uppercase

Forgejo REST API returns state as lowercase ("closed"/"open") but
branch.ts compares against GraphQL-style uppercase ("CLOSED"/"MERGED").
This caused @claude on closed/merged PRs to take the open-PR checkout
path, failing with "fatal: invalid reference: refs/pull/N/head".

Normalize state to uppercase in the Forgejo data fetcher, matching the
existing pattern used for review state (line 153).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vlad MocanuandClaude Opus 4.6 committed 2026-02-26 21:19:53 +02:00
1 parent 2e1165ed90
commit 29a1032aa6
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -300,7 +300,7 @@ export async function fetchForgejoData({
lastEditedAt: undefined,
additions: pr.additions,
deletions: pr.deletions,
state: pr.state,
state: pr.state.toUpperCase(), // Normalize to uppercase (Forgejo REST returns "closed"/"open", branch.ts expects "CLOSED"/"MERGED")
labels: {
nodes: (pr.labels ?? []).map((l) => ({
name: typeof l === "string" ? l : (l.name ?? ""),
@@ -352,7 +352,7 @@ export async function fetchForgejoData({
createdAt: issue.created_at,
updatedAt: issue.updated_at,
lastEditedAt: undefined,
state: issue.state ?? "open",
state: (issue.state ?? "open").toUpperCase(), // Normalize to uppercase for consistency with GraphQL conventions
labels: {
nodes: (issue.labels ?? []).map((l) => ({
name: typeof l === "string" ? l : (l.name ?? ""),