Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

unstack shows a generic/incorrect error instead of the real API rejection reason

未關閉
#372 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
67/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
github, go
領域
api, cli

研究方向

首先,在包含已合併 pull request 的 stack 上重現 gh stack unstack <number>,並將一般輸出與 GH_DEBUG=api 下的輸出進行比較。追蹤 unstack 的錯誤處理以及 REST API 的 422 回應;完成的標準是,非除錯輸出報告實際的拒絕原因,而不是無關的 queued-for-merge 訊息。

由索引模型根據 Issue 內容生成。

描述

bug topic: stack management

Summary

gh stack unstack <number> fails on a stack containing merged PRs, but the plain (non-debug) error message names an unrelated cause. The actual server-side reason is only visible with GH_DEBUG=api.

Repro

  1. Create a stack with gh stack link (or submit), e.g. main <- a <- b <- c <- d <- e.
  2. Merge a and b (via merge queue or a normal merge — doesn't matter which).
  3. Run gh stack unstack <number> on that stack.

Actual

⚠ Some pull requests are queued for merge or have auto-merge enabled and remain stacked on GitHub
The stack was left in place — local tracking is unchanged

I verified via gh api graphql that none of the stack's PRs had autoMergeRequest set or a mergeQueueEntry — so the stated reason doesn't match reality.

Running the identical command with GH_DEBUG=api gh stack unstack <number> shows the real HTTP exchange:

POST /repos/{owner}/{repo}/stacks/{id}/unstack
< HTTP/2.0 422 Unprocessable Entity
{
  "message": "Pull requests #.. , #.. cannot be removed from this stack",
  "documentation_url": "https://docs.github.com/rest/pulls/stacks#remove-pull-requests-from-a-pull-request-stack",
  "status": "422"
}

Interestingly, in the GH_DEBUG=api run the CLI's own final stderr line correctly echoed this specific message (✗ Unstacking not allowed: Pull requests #.., #.. cannot be removed from this stack) — a materially different, and accurate, explanation compared to the generic message shown without debug logging.

Expected

The non-debug error message should reflect the actual REST API rejection (a stack can't be unstacked once any of its PRs have merged), not a generic, unrelated "queued for merge / auto-merge enabled" message.

Environment

gh-stack version 0.0.8, installed via gh extension install github/gh-stack.

主要語言
Go
星號
1.5k
分支
73
平均合併
1 天 8 小時
30 天內合併 PR
7

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/gh-stack 的其他 Issue

查看 github/gh-stack 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。