Skip to content

fix: keep install locks outside the repository (0.4.1) - #244

Merged
jothimani-rajendran merged 2 commits into
mainfrom
fix/install-lock-outside-repo
Nov 2, 2026
Merged

jothimani-rajendran merged 2 commits into
mainfrom
fix/install-lock-outside-repo

Conversation

@jothimani-rajendran

Copy link
Copy Markdown
Collaborator

What

install_atomic.locked(path) held its lock on <config>.lock, created beside the config and never removed, so every install or chock sync left an untracked file next to each hook config (found by catalog#319: ?? .claude/settings.json.lock).

The lock file now lives in a per-user directory, named by the sha256 of the config's realpath:

  • POSIX: $XDG_CACHE_HOME/agentseam/locks or ~/.cache/agentseam/locks
  • Windows: %LOCALAPPDATA%\agentseam\locks
  • fallback if that cannot be created: tempfile.gettempdir()/agentseam-locks-<uid or username>

Directory created 0o700; lock file opened with O_NOFOLLOW where available; a lock directory that is a symlink or not owned by the user is refused (POSIX). The locked() contract is unchanged.

Version

0.4.1 in __init__.py, pyproject.toml, CITATION.cff, docs/assets/social-preview.svg; ## [0.4.1] changelog section (Fixed).

Tests

tests/test_install_lock.py (matched by the Windows leg's tests/test_install*.py): lock path is the realpath sha256, directory is 0o700, an install leaves only settings.json beside the config, git status --porcelain is empty after installing into a committed config, symlinked/foreign-owned lock dir refused, planted symlink at the lock file not followed, temp fallback. Existing concurrency tests pass.

Local: full suite 2956 passed, 5 skipped; ruff check . clean.


Generated by Claude Code

locked(path) held its advisory lock on <config>.lock, created beside the
config and never removed, so every install left an untracked file in the
user's repo. The lock file now lives in a per-user directory, named by the
sha256 of the config's realpath, created 0o700, opened with O_NOFOLLOW,
and refused when the directory is a symlink or not owned by the user.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
r+b writes at offset 0, inside the byte another holder has locked, so a
second installer got PermissionError; msvcrt can lock past EOF, so no write
is needed. makedirs can also raise PermissionError when another thread is
creating the same directory.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
@jothimani-rajendran
jothimani-rajendran marked this pull request as ready for review November 2, 2026 21:50
@jothimani-rajendran
jothimani-rajendran merged commit 17dd700 into main Nov 2, 2026
17 checks passed
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.

1 participant