Skip to content

Resolve the fetched task base by ref - #1394

Merged
mergify[bot] merged 1 commit into
mainfrom
lean178/1370-fetch-explicit-base
Nov 26, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
lean178/1370-fetch-explicit-base

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1370

loopzero start now fetches the configured base into its explicit remote-tracking ref and verifies that ref as a commit. An overlapping fetch of a different branch can change FETCH_HEAD without affecting the task base. The explicit destination also works from a single-branch clone that excludes the base.

The offline regression interleaves a real fetch of a different branch and verifies the task HEAD and recorded base. Both variants failed before the fix. All 34 worktree tests and the full slotted loopzero check passed on e01d259a60fa953815e510be7c14fbcd38a95ff6.


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

Review

  • primary, claude, e01d259, approve

Architecture-Review: unchanged; start still creates its worktree at the fetched configured base.

Co-Authored-By: Codex <noreply@openai.com>
@eowca
eowca marked this pull request as draft November 26, 2026 02:26

@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 e01d259a60fa953815e510be7c14fbcd38a95ff6, 22.5s: approve (0 critical, 0 important, 2 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/worktree.py
base_ref = f"refs/remotes/origin/{base_branch}"
try:
_git(repo_root, "fetch", "--quiet", "origin", f"refs/heads/{base_branch}")
_git(repo_root, "fetch", "--quiet", "origin", f"+refs/heads/{base_branch}:{base_ref}")

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: Fetch still overwrites the shared FETCH_HEAD

start no longer reads FETCH_HEAD, but its fetch still writes it. A user or another tool in the same checkout that runs git fetch X && git merge FETCH_HEAD can therefore have its FETCH_HEAD replaced by loopzero's base fetch, which is the same race in the other direction. candidate.py:358 already passes --no-write-fetch-head. Smallest fix: add --no-write-fetch-head to this fetch so both fetch sites behave the same way. Not blocking.

Comment thread tests/test_worktree.py
invoke = worktree._git
def interleave(path, *args, **kwargs):
result = invoke(path, *args, **kwargs)
if args[0] == "fetch":

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: Interleave hook catches every _git call that starts with fetch

interleave runs the competing fetch after any _git(..., "fetch", ...). Today start makes only one fetch call, so the test is correct. If a second fetch is added later, the hook will quietly fire again. Matching the exact base fetch (for example args[:1] == ("fetch",) and f"refs/heads/main" in args[-1]) or asserting the hook fired exactly once would keep the test aimed at the race it reproduces. I confirmed the test fails on the old code: in both parametrizations side points at the pre-commit_on_origin main, so a FETCH_HEAD-based base would differ from upstream.

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

The full slotted check passed at e01d259, both required hosted checks are green, and the primary review approved this head. Readiness rejects only the missing settings fingerprint from the installed CLI receipt. I am using the owner queue route so Mergify verifies the integration candidate.

@eowca
eowca marked this pull request as ready for review November 26, 2026 02:32
@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 ee4392e at 02:38 UTC

5 min in the queue, 3 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 02:32 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1406
  • ✅ Merged 02:38 · ee4392e · 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
@mergify
mergify Bot merged commit ee4392e into main Nov 26, 2026
16 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1370-fetch-explicit-base branch November 26, 2026 02:38
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.

Keep concurrent starts from using another Git fetch's base commit

1 participant