Skip to content

docs(claude-md): agents may force-push their own branch, never another's - #1121

Merged
amiddavid merged 2 commits into
mainfrom
docs/force-push-own-branch
Nov 12, 2026
Merged

amiddavid merged 2 commits into
mainfrom
docs/force-push-own-branch

Conversation

@amiddavid

@amiddavid amiddavid commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Agents may force-push their own branch. They never force-push a branch that another writer uses.
Owner rule, David Amid, 2026-11-12.

What changed

  • CLAUDE.md: new section "Branches, worktrees and force-push".
  • RELEASING.md: the "Stacked PRs" steps now merge origin/main into the child and push without force. The rebase --onto and lease steps are gone, so no step force-pushes a branch that another person writes. The conflicts heading says "merge", not "rebase". (Round-1 review, finding 2.)
  • CLAUDE.md: the approval bullet links to "When the head moves after an approval" in RELEASING.md. (Round-1 review, finding 1.)

No behavior change. Data dependence: none.

Add a CLAUDE.md section on worktrees and force-push. Owner rule,
David Amid, 2026-11-12.

Assisted-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 offload-review skill, @amiddavid's session fresh 2 of 2 1 of 2 b1eff34a8bbb approve

Verdict: approve

Findings

None. The PR adds one 16-line section to CLAUDE.md. It changes no code.

Non-blocking

  • CLAUDE.md:75 — "run a new offload-review round" can exceed the 2-round budget in
    CLAUDE.md:111. A force-push after approvals may need a third round, and only the user
    grants one. The rules agree as written (ask the user), but a reader must join two sections
    to see it. No change needed.
  • The new section repeats worktree and lease rules that also live in the machine-local global
    CLAUDE.md. This is fine: the repo file is checked in, so other machines need it too.

What I checked

  • The full diff: git diff e13ba47e..HEAD. One commit, one file, 16 added lines.
  • The commit itself: conventional title, Signed-off-by, Assisted-By: trailer, no
    Co-Authored-By. It follows CLAUDE.md:59.
  • PR body claim "RELEASING.md agrees with the rule": confirmed. RELEASING.md:119 pushes a
    merge of main without force on a branch another session owns. RELEASING.md:173 pushes a
    rebase with an explicit lease. Both match the new bullets.
  • AGENTS.md:61 says "use git push --force-with-lease, never an unrestricted force push".
    It agrees with the new section.
  • The lease claim in CLAUDE.md:73-74: the bare flag needs a remote-tracking ref, which a
    URL remote does not have. The claim is correct.
  • .claude/skills/offload-review/SKILL.md exists, as CLAUDE.md:75 references it.
  • Data dependence and behavior-change rules: not applicable. The PR states "Data dependence:
    none" and the change touches documentation only.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 offload-review skill, @amiddavid's session fresh 1 of 2 1 of 2 b1eff34a8bbb blocking

Verdict: blocking

Findings

  1. CLAUDE.md:75 — the new approval bullet contradicts RELEASING.md's "head moves after an approval" rules

    • What fails: a PR has 2 approvals. The author rebases it onto main with the same patch, then force-pushes. RELEASING.md says: run approval-still-valid.sh; the same patch keeps both approvals valid, with no new round. The new bullet says: after a force-push on an approved PR, run a new offload-review round. An agent now gets two opposite instructions for the same case. The same clash hits the comments-only case, which RELEASING.md also keeps without a new round.
    • Proof: CLAUDE.md:75-76 ("After a force-push on a PR that already has approvals, run a new offload-review round") vs RELEASING.md:139-142 — "A rebase with no other change: run scripts/release/approval-still-valid.sh ... The same patch means only the base moved, so both approvals still count" and "A commit that changes only comments ... No new review round". A rebase and an amend are force-pushes.
    • Fix: narrow the bullet. For example: "After a force-push on an approved PR, apply the head-moved rules in RELEASING.md. Run a new offload-review round only when those rules ask for one."
  2. CLAUDE.md:77 — "never force-push a branch that another writes" forbids RELEASING.md's stacked-PR rebase

    • What fails: the integrator moves a stacked child onto main after the parent merges. RELEASING.md tells them to rebase the child and push with --force-with-lease (line 173). That lease exists to protect "work the author pushed in the meantime" — the author is another writer of the branch. The new bullet forbids exactly this push. So the release procedure and the repo rule conflict. The PR body says RELEASING.md "agrees with the rule"; that check covered only the "pushes without force" lines and missed this one.
    • Proof: RELEASING.md:171-175 — "Rebase only the child's own commits ... Push with a lease, so you never overwrite work the author pushed in the meantime: git push --force-with-lease=..." vs CLAUDE.md:77-78 — "Never force-push a branch that another person or session writes."
    • Fix: pick one. Either name the exception in the bullet ("the stacked-PR rebase in RELEASING.md is the one exception"), or change RELEASING.md to use its merge path (lines 186-190) only.

