Skip to content

Bind PR publication to its repository and task history - #1619

Merged
mergify[bot] merged 1 commit into
mainfrom
lean178/1535-1536-bind-pr-push
Nov 26, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
lean178/1535-1536-bind-pr-push

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Bind PR publication to its repository and task history

Context and goal

  • Goal: PR publication preserves unrelated repository refs and PR commits the task has never incorporated.
  • Problem: Publication used origin even when its push URL disagreed with GitHub lookup, and a fetched object could admit a non-fast-forward update.
  • Context: Git reports effective push URLs after applying its remote configuration. The task branch's reflog records prior branch tips for deliberate rewrites.

Closes #1535
Closes #1536

Acceptance

  • A mismatched effective push URL leaves both repositories unchanged.
  • A commit fetched by another checkout cannot authorize a rewrite. Deliberate rewrites from task history still use the existing lease.

Base

main @ 0b74780
Base: 0b74780

Validation

Recorded for 9527586085d0

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

  • primary, claude, 9527586, approve

Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

loopzero primary review by claude on 9527586085d0355fa0f7bc2901c495f094df8082, 40.7s: approve (0 critical, 0 important, 1 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

Comment thread src/loopzero/cli.py
force_lease = not _is_ancestor(wt, pr.head_sha, head)
if force_lease:
previous_heads = _git(wt, "reflog", "show", "--format=%H", f"refs/heads/{branch}").splitlines()
if not any(_is_ancestor(wt, pr.head_sha, previous) for previous in previous_heads):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Reflog ancestry check starts one git process per reflog entry

any(_is_ancestor(wt, pr.head_sha, previous) for previous in previous_heads) runs a separate git merge-base --is-ancestor for each reflog entry. A long-lived task branch can have hundreds of entries. When the PR head is missing from all of them (the rejection path), every entry is checked before the error appears, which costs one fork/exec plus one history walk per entry. The result is still correct. If this gets slow, a single git call can do the same check: pass the reflog tips to git rev-list with --stdin/--no-walk and see whether pr.head_sha is reachable, or use git merge-base --is-ancestor only on a deduplicated list, since repeated amends often produce duplicate tips. This isn't blocking.

@eowca
eowca marked this pull request as ready for review November 26, 2026 07:44
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 71ec302 at 07:51 UTC

7 min in the queue, 4 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 07:44 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1668
  • ✅ Merged 07:51 · 71ec302 · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 71ec302 into main Nov 26, 2026
18 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1535-1536-bind-pr-push branch November 26, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Require task-branch evidence before automatically rewriting a PR head Verify that PR publication pushes to the configured repository

1 participant