@@ -365,6 +365,38 @@ minutes apart in writing — which is exactly why the disagreement is worth
365365catching. Two figures for one quantity means at least one is answering a
366366question you are no longer asking.
367367
368+ ### Write the body in its own tool call, after the push
369+
370+ A body that cites a commit can only be written once that commit is on the
371+ remote, and the hash belongs in it by lookup — ` git rev-parse --short HEAD ` or
372+ ` git log -1 --format=%h ` — never typed from memory. A reader who follows a
373+ wrong hash finds nothing, and the claim it supported becomes unverifiable.
374+
375+ That ordering has a second, sharper reason: ** a denied command loses every side
376+ effect it contained.** Bundling the push, a heredoc that writes the body file,
377+ and ` gh pr edit --body-file ` into one shell invocation means a gate that rejects
378+ any part of it rejects all of it — and the parts that already ran do not roll
379+ back. Observed: the push landed, the heredoc never ran because the same call was
380+ rejected for naming a not-yet-pushed hash, and the following command failed with
381+ ` no such file or directory ` — a confusing error two steps downstream of the
382+ actual refusal.
383+
384+ ``` bash
385+ # ✅ Three calls, each with one job
386+ git push
387+ git rev-parse --short HEAD # take the hash from here
388+ # …write body.md…
389+ gh pr edit 123 --body-file body.md
390+
391+ # ❌ One call: the gate rejects the whole thing, the push already happened,
392+ # and the body file that the next step needs was never created
393+ git push && cat > body.md << 'EOF ' … EOF && gh pr edit 123 --body-file body.md
394+ ```
395+
396+ The general rule: never bundle a file write with a push or an API call. Keep
397+ state-changing steps separable, so a refusal costs you the step and not the
398+ scaffolding around it.
399+
368400### When you already have the fix, lead with it
369401
370402Issue templates order evidence before solution — they are written for reports
0 commit comments