Skip to content

fix(taskctl): commitTask uses wrong directory and doesn't verify commit succeeded (#277, #278) #279

@randomm

Description

@randomm

Problem

Two related bugs in commitTask (pulse.ts):

Bug 1 (#277): @ops commits in wrong directory

Session.createNext({ directory: task.worktree }) stores the worktree in the session record but the bash tool ignores it — it always uses Instance.directory (project root) as cwd. The ops prompt says 'Commit all changes in the current directory' but current directory is the main repo, not the worktree.

Bug 2 (#278): No verification that commit succeeded

After @ops session completes, commitTask unconditionally marks task as stage: done. If git reported 'nothing to commit', the task is silently closed with no commit made and all developer work is lost.

Fix

pulse.ts commitTask function only:

  1. Make ops prompt explicit about the worktree path and instruct @ops to use workdir: task.worktree when calling bash tool
  2. After ops session completes, read the final assistant message via MessageV2.stream(opsSession.id) and check for commit success indicators (commit hash) vs failure ('nothing to commit', 'fatal', 'error'). Escalate on failure instead of marking done.

Acceptance Criteria

  • @ops runs git add -A && git commit in the worktree directory (not project root)
  • After adversarial APPROVED, a new commit appears in the worktree branch
  • If git reports 'nothing to commit', task is escalated (not silently closed as done)
  • bun test and bun run typecheck pass

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