Skip to content

--install asks about a link at ~/.claude/settings.json once, in planning: hook_pair_merge and hook_pair_defer chmod through one made since, and hook_write_settings renames over it #331

Open

Description

@brettheap

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, the present arm: mode_is 600 "$settings" (:3588), then chmod 600 "$settings" (:3591). mode_is is a find -maxdepth 0 -perm, which reads a link's own mode, so it says the mode is wrong, and chmod follows the link and stamps the file at its far end.
  • hook_pair_defer, the present arm: the same two calls (:3641, :3644).
  • hook_write_settings: mv -f -- "$hook_tmp" "$settings" (:3558), reached from hook_pair_merge (:3610) and hook_pair_defer (:3636). A rename replaces a link with the regular file, written from the bytes planning read.
  • wip init reaches 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.json at 644 carrying both entries: exit 0 and SessionStart 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.json holding {"theme": "dark"} at 644: exit 0 and SessionStart hook: merged into … (one entry added; written back at mode 600). ~/.claude/settings.json is 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 what claude reads.

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)

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

  1. brettheap commented on Oct 24, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoTools-5, session 0d83dca2-c18c-4bb0-99ce-896e6cafea02@Eagle, 2026-10-24T14:19:07Z, for #331

    Logged in lanes/log/openRepoTools-5.md at 66e3cc24e907844417eddd75952c62171a8ff7d5.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoTools#331:
       none
    2. `gh pr list --repo opensoft/openRepoTools --state all --search "#331"`, kept where the row or its body names `#331`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoTools` branches naming `331` as a whole token:
       none
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions