Repository navigation
Conversation
A pull request can come from a fork. Attach used to require the PR head in the developer's own checkout, so trying a stored review meant checking out untrusted code first. Attach now opens the pass in an empty temp directory with the transcript only. --checkout adds the reviewed commit as a temporary detached worktree with git hooks off.
🤖 AI code reviewDecision: Ready for human review Overall PR risk: Medium. The change modifies how 🔎 Reviewer summaries (4)
No findings. This review is advisory — it never blocks a merge and never auto-approves. |
core.hooksPath did not stop hooks defined in config, and checkout still ran the clone's smudge filters. With git-lfs, a PR's .lfsconfig could make attach send a request to a host the PR picks. Attach now turns off every hook and filter the clone defines, through GIT_CONFIG_* so git in the follow-up session gets the same settings. It removes symlinks that point outside the worktree, checks the archive's head against its tag and --sha, and cleans up on SIGHUP. It removes only its own stale worktrees instead of running a clone-wide prune.
An inherited GIT_DIR made the cleanup delete the git directory of another worktree. Git sets it for an alias that runs inside a linked worktree. GIT_CONFIG_PARAMETERS from `git -c` turned hooks back on. A PR's .gitattributes could still select a diff driver of the clone, a later `git restore` put removed symlinks back, and a SIGKILL left the checkout and the transcript on disk for good. Attach now drops the repository-local git variables, reads no attributes from the PR (GIT_ATTR_SOURCE), and checks symlinks out as plain files (core.symlinks=false). The exit cleanup is registered before the worktree is added and deletes only the entry that names it. Each attach writes its PID, so the next run removes what a killed one left. The fetch leaves FETCH_HEAD alone, attach prints the archive it opens, and the OpenCode follow-up runs with lsp and formatter off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One-sentence pitch
ecr attachno longer needs the PR head in your checkout. The PR code goes on disk only with--checkout.Why
A pull request can come from a fork. Attach used to stop unless your checkout was at the reviewed commit, so you had to check out untrusted code before you could open a stored review. Putting that code on disk should be something you ask for.
--shawas also broken. It changed which archive the lookup found, but the SHA check still compared against yourHEAD, so--sha <other>always failed on a different branch.How
HEAD.--checkoutadds the commit recorded in the archive as a detached worktree in the attach temp directory. When the clone lacks that commit, attach fetches it fromoriginand names the fix if the fetch fails.core.hooksPath=/dev/nullalone did not do that. It does not stop a hook defined in config (hook.<name>.command), and checkout still ran smudge filters. With git-lfs, a PR's.lfsconfigcould make attach send a request to a host the PR picks. Attach now reads the clone'shook.*andfilter.*names and turns each one off, pluscore.fsmonitorand LFS smudge. The settings go inGIT_CONFIG_*, so git in the follow-up session gets them too.headShamatches the head in its tag, and--shawhen given.SIGHUPfrom a closed terminal. After a kill, the next--checkoutremoves only attach's own stale worktrees. It does not run a clone-widegit worktree prune, which would drop your worktree on a drive that is not mounted.--shalimits it to one head, and--runto one workflow run.--runno longer needs--sha. Attach filters tags before it makes oneghcall per release.recordedShaBlocksAttachis gone.sessionPrTagPrefix,releasesForPr,isSessionTagUnder, andsessionTagHeadare new.runAtExittakes ahangupoption.USAGE, README, LLP 0003, and LLP 0007#session-archive describe the new behavior.Test Plan
bun test: 1171 pass.typecheck,lint,fmt:check, and./ref-checkpass.--checkouton a clone that lacks the commit fetches it and leaves the clone'sHEADand files alone. The clone's post-checkout hook does not run.git checkoutin the worktree..lfsconfigpointing at a local URL, and a link to/etc/hosts: no LFS request, no hook, the link was removed, and the worktree and its entry were gone after cleanup.ecr attach --pr 54178 --repo expo/expo --listlisted archives for two heads.--run 45686644170 --listprinted that archive's index.--checkout, and a real terminal close during a session.🤖 Generated with Claude Code