Skip to content

The bot-social merge line squashes when the brief asks for a merge commit, and merges onto a base the tip never saw #3111

Open

Description

@Birfy

Three bot-social merges today went through wf-9fddf24a with an explicit "use the merge method, produce a two-parent merge commit, do not squash" in the brief. One obeyed, two squashed.

Observed (all read from api.github.com, 2026-11-16 04:27Z - 05:52Z)

PR commits brief asked result parents
#780 1 merge commit, no squash single-parent squash f40210cbd42a (message = PR title) 1
#782 2 merge commit, no squash merge commit b186fec4a8cb "Merge pull request #782 from HugoXK/..." 2
#784 1 merge commit, no squash single-parent squash dd1bc1cb b550 "fix(face-rooms): refuse a stopped seat at the start door (#784)" 1

So the method is not chosen from the brief: with one commit it squashed, with two it merged. Nothing in the brief differed.

Why it costs something

What would close it

  1. The merge line passes merge_method: "merge" when the brief asks for a merge commit, and refuses to merge instead of silently squashing.
  2. When pulls/<n>.base.sha is not the current master head, run POST /pulls/<n>/update-branch first and wait for the new tip to go green, so the reviewed tip is the merged tree.
  3. If a squash is genuinely wanted, the brief says so and the comment records the method.

No code changed in this issue; it records a behaviour of the merge line seen on live merges.

Written-by: Chief

Activity

  1. Birfy commented on Nov 16, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Chief(2026-11-16T05:56Z)

    收口方式:workflow 定义改不了,把方法纪律写进每份合并 brief。

    1) 端点探测(05:55Z 复测):flybot/workflow/save、workflow/update、workflow/definition、workflow/get 全部返回 Unknown FlyBot endpoint workflow/<x>,只有 assign、state 可用。所以没法在合并线节点里加“合前/合后方法断言”,只能从派活侧写死。

    2) 不是仓库设置的问题(05:54Z 读 /repos/Birfy/bot-social):allow_merge_commit=true、allow_squash_merge=true、allow_rebase_merge=true。三次合并里 #782 拿到了双父 merge commit,#780/#784 变单父 —— 说明差别在调用侧,不在仓库强制。

    3) 事实对照(05:54Z 读 /commits/<sha>)

    • #780 → f40210cbd4,parents 1 个(636be6045d),消息为 PR 标题 + Fixes #779,没有 (#780)。
    • #782 → b186fec4a8,parents 2 个(f40210cbd4、235038cb85),消息 Merge pull request #782 from …。
    • #784 → dd1bc1cbb5,parents 1 个(b186fec4a8),消息 fix(face-rooms): refuse a stopped seat at the start door (#784)。

    4) brief 侧纪律(模板:/data/dsh/bot/workspace/bd1330/templates/bs_merge_brief.md,自本轮起每份合并 brief 照抄):

    • 合并只走 REST PUT /pulls/<n>/merge,body 必须显式 {"merge_method":"merge", …};禁止 gh pr merge(会吃默认值)。
    • 合前核 base.sha 是否等于本次读到的 master sha;不等就先 POST /pulls/<n>/update-branch,等新 tip 双绿再合 —— 这条直接堵住 #784 那种“审过的 tree ≠ 合入的 tree”。
    • 合后立刻读 merge commit 的 parents:必须 2 个且 parents[1] = 该 PR tip;单父即判定 squash,不回滚、不重做、不 rewrite master,在 PR 上写明偏差并在收尾报里列出。
    • 串行:每合一张重新读 master sha,作为下一张的基准。
    • 真要 squash 必须 brief 明示 merge_method:"squash" 并在评论里写理由。

    5) 仍未覆盖的部分:若节点再次无视 brief,我只在合并落地后才看得到(workflow 不能在合前拦截)。要根治得在 workflow 节点里加“合后自查 parents”这一步;那需要能编辑 workflow 定义 —— 要么你在 UI 上把模板第 2 节贴进节点 prompt,要么给我一个可写 workflow 定义的端点。

    模板文件:/data/dsh/bot/workspace/bd1330/templates/bs_merge_brief.md(含每次填空用的检查清单与事故对照)。

  2. Birfy commented on Nov 16, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Chief(2026-11-16T07:50Z)

    新数据点(bot-social #791,2026-11-16T07:41Z):brief 第 2 步明确写了“base 漂移先 POST /pulls/791/update-branch,等 NEW_TIP 双绿再合”,实际执行仍然跳过了 update-branch,直接把 tip 1dbdcf47de 合到当时的 master 6a8450499b 上(merge commit 8706824f53,双父)。

    这次没造成问题:/compare/8c35f72e99...6a8450499b 的全部差异只有 1 个测试文件(test/a_stopped_bot_is_not_shared_with_a_friend.test.ts +136,来自 #789),生产代码零差异。但机制上说明:brief 里写“先 update-branch”和写“用 merge_method=merge”一样,节点会按自己的路径走,派活侧的文字约束不是硬保证。

    到目前为止的偏差统计(bot-social 合并线,2026-11-16):#780 squash、#784 squash + base 漂移、#786 合规、#788 合规、#789 合规、#791 base 漂移未 update-branch。方法纪律在新模板下已经连续三张守住;base 漂移这一步在 #791 失效。

    下一步(等我下次动 workflow 或你有空改节点时):把“base.sha != master 就 update-branch,否则不许 merge”做成节点 prompt 里的显式判断,而不是 brief 里的一行要求。在那之前,我每份 brief 仍写死这条,并在合后自己核 /compare 差异,把“漂移的是不是只有测试/文档”作为放行依据记在 PR 上。

  3. added
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Nov 20, 2026
  4. Birfy commented on Nov 20, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Triage

    状态:H(要人拍板)。
    卡在判据 1:合并线的 merge method 与 base 漂移只能由 workflow 节点 prompt 硬约束,workflow/save 等端点不可用(Chief 2026-11-16T05:55Z 复测),brief 里的文字不是硬保证。
    缺的:节点 prompt 里「base.sha != master 就 update-branch,否则不许 merge」这一条落地,或对这条偏差的明确放行。
    能给的:Chief(下次动 workflow 时)或 owner 改节点。
    不重开调研;事实与统计见本单两条 Written-by: Chief 评论。

  5. Birfy commented on Nov 20, 2026

    @Birfy
    CollaboratorAuthor

    已落地在节点定义里(硬规则),等下一次真实合并验证

    Written-by: Chief / At: 2026-11-20T18:54Z

    根因在节点 prompt 里写死的那一行,不在 brief:wf-9fddf24a 的 mergea/mergeb 第 5 步原本固定 PUT /pulls/<n>/merge,body 是 {"merge_method":"squash",...},所以 brief 写「merge commit、不要 squash」也照样 squash;base 漂移同理——节点流程里没有 update-branch 这一步。

    今天 18:52Z 我用 workflow graph 接口整体替换了 wf-9fddf24a 的节点定义(同 id、同名称、同四条边、stepTimeout 45 不变),只改 mergea / mergeb / report 三条:

    1. 方法只由 brief 决定:brief 说 merge commit / 不要 squash / 两父提交 → merge_method: "merge";明说 squash → "squash";没写 → "merge"(默认保住被审的 tip sha)。不许自行改成 squash,拿不准就按 merge;结果行必须写 method=<merge|squash>。
    2. base 漂移硬规则:合并前读 pulls/<n>.base.sha 与 master 头,两者不同 → 先 POST /repos/Birfy/bot-social/pulls/<n>/update-branch,等新 head.sha 上 Node 20 / Node 22 双绿且 head.sha 稳定再合;拿不到双绿就不合,原因写 base-drift:<old8>-><new8> 未双绿。绝不在漂移时直接合。
    3. report 新增核对:对每个 merge_commit_sha 数 parents 个数——报 merge 却只有 1 个父提交、或报 squash 却有 2 个父,都单独报异常。

    还没验证

    bot-social 现在 0 张开放 PR,这条改动只能在下一次真实合并上验证。验收标准:那一次 report 里每个已合 PR 都带 method=、parents 核对无异常、master 新增提交数 == 已合并数。验证通过前本单不关。

    补充更正:2026-11-16 我写的「workflow 定义改不了」只对 workflow/save|update|definition 那几个端点成立;graph 级接口可用,所以能改。

  6. removed
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Nov 20, 2026
  7. Birfy commented on Nov 20, 2026

    @Birfy
    CollaboratorAuthor

    空跑自检通过(18:57Z),仍等真实合并验收

    Written-by: Chief / At: 2026-11-20T19:01Z

    • 派 wf-9fddf24a 空跑:task bs-smoke-3111,run run-5bba1984,18:56:38Z 起、18:57:27Z 完,4 步全过(approve → mergea ‖ mergeb → report)。bot-social 本轮开放 PR = 0、开放 issue = 0。
    • brief 明写只做连通性自检、只允许 GET。节点实际输出:approve 无 PR 可放行;mergea (无分配);mergeb #none | skipped (assigned to mergea);report 已合并 0 / 未合并 0,master 新头 bc19497e,新增提交 0 == 已合并 0,parents 无核对对象,base-drift 出现 0 次,全程无 POST/PUT/PATCH/DELETE。
    • 结论:18:52Z 替换后的图能加载、四条边与节点顺序正常;但两条硬规则本身(method 只由 brief 定、base 漂移必须 update-branch 且新 tip 双绿)和 report 的 parents 核对,仍要下一次真实合并才算验收。
    • 验收标准不变:那一次 report 里每个已合 PR 都带 method=、parents 核对无异常、master 新增提交数 == 已合并数。不满足就重开本单。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions