Repository navigation
feat(merge): quest merge runs the landing check itself - #675
Conversation
Quest-Claim: fa850d9630e94b53
quest merge --land fetches the base and the exact head into a temporary bare repository that borrows the local checkout's objects, and refuses a head on which quest check --no-stubs --base --branch finds anything the base lacks, reading git objects so nothing from the head runs. /quest-merge drops its hand check and keeps only: run a quest the PR cannot modify. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fetch under unique refs it then deletes, so Git negotiates and sends only what the checkout lacks; a shallow or absent checkout uses a scratch bare repository. Count base findings as a multiset, check a head that adopts quests, honor the user's Git network configuration, and keep scratch paths and refs out of refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fetch the base and head SHAs as objects alone, so an interrupted run leaves nothing in the checkout's repository, and use a scratch repository for a checkout this process cannot write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
Important
The landing check's fetch breaks in any checkout that already carries a GitHub extraheader, such as one made by actions/checkout with its default persist-credentials: true. Every quest merge --land there fails with git fetch failed. One inline fix.
Reviewed changes
I reviewed the whole PR at 57a5098: the new landing check, the land() signature change, and the docs that go with them.
landingCheck: fetchesbaseRefOidand the head SHA as objects only. It fetches into the checkout's common git dir, or into a scratch bare repo when the checkout is shallow, read-only, or missing. It then runscheck()on both trees, filters out findings the base already has (as a multiset), and adds thelanded()finding.land(pr, LandRequest, deps): the check runs afterpassing()and before any write.quest land bumppasses a no-op check.landed()options: takes{ branch?, head? }so it can diff two commits in a bare or common git dir.- Docs: README,
quest merge --help, andassets/skills/merge.mddescribe the built-in check in place of the hand procedure. The finished quest file is deleted.
I ran test/landed.test.ts, test/hold.test.ts, and test/land-bump.test.ts locally, and all 119 tests pass.
claude-opus-5-5 | 𝕏
…oken Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed the one commit added since the prior Pullfrog review at 57a5098.
- Extraheader reset in the borrowed fetch:
landingChecknow passes an empty-valuedhttp.https://github.com/.extraheaderentry before the token entry, so a checkout that already sends anAuthorizationheader (for exampleactions/checkoutwithpersist-credentials: true) no longer produces a duplicate-header 400 from GitHub.GIT_CONFIG_COUNTbecomescount + 2and the key and value indexes line up. This resolves the one open thread.
claude-sonnet-5-5 | 𝕏

Finishes quest/m0/token-waste/merge-check.md.
Summary
quest merge --landnow runs whatquest check --no-stubs --base <base> --branch <head branch>checks, on the exact head it is about to queue, and refuses a head with findings (naming each, "fix the PR, then land it again"), before any GitHub write and before a queue build is spent.landingCheck(src/cli/landed.ts): fetches the base's current SHA (baseRefOid) and the exact head SHA from the base repository (which serves fork heads too) into the repository of the checkoutquest mergeruns in. It fetches them as objects only and writes no ref, so Git sends only what is missing and an interrupted run leaves nothing behind. It then reads both trees from git objects. Nothing from the head is checked out or run. With no checkout, a shallow one, or one it cannot write, it uses a scratch bare repository instead and removes it afterward. The fetch uses the user's Git environment (proxies,insteadOf), with the token appended as aGIT_CONFIG_*header in the environment rather than in arguments.landedfinding (the quest branch neither deletes nor edits its quest sinceorigin/<base>). It skips only when neither base nor head hasquest/. Refusals nameorigin/<base>and the head, never the scratch path.land()now takes aLandRequest { sha, method?, direct?, check }struct instead of five positional arguments;quest land bumppasses a no-op check, since its PR is the daemon's own version-file commit.landed()takes{ branch?, head? }so it can diff two commits in a bare repository.assets/skills/merge.mddrops the hand-check paragraph and keeps one line: runquest mergewith aquestthe PR cannot modify.quest merge --helpdescribe the check.Choices made without asking
questolder than the tree's format refuses every PR. (The dev shell's pin does this today: it flags## Scheduledinquest/m0/mistake-audit.mdon every head.)queue-build.yml), as the quest's plan says.Public API
CLI:
quest merge --landgains a refusal (new behavior, no flag changes) and now needs network access to fetch git objects fromgithub.com. No wire impact. Internalland()/landed()signatures changed.Validation
just checkandjust testpass (1274 tests).test/landed.test.tsrun the real fetch path against local repositories: an untouched quest is found; an edit passes; only the committed head counts; a structural finding is reported; a base's own finding is skipped but one more copy of it is not; a head adopting quests is checked; a head with no quests is a finding; a base without quests is skipped; a checkout gets the objects but no refs; shallow and read-only checkouts are left untouched; an unknown head fails loudly and leaves no scratch directory.landingCheckagainst GitHub for open PRs. On #675's claim-only head, it reported the untouched-quest finding; its current head, which deletes the quest, is clean (136 ms). #673, a claim with no files yet, reported the finding (112 ms). #652 came back clean: 120 ms from this checkout, and 770 ms with no checkout (full fetch).git for-each-refwas unchanged afterward.quest --root <head> check --no-stubs --base origin/main --branch <branch>from this checkout) agrees on both feat(gate): admit work through mbx's pool when mbx is installed #673 (finding) and feat(merge): hold a head an unanswered finding or newer maintainer decision signals #652 (24 documents ok).quest merge 675 --land <sha>on the real CLI refused at the earlier draft-ownership check, as before; nothing was queued.Review
Rewritten by
quest reviewafter each round.Head: b6aeb10, named in full once no reviewer reports a finding
Base: origin/main at 696fdf8
Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1d25a-56a7-7472-b476-d8c3e8d065a3, round 2Score: 10/10,
The shallow-checkout failure is fixed, and static review of the changes since the prior head found no new landing blockers; builds and tests were not run as instructed.Rounds: 2; findings 1 (medium 1): fixed 1, refuted 0, open 0
Findings: none
The last round's findings, at 89c9b90:
src/cli/landed.ts:87:Skip shallow checkouts when configuring object alternates;src/cli/landed.ts now checks --is-shallow-repository and fetches independently into a scratch bare repository when the checkout is shallow.Reviewer: opencode, opencode-go/deepseek-v4.1-flash, high effort
Session:
ses_e2da5a2faffeEz2JXpfFPXX64C, round 2Score: 9/10,
All five earlier findings are fixed with code and tests I verified; only two narrow new edges remain, a read-only checkout no longer falling back and refs left behind by an interrupted run, neither of which blocks normal landings.Rounds: 2; findings 7 (medium 1, low 6): fixed 5, refuted 0, open 2
Findings, open until the next round settles them:
src/cli/landed.ts:81:A read-only checkout now fails the landing check instead of falling backsrc/cli/landed.ts:147:An interrupted run leaves quest-merge refs in the user's repositoryThe last round's findings, at 89c9b90:
src/cli/landed.ts:92:Every quest merge --land re-downloads the base branch's full history;`landingCheck` now fetches into the checkout's own repository under `refs/quest-merge/<uuid>/{base,head}` (src/cli/landed.ts:80-81,108-123) so Git advertises the checkout's refs and transfers only missing objects, with the scratch repository reserved for no checkout or a shallow one; the test "fetches into a checkout's repository, leaving none of its refs behind" covers the normal path.src/cli/landed.ts:110:Base-finding filter can hide a newly introduced identical finding;The base findings are now consumed one-for-one with `known.splice` (src/cli/landed.ts:130-135), so a head with one more copy of a base finding than the base reports it, covered by the test "reports one more of a finding the base already has".src/cli/landed.ts:107:A base without quest/ skips the head's structural check too;The early return is now `if (!based && !quests(tip)) return []` and `known` is empty when the base lacks quests (src/cli/landed.ts:124-129), so a head that introduces the quest tree is checked, covered by the test "a head that adopts quests is checked".src/cli/landed.ts:129:Refusals leak the scratch directory and misname the checked ref;`tidy` rewrites the scratch directory, base ref, and head ref in returned findings and in `landed` errors (src/cli/landed.ts:96-102,139-144), and `landed` now names the head ref it was given in its no-merge-base error (src/cli/landed.ts:27-31).src/cli/landed.ts:79:The check's fetch ignores the user's Git network configuration;The fetch now uses `discoveryEnv()` for the user's Git configuration and proxies, appending the token at `GIT_CONFIG_KEY_${count}` after any existing `GIT_CONFIG_COUNT` entries (src/cli/landed.ts:88,106-122).Head 57a5098 fixes both open low findings, so no further round runs: (1) read-only checkout, fixed: whether the checkout's objects directory is writable is decided before fetching (
accessSync), and otherwise a scratch repository is used (test "does not write to a checkout it cannot write"); (2) refs left by an interrupted run, fixed: the check now fetches the base and head SHAs (baseRefOidfrom GitHub) as objects only, writing no ref at all (test "fetches into a checkout's repository, writing none of its refs").Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown effort
🤖 Generated with Claude Code