Skip to content

fix(taskctl): developer-pipeline starts in main worktree instead of assigned worktree #383

@randomm

Description

@randomm

Critical Bug

Developer-pipeline agent launches in the main project directory instead of its assigned worktree directory, requiring manual navigation via pwd and cd.

Evidence

From the taskctl pipeline run on issue #272:

Developer reported:

# Verify working directory matches expected path
$ pwd
/Users/janni/projects/opencode  // ← WRONG - this is main project!

Expected: /Users/janni/projects/opencode/.worktrees/add-error-history-field-to-pipeline-state-types-and-write-tests

The developer had to manually detect the mismatch and navigate to the correct directory.

Root Cause

Despite fix #379 (session.directory in messages), the developer session initialization still sets the working directory to the main project instead of the worktree.

Likely locations:

  • packages/opencode/src/tasks/pulse-scheduler.ts - spawnDeveloper() session creation
  • packages/opencode/src/session/prompt.ts - session.directory usage for initial working directory
  • Developer context setup in pipeline agent spawning

Impact

  • Developer wastes tokens on manual directory detection and navigation
  • Risk of operating in wrong directory if developer skips validation
  • Breaks the autonomous pipeline flow

Quality Gates

  • Test: developer-pipeline session starts in worktree directory
  • Test: pwd in developer session returns worktree path, not main project

Acceptance Criteria

  • Developer session launches directly in worktree directory
  • No manual pwd/cd navigation needed
  • Developer sees: pwd/path/.worktrees/task-name immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions