gh stack submit falsely reports stack recreation when no replacement stack is persisted
还没有人认领这个 Issue。
评估
调研方向
从 gh stack submit 流程开始,使用针对 stack 和一个开放 PR 的未缓存 gh api 检查来重现报告的状态。跟踪 stack 的重新创建过程,包括远程持久化和本地 .git/gh-stack 更新。完成的标准是失败时返回非零值,而只有在验证替换后的 stack 以及预期的 PR 成员关系之后才打印成功信息。
由索引模型根据 Issue 内容生成。
描述
Summary
gh stack submit reports that a modified stack was successfully recreated on GitHub, but no replacement stack exists afterward.
Branches and PR bases are pushed successfully. Open PRs become unstacked, local metadata retains the old closed stack ID, and the command still exits with success output.
Environment
gh version 2.97.0gh stack version 0.1.0- macOS 26.6
- Repository has GitHub Stacks enabled
Setup
Existing remote stack:
- One merged bottom PR
- Multiple open PRs
- One closed PR in the middle
Locally:
- Check out remote stack.
- Run
gh stack modify. - Drop the closed middle PR.
- Resolve cascading rebase conflicts.
- Run
gh stack submit.
Actual output
Found the stack on GitHub — updating it to match your local stack
Merged PRs have left the stack on GitHub, so it wasn't updated — your unmerged PRs were pushed and re-based onto the trunk
✓ Stack recreated on GitHub to match local state
✓ Pushed and synced 47 branches
Actual remote state
The branches were pushed, but no replacement stack was created.
Repeated uncached API checks showed:
gh api -H 'Cache-Control: no-cache' \
repos/OWNER/REPO/pulls/OPEN_PR \
--jq '.stack'
Result:
null
Listing repository stacks showed only the old closed stacks:
gh api -H 'Cache-Control: no-cache' \
'repos/OWNER/REPO/stacks?per_page=100'
The old stack remained closed with only its merged PR. No new stack number appeared.
This was checked three times over 12 seconds. Direct PR membership and the stack list remained unchanged.
Local .git/gh-stack still referenced the old closed stack number and ID.
Expected behavior
One of:
- A replacement remote stack is persisted and local metadata is updated to its new number and ID.
- Stack creation failure is reported with a non-zero exit code.
The command must not print:
✓ Stack recreated on GitHub to match local state
unless the remote stack exists and its PR membership has been verified.
Impact
- User believes stack recreation succeeded.
- GitHub UI contains no open stack.
- Every open PR has
stack: null. - Local metadata points to a closed historical stack.
- Subsequent
checkout,sync, andmodifyoperations begin from inconsistent state.
Suggested safeguard
After creating or recreating the stack:
- Read the returned stack ID and number.
- Query the stack or one member PR.
- Verify expected membership.
- Only then persist local metadata and print success.
If verification fails, retain recovery state and return an error.
- 主要语言
- 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
-
area/dev-productivity area/disaster-recovery area/ipcei kind/enhancement
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 1/5 1 小时以内 新手友好度 85/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
kind/bug status/0-triage
难度 2/5 1-3 小时 新手友好度 75/100
-
🤔 refinement needed
难度 2/5 1-3 小时 新手友好度 75/100
equinor/radix-operator#1979 ·