Bug: Task Master doesn't traverse parent directories from subdirectories #12

Closed
opened 2025-10-14 15:38:12 -06:00 by navan · 0 comments
Owner

Originally created by @bjcoombs on 10/13/2025

Bug Description

When running task-master commands from a subdirectory, Task Master does not traverse upward to find a parent .taskmaster directory. Instead, it falls back to the current working directory and may create a new .taskmaster directory in the subdirectory.

Steps to Reproduce

  1. Initialize Task Master in a project root directory:

    cd /path/to/project
    task-master init
    
  2. Navigate to a subdirectory:

    cd subdirectory
    
  3. Run any task-master command:

    task-master list
    

Expected Behavior

Task Master should traverse upward from the subdirectory to find the parent .taskmaster directory and use the parent project's configuration.

Actual Behavior

Task Master uses the current working directory (the subdirectory) and shows:

Listing tasks from: /path/to/project/subdirectory/.taskmaster/tasks/tasks.json
⚠ No tasks found matching the criteria.

Impact

This prevents Task Master from being used effectively in:

  • Multi-repo monorepo setups where a global Task Master configuration coordinates work across multiple repositories
  • Projects with deep directory structures where developers may run commands from various subdirectories
  • Any workflow where commands are executed from within nested directories

Environment

  • Task Master version: 0.28.0 (latest)
  • Platform: macOS/Linux
  • Shell: Any

Root Cause

The findProjectRoot() function in src/utils/path-utils.js has the upward traversal logic implemented, but it could be improved with:

  1. Better error handling for permission errors during directory traversal
  2. Improved safety checks for filesystem root detection
  3. Enhanced project marker prioritization (Task Master-specific markers first)
  4. Expanded project marker list for better cross-platform compatibility

Proposed Solution

I have created a fix that enhances the findProjectRoot() function with:

  • Added try-catch around fs.existsSync() to handle permission errors gracefully
  • Added safety check to detect when path.dirname() returns the same path (filesystem root reached)
  • Reordered project markers to prioritize Task Master-specific markers
  • Expanded marker list to include more project types (Rust, Go, Python, Ruby, PHP)
  • Improved code documentation

A PR with the fix and comprehensive unit tests is ready for review.

*Originally created by @bjcoombs on 10/13/2025* ## Bug Description When running `task-master` commands from a subdirectory, Task Master does not traverse upward to find a parent `.taskmaster` directory. Instead, it falls back to the current working directory and may create a new `.taskmaster` directory in the subdirectory. ## Steps to Reproduce 1. Initialize Task Master in a project root directory: ```bash cd /path/to/project task-master init ``` 2. Navigate to a subdirectory: ```bash cd subdirectory ``` 3. Run any task-master command: ```bash task-master list ``` ## Expected Behavior Task Master should traverse upward from the subdirectory to find the parent `.taskmaster` directory and use the parent project's configuration. ## Actual Behavior Task Master uses the current working directory (the subdirectory) and shows: ``` Listing tasks from: /path/to/project/subdirectory/.taskmaster/tasks/tasks.json ⚠ No tasks found matching the criteria. ``` ## Impact This prevents Task Master from being used effectively in: - Multi-repo monorepo setups where a global Task Master configuration coordinates work across multiple repositories - Projects with deep directory structures where developers may run commands from various subdirectories - Any workflow where commands are executed from within nested directories ## Environment - Task Master version: 0.28.0 (latest) - Platform: macOS/Linux - Shell: Any ## Root Cause The `findProjectRoot()` function in `src/utils/path-utils.js` has the upward traversal logic implemented, but it could be improved with: 1. Better error handling for permission errors during directory traversal 2. Improved safety checks for filesystem root detection 3. Enhanced project marker prioritization (Task Master-specific markers first) 4. Expanded project marker list for better cross-platform compatibility ## Proposed Solution I have created a fix that enhances the `findProjectRoot()` function with: - Added try-catch around `fs.existsSync()` to handle permission errors gracefully - Added safety check to detect when `path.dirname()` returns the same path (filesystem root reached) - Reordered project markers to prioritize Task Master-specific markers - Expanded marker list to include more project types (Rust, Go, Python, Ruby, PHP) - Improved code documentation A PR with the fix and comprehensive unit tests is ready for review.
Sign in to join this conversation.
No labels
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:installation
area:installation
area:installation
area:installation
area:installation
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:vscode-extension
area:vscode-extension
area:vscode-extension
area:vscode-extension
area:vscode-extension
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
help wanted
help wanted
help wanted
help wanted
help wanted
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
integration request
integration request
integration request
integration request
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
low-priority
low-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
provider:anthropic
provider:anthropic
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:gemini-cli
provider:openai
provider:perplexity
question
question
question
question
question
question
question
question
question
question
question
question
question
question
refactor
refactor
wontfix
wontfix
wontfix
wontfix
wontfix
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github/claude-task-master#12
No description provided.