Non-blocking

  • CLAUDE.md:111 caps offload-review at 2 rounds, and only the user grants more. The new bullet can demand a round after that budget is spent. The cap already tells the agent to ask the user, so this works. A word in the bullet would make it explicit.
  • The new section repeats two rules that also live in the maintainer's own global agent instructions (the explicit-lease form, the .claude/worktrees/<topic> path). Two copies can drift apart. Not a defect today.

What I checked

  • The full diff: one commit, one file, 16 added lines. No code changed.
  • CLAUDE.md in full, before and after the change.
  • RELEASING.md in full, because the PR body claims it agrees with the new rule. I checked every push and approval rule in it against the new bullets. Two disagree (findings 1 and 2).
  • The commit: Signed-off-by: present, Assisted-By: used, no Co-Authored-By: line. Conventional-commit title. DCO passes.
  • The PR body's other claims: docs-only, no behavior change, data dependence none. All correct for this diff.
  • No tests apply: the change touches no code.

Point the approval bullet at the head-moves rules. Use the merge path
for stacked PRs, so no one force-pushes another writer's branch.

Assisted-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Round 1 fixes, one per finding.

  1. CLAUDE.md approval bullet. It now links to "When the head moves after an approval" in RELEASING.md. A new offload-review round runs only when that section asks for one.
  2. Stacked-PR rebase. I took option (a). RELEASING.md "Stacked PRs" now merges origin/main into the child and pushes without force. The rebase and lease steps are gone. The CLAUDE.md rule has no exception.

Non-blocking notes: the 2-round cap in CLAUDE.md still applies, and the bullet's link now makes that join easier to see. I kept the repeated lease and worktree rules on purpose.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 offload-review skill, @amiddavid's session resumed 1 of 2 2 of 2 17a972d36b9a approve

Verdict: approve

Findings

None. Both round-1 findings are fixed. The new commit adds no defect.

Round-1 findings

  1. Approval bullet vs the head-moved rules — fixed. CLAUDE.md:75-77 now links to "When the head moves after an approval" (RELEASING.md:137) and runs a new offload-review round only when that section asks for one. The link anchor matches the heading. A same-patch rebase and a comments-only change keep their approvals, as before. No contradiction is left.
  2. Stacked-PR rebase vs the never-force-push rule — fixed. The author took the second option from round 1: RELEASING.md:165-188 now merges origin/main into the child and pushes the merge commit without force. The rebase and lease steps are gone. The steps are in a working order: retarget (3), merge (4), push (5). The verification line (RELEASING.md:186) is the old merge-path check, unchanged, and stays correct: after the merge, the merge base of origin/main...<head> is origin/main, so the diff shows the child's own change.

Other points

  • The author's reply comment names "option (a)". My round-1 fix options were not lettered. The substance matches the second option (change RELEASING.md to the merge path). Clear enough; no action.
  • Reviewer 2's round-1 review approved with no findings. Its non-blocking notes match mine from round 1 (2-round budget join, rule duplication). Nothing new to check.
  • AGENTS.md:61 still says to rebase and push with --force-with-lease for DCO trailers. That flow runs in a private temp clone on the agent's own branch, with no other writer. It agrees with the new rule.
  • No file in the repo still references the removed rebase steps (sha-you-rebased, rebase --onto of the child).

Non-blocking

  • CLAUDE.md:77 says "run a new offload-review round only when that section asks for one". That section (RELEASING.md:137-143) asks for a re-check of the delta, in its own words, not for an offload-review round by name. A reader must join it with RELEASING.md:316 (reviews run through the offload-review skill). The intent is clear. No change needed.

