Repository navigation
Description
What happens
--install asks whether ~/.claude/settings.json is a link once, in planning, and not again when it writes. plan_hook_merge refuses a link there (path_kind, openRepoTools:3180, called from install_commands at :2091). The pair is written last: place_hook_pair (:3529) is the final act of place_skill_and_hook (:3517, called at :2178), after the seventeen commands, the six skill files and the six command files. Nothing in between asks about the link again. Line numbers are at main 33ce26d.
hook_pair_merge, thepresentarm:mode_is 600 "$settings"(:3588), thenchmod 600 "$settings"(:3591).mode_isis afind -maxdepth 0 -perm, which reads a link's own mode, so it says the mode is wrong, andchmodfollows the link and stamps the file at its far end.hook_pair_defer, thepresentarm: the same two calls (:3641,:3644).hook_write_settings:mv -f -- "$hook_tmp" "$settings"(:3558), reached fromhook_pair_merge(:3610) andhook_pair_defer(:3636). A rename replaces a link with the regular file, written from the bytes planning read.wip initreaches the same functions (wip_hook_pair,:4217-4223), with planning and the write in one subshell.
These are the two harms the planning refusal exists for (the comment at :3162-3174, from #44 round 1): a file at the far end re-moded under a line that says "already installed", and a link a person put there swallowed. tests/test_install_skill_and_hook.py:496-544 pins that refusal for both arms, with the link made before the run.
Measured (main 33ce26d, bash 5.2.21, GNU coreutils 9.4; a sandbox HOME, CLAUDE_USER_DIR and TMPDIR; a cp and a cmp first on PATH that, the first time one is handed the last command file (~/.claude/commands/swap.md, or the temporary beside it), move settings.json to a dotfiles path and link it back: after planning, before the pair)
present,settings.jsonat 644 carrying both entries: exit 0 andSessionStart hook: already installed in …/.claude/settings.json (mode restored to 600). The link is intact, and the file at its far end went from 644 to 600 with its bytes unchanged.absent,settings.jsonholding{"theme": "dark"}at 644: exit 0 andSessionStart hook: merged into … (one entry added; written back at mode 600).~/.claude/settings.jsonis now a regular file at 600 holding the theme and the pair. The link is gone, and the file it pointed at is untouched, at 644, and no longer whatclaudereads.
Does #257 change it? No. #257's branch (95ab6c4; issue #257 is still open) closes the same race for the files --install places: its three conditions end && [ ! -L "$target" ] (95ab6c4:openRepoTools:2154, :3496, :3549) and place_by_rename refuses a link at its rename (:2070-2075). This file is merged into, not placed through place_by_rename, so that guard never meets it. plan_hook_merge, place_hook_pair, hook_write_settings, hook_pair_merge, hook_pair_defer, path_kind and mode_is are the same text at 95ab6c4 and 33ce26d, compared function by function. Only their line numbers move: the planning refusal is :3227, the two chmod 600 calls :3642 and :3695, and the mv -f :3609.
Why it matters
Low, and narrow. The window runs from planning to the last write of a run that took about two seconds in the sandbox, and something other than this installer has to make the link in it (a dotfiles manager, a second run, the person). It is the case #44 and #257 close for every other path; this is the one path where the question is still asked once. A lock between two installs (#106) would not stop a link made by something that is not an install.
Suggested fix (nothing here is decided)
- Ask again where each arm acts, with a builtin, as A pipx link that appears between --install's planning and its placement is replaced by a regular file #257 does in
place_by_rename:[ -L "$settings" ]before themode_isandchmodin bothpresentarms, and before themv -finhook_write_settings(after removing the temporary). Refuse in planning's words (the path, what it is, thermthat clears it) and say what is already placed. One helper for the three sites, so they cannot come to three wordings. - Or place the settings through
place_by_rename "$staged" "$settings" 600 …once A pipx link that appears between --install's planning and its placement is replaced by a regular file #257 lands: it carries the late-link refusal and the$PLACINGcleanup. It would also change the temporary's name, addplace_by_rename's owner check and its refusal text, and the twopresentarms would still need their own[ -L ]. - Either way a link made in the instant between the test and the
chmodormvis still followed or replaced: GNUchmodhas no-h, as A pipx link that appears between --install's planning and its placement is replaced by a regular file #257's comment says (95ab6c4:openRepoTools:2143-2153). - A case per arm, shaped like
tests/test_install_skill_and_hook.py:496-544but with the link made after planning: acporcmpstand-in first onPATHthat links the file once it is handed the last command file (A pipx link that appears between --install's planning and its placement is replaced by a regular file #257'smid_runat95ab6c4:tests/test_install_pipx.py:1736is that seam). It should assert exit 2, the link intact, and the far end's mode and bytes unchanged.hook_pair_deferneeds a hook target that does not answerguard.
Not run: the defer arm's two sites (read, not probed); wip init's path; any platform but Linux; a link made by a real second process (the stand-in makes it at one exact step); how likely any real tool is to make one in that window.
See also #332, the temporary the same write leaves behind on a signal.
Found by: the independent check of #257's 95ab6c4 and its squash body (the SHOULD and B.4, 2026-10-23), which read these arms and did not probe them, and the probe above. Filed on Brett Heap's word of 2026-10-23T18:52:34Z, by multiple choice.
Lane: openRepoTools-5
Activity
brettheap commentedon Oct 24, 2026
CLAIMED — lane openRepoTools-5, session 0d83dca2-c18c-4bb0-99ce-896e6cafea02@Eagle, 2026-10-24T14:19:07Z, for #331
Logged in
lanes/log/openRepoTools-5.mdat66e3cc24e907844417eddd75952c62171a8ff7d5.The three reads (lane-collision-protocol Rule 1):
A failed mktemp -d for the workdir ends --install with exit 1 from ev…
The late refusal of a link at settings.json says only what is true in…
The note wip init prints beside a refused hook pair says the refusal …