Files
TrochtaOndrej df0baeff36 feat: initial commit — global Claude Code config
Tracked: CLAUDE.md, agents, skills, settings, memory.
Ephemeral data (sessions, history, telemetry, tasks) excluded via .gitignore.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 14:32:21 +01:00

2.1 KiB

Parallel Tasks — Bugs & Fixes (2026-03-18)

Bug 1: Race condition in mergeTaskToDev (CRITICAL — DATA LOSS)

  • Fixed in: commit c2a2901 on dev
  • File: src/git/WorktreeManager.ts
  • Root cause: Multiple parallel tasks finishing at same time all call mergeTaskToDev() which does git checkout dev + git merge + git push — but concurrent checkouts corrupt working dir
  • Fix: Async function with per-tabRoot mutex lock (Promise chain). Push verification before worktree/branch cleanup.
  • Evidence: 3 tasks completed ($1.82-$2.43 each) but code lost — git reflog showed only checkout: moving from dev to dev with no merge commits

Bug 2: Session key collision for parallel worktree tasks

  • Fixed in: commit c2a2901 on dev
  • File: src/sessions/SessionManager.ts
  • Root cause: Session key was always projectId — when multiple tasks share same projectId, each new session kills the previous via killSession(ctx, projectId)
  • Fix: sessionKey = (useWorktree && taskId) ? taskId : projectId — worktree tasks use taskId as key

Bug 3: task:archive only accepted finished tasks

  • Fixed in: commit c2a2901 on dev
  • File: src/socket/TaskSocketHandlers.ts
  • Fix: Archive now accepts finished, stopped, failed statuses

Bug 4: pushRemote not configured

  • Fixed in: commit c2a2901 on dev
  • File: config.json
  • Root cause: No pushRemote field, defaulting to origin (GitHub) instead of gitea
  • Fix: Added "pushRemote": "gitea" to config.json

Bug 5: isTabBusy blocks parallel worktree tasks

  • Fixed in: commit c2a2901 on dev
  • File: src/socket/TaskSocketHandlers.ts
  • Root cause: task:run handler checks isTabBusy() and returns queue-blocked even for worktree tasks that can run independently
  • Fix: Added && !useWorktree condition to bypass check for worktree tasks

Key Lesson

  • Paralelní tasky s worktree MUSÍ mít:
    1. Unikátní session key (taskId, ne projectId)
    2. Serializované merge operace (mutex per tabRoot)
    3. Push verification před smazáním worktree/branch
    4. Správný pushRemote (gitea, ne origin)