Skip to content

Post-task git operations hang on Windows-path directory pollution #6

@stackbilt-admin

Description

@stackbilt-admin

Summary

When a Claude Code agent creates a literal Windows-path directory (e.g. C:\Users\kover\AppData\Local\pnpm\store\v3) inside a Linux worktree, the taskrunner's post-task git ls-files --others --exclude-standard hangs indefinitely scanning the deeply nested directory tree.

Reproduction

  1. Taskrunner launches a Claude Code session in a worktree at /tmp/cc-worktree-{taskId}
  2. The agent runs a command that creates a Windows-style path as a literal Linux directory (e.g. pnpm store path returning C:\Users\... and the agent using it as-is)
  3. Task completes successfully (commit created)
  4. Taskrunner runs git ls-files --others --exclude-standard to check for untracked files
  5. Command hangs — the Windows-path directory contains thousands of files from the pnpm store

Root Cause

The worktree is an isolated git repo with no .gitignore covering Windows-style paths. git ls-files --others walks the entire untracked tree, which in this case includes the full pnpm store.

Impact

  • Task marked as running indefinitely (never transitions to completed/failed)
  • Taskrunner loop blocks on the hung task
  • Branch exists with valid commit but no PR created

Observed Instance

  • Task e586774e (unified credits tests on stackbilt-auth)
  • Worktree: /tmp/cc-worktree-e586774e
  • Polluting directory: C:\Users\kover\AppData\Local\pnpm\store\v3\ (literal backslash-separated path)
  • Manual recovery: killed stuck processes, git push from worktree, manual PR creation

Fix Options

  1. Timeout on git operations: Add timeout 30s prefix to post-task git commands in taskrunner.sh
  2. Worktree .gitignore: Auto-create .gitignore in worktrees that ignores common pollution patterns (C:*, node_modules/, .pnpm-store/)
  3. Skip untracked scan: If the commit exists, just push — untracked files in a worktree don't matter

Recommended: options 1 + 2 together.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions