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 上。

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