unstack shows a generic/incorrect error instead of the real API rejection reason
还没有人认领这个 Issue。
评估
调研方向
首先,在包含已合并 pull request 的 stack 上重现 gh stack unstack <number>,并将普通输出与 GH_DEBUG=api 下的输出进行比较。跟踪 unstack 的错误处理以及 REST API 的 422 响应;完成的标准是,非调试输出报告实际的拒绝原因,而不是无关的 queued-for-merge 消息。
由索引模型根据 Issue 内容生成。
描述
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
- Create a stack with
gh stack link(orsubmit), e.g.main <- a <- b <- c <- d <- e. - Merge
aandb(via merge queue or a normal merge — doesn't matter which). - 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/gh-stack 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 1/5 1 小时以内 新手友好度 92/100
-
feature request topic: cli - general
难度 2/5 1-3 小时 新手友好度 68/100
-
feature request topic: auto-merge
难度 2/5 1-3 小时 新手友好度 68/100
-
bug topic: docs
难度 1/5 1 小时以内 新手友好度 68/100
相似的 Issue
-
textual definition
难度 1/5 1 小时以内 新手友好度 90/100
geneontology/go-ontology#32653 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
-
needs design
难度 2/5 1-3 小时 新手友好度 75/100
-
Priority/High ready-for-agent Severity/Major Type/Bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100