Skip to content

Stale directory lock not released after session stops (blocks subsequent launches) #190

Description

@doink-kindo

Bug Report

Session: edfb39e1 (stopped within ~4min of launch)
Symptom: After session edfb39e1 stopped, agentctl still reports its directory as 'in use', blocking new launches for different worktrees with the same error:

Directory in use by session edfb39e1. Use --force to override.

Worktrees affected (different from edfb39e1's worktree ~/code/mono):

  • ~/code/mono-doink-eng-8991-filter-agent-runs-by-status
  • ~/code/mono-auto-ENG-10035

Steps to reproduce:

  1. Launch claude-code agent via patrol-launch-ci-fix.sh → session edfb39e1, CWD ~/code/mono
  2. Session stops quickly (< 4 min)
  3. Attempt to launch another agent in a different worktree under ~/code/mono-*
  4. Error: 'Directory in use by session edfb39e1'

Expected: After session stops, the directory lock should be released.
Actual: Lock persists even after session is stopped; agentctl stop edfb39e1 --force exits 1 without releasing the lock.

Likely cause: The directory lock may be on the parent ~/code/mono directory (prefix match?) rather than the exact worktree, causing all ~/code/mono-* paths to be blocked.

Workaround: None found. --force on patrol-launch-ci-fix.sh did not help.

Discovered during patrol run on 2026-06-23T07:02 UTC.

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