What I checked

  • Last review: round 1, b1eff34, 2026-11-12T08:02:41Z.
  • New commits read: 1 (17a972d3 "docs: align the force-push rule with RELEASING.md").
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files).
  • New items since my last review: the fix commit 17a972d3 (diff read in full, both files around the changes); the author's reply comment of 2026-11-12T08:04:10Z (both fixes checked against the diff); reviewer 2's round-1 review (read in full, after my round-1 post).
  • The new commit: conventional title, Signed-off-by: present, Assisted-By: used, no Co-Authored-By:. DCO passes.
  • Full PR diff from base: CLAUDE.md +17, RELEASING.md +16/−10. No code changed. Data dependence: none, as the PR body says. No tests apply.
  • Grep of the repo for every remaining force-push mention (CLAUDE.md, RELEASING.md, AGENTS.md): all agree with the new rule.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 offload-review skill, @amiddavid's session resumed 2 of 2 2 of 2 17a972d36b9a blocking

Verdict: blocking

Findings

  1. PR body — it says "RELEASING.md: no change", but commit 17a972d changes RELEASING.md by 16 lines
    • What fails: a reader trusts the body and misses that the release procedure for stacked
      PRs changed from a rebase to a merge. Both round-1 reviews also scoped on this claim.
      The body is the summary of record for the PR.
    • Proof: PR body, "What changed" section: "RELEASING.md: no change. Its 'push without
      force' lines are about branches that others write, so they agree with the rule."
      git diff b1eff34a..17a972d -- RELEASING.md changes 16 lines in the "Stacked PRs"
      section, RELEASING.md:165-188.
    • Fix: edit the body to list the RELEASING.md change. Use
      gh api -X PATCH repos/rossoctl/context-guru/pulls/1121 --input <file>, because
      gh pr edit silently no-ops on this repo.

Non-blocking

  • RELEASING.md:169 — step 1, "Note the parent's head SHA before you merge the parent", is
    now dead. Only the removed git rebase --onto origin/main <old-parent-head> consumed that
    SHA. No later step uses it, and the check at RELEASING.md:186 uses
    git diff origin/main...<head>. Drop step 1, or say why it stays.
  • The author's comment says "I took option (a)" for reviewer 1's finding 2, then describes
    option (b) — changing RELEASING.md to the merge path. The action is right; the label is
    wrong. No change needed. Future readers may trace the wrong option.

Earlier findings

  • Reviewer 1, finding 1 (approval bullet contradicts RELEASING.md): fixed. The bullet at
    CLAUDE.md:75-77 now defers to "When the head moves after an approval". I verified the
    anchor: the heading exists at RELEASING.md:137, so the link resolves. The section keeps
    approvals for a same-patch rebase and comments-only changes, and asks for a re-check only on
    new code or a conflict resolution. The bullet agrees with all three cases now.
  • Reviewer 1, finding 2 (the rule forbids the stacked-PR rebase): fixed. The rebase and
    the lease push are gone from RELEASING.md:172-173. The child now gets a merge of
    origin/main and a push without force. No exception is needed in CLAUDE.md.
  • My round-1 non-blocking notes: the 2-round-cap join is now easier to see through the link;
    the author kept the repeated rules on purpose. Both accepted, nothing more.

What I checked

  • Last review: round 1, b1eff34, 2026-11-12T08:01:50Z.
  • New commits read: 1 — 17a972d "docs: align the force-push rule with RELEASING.md".
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files).
  • New items since my last review: reviewer 1's round-1 review (08:02:41Z), the author's
    comment (08:04:10Z), commit 17a972d. I read each one in full.
  • The new commit in full: git diff b1eff34a..17a972d, both files, plus RELEASING.md:111-190
    around the changes.
  • The new stacked-PR procedure step by step: retarget first, merge origin/main, push without
    force. Each step is consistent with the CLAUDE.md rule, and the old alternate merge path is
    folded in without loss.
  • The commit format: conventional title, Signed-off-by, Assisted-By:. It follows the rules.
  • No code changed, so no tests apply and data dependence stays none.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 offload-review skill, @amiddavid's session resumed 2 of 2 3 of 3 17a972d36b9a approve

Verdict: approve

Findings

None. My round-2 finding is fixed. The head did not move, and the new commit count is zero.

Earlier findings

  • My round-2 finding (PR body said "RELEASING.md: no change"): fixed. The body was edited
    at 2026-11-12T08:08:32Z. It now lists the RELEASING.md change under "What changed": the
    stacked-PR steps merge and push without force, the rebase --onto and lease steps are gone,
    the conflicts heading says "merge". I checked each claim against the diff
    git diff b1eff34a..17a972d. All are accurate. The body also names both round-1 fixes.
  • My round-2 non-blocking notes: not addressed, and they stay non-blocking. The dead step 1 at
    RELEASING.md:169 ("Note the parent's head SHA") still has no consumer. The "option (a)"
    label in the author's comment still names the option not taken. Neither blocks.

Other points

  • Reviewer 1's round-2 review (approve) I read in full. Its two "fixed" verdicts match my own
    checks from round 2: the anchor at RELEASING.md:137 resolves, and the stacked-PR merge
    path has no force-push left. Its non-blocking note on "asks for one" wording matches my own
    reading of RELEASING.md:137-143. Nothing to add.
  • No tests apply: the PR changes two markdown files only. No test results were posted on the
    PR, and none are needed. Live tests stay unapproved, and no code exists to test.

What I checked

  • Last review: round 2, 17a972d, 2026-11-12T08:07:45Z.
  • New commits read: 0. git log --stat 17a972d..HEAD printed nothing; HEAD is still
    17a972d36b9adb74fe0e3ad83522d1a3a5ef1144.
  • Read in full: 4 reviews, 1 comment, 0 inline comments (from the three files).
  • New items since my last review: reviewer 1's round-2 review (08:07:09Z, read in full, it
    posted seconds before mine so I had not seen it); the PR body edit (08:08:32Z, checked
    against the diff). Nothing else changed.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 offload-review skill, @amiddavid's session resumed 1 of 2 3 of 3 17a972d36b9a approve

Verdict: approve

Findings

None. The one new finding since my round-2 review is fixed. The head did not move.

New items since round 2

  1. Reviewer 2, round-2 finding 1 (PR body said "RELEASING.md: no change") — fixed. I checked the finding myself before accepting it: git diff b1eff34a..17a972d -- RELEASING.md does change 16 lines, so the old body misstated the diff. The author then edited the body (PR updated_at 2026-11-12T08:08:32Z, after reviewer 2's review at 08:07:45Z). The new body lists the RELEASING.md change and the CLAUDE.md change, each with its round-1 finding number. I checked every claim in it against the diff. All are accurate.
  2. CI at the head: CodeQL, DCO and analyze all pass. The PR is mergeable.

Reviewer 2's non-blocking notes

  • RELEASING.md:169, step 1 is dead — agree. "Note the parent's head SHA before you merge the parent" had one consumer, the removed git rebase --onto origin/main <old-parent-head> step. No step in the new list uses the SHA, and the check at RELEASING.md:186 uses git diff origin/main...<head>. The step is harmless but serves no purpose. Drop it, or say why it stays. Non-blocking.
  • The "option (a)" label in the author's comment matches the merge-path option in substance, not in label. I noted the same in round 2. No change needed.

What I checked

  • Last review: round 2, 17a972d, 2026-11-12T08:07:09Z.
  • New commits read: 0. Command: git log --stat 17a972d36b9adb74fe0e3ad83522d1a3a5ef1144..HEAD. Output: empty. The head is unchanged, as this round said to expect.
  • Read in full: 4 reviews, 1 comment, 0 inline comments (from the three files).
  • New items since my last review: reviewer 2's round-2 review of 08:07:45Z (read in full, its finding verified and found fixed); the PR body edit of 08:08:32Z (fetched from the API and checked claim by claim against the diff); the CI results at the head.
  • Live tests: not approved, and none apply. The PR changes two markdown files only. No code, no tests to run.
  • Data dependence and behavior change: none, as the PR body says. Docs only.

@amiddavid
amiddavid merged commit 89c98de into main Nov 12, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant