Skip to content

Resolve a Leading ~+ Directory Rather Than Failing Closed in the Write Guard #3318

Closed

Description

@ptr727

Problem

Rule 6 of the write guard, the primary-checkout mutation check, now fails closed on a directory the shell reads from its directory stack. The pull request closing #3048 added this for cd - and ~-, which name the previous directory the hook cannot see. The same pattern also matches ~+ and ~+/sub. Those are $PWD, the shell's current directory at that point in the command.

At the start of a command, the hook already knows that directory. So cd ~+/sub && git commit -m x is denied though the guard could resolve it. Where an earlier cd in the same command moved the shell, ~+ follows it, and the hook does not track that. So reading ~+ as the session directory would be wrong there.

This is an over-denial of low likelihood, found by the local review on that pull request. Per that lane's rule, it is filed rather than narrowed in the same pull request.

Reproduction (constructed paths)

Classify cd ~+/sub && git commit -m x with a session directory that is a linked worktree. The guard denies it, naming the directory stack.

Possible Direction

Read a leading ~+ as the session's own directory where no cd precedes it in the command, and keep failing closed otherwise.

🤖 Generated with Claude Code

Activity

  1. added
    bug
    script
    on Oct 21, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.

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

    bugscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions