fix(worker): eliminate branch UDA — session name now derived from description#341
fix(worker): eliminate branch UDA — session name now derived from description#341birdmanmandbir merged 2 commits intomainfrom
Conversation
…cription Removes the branch UDA from the task lifecycle entirely. The branch UDA was written after spawn via UpdateWorkerMetadata(), causing SessionName() to compute different slugs between spawn time (description-based) and lookup time (branch-based), resulting in 'no worker session assigned' errors. - Remove Branch field from Task struct and UpdateWorkerMetadata function - SessionName() now always derives slug from description (immutable) - GetActiveWorkerTasks() uses spawner.any: filter instead of branch.any: - Remove branch UDA fallback in cmd/pr.go, internal/pr/pr.go, review.go - Fix cleanup guard in pr merge — no longer gated on Branch field - worker/list.go uses WorktreeBranch() for live branch; falls back to generated - TUI task_detail derives display branch from description (display-only) - Remove branch-based fallback path in tui/actions.go resolveWorkDir - Remove unused hookTask.Branch() accessor
PR Review — fix(worker): eliminate branch UDASummaryThis PR fixes the "no worker session assigned" error by removing the race condition between session creation and the branch UDA write. The fix is sound and the implementation is consistent across all call sites. Critical IssuesNone. Important IssuesNone. Suggestions[DRY, low-priority] [Clarity] // display only — falls back to generated name when no live worktree existsStrengths
VERDICT: LGTM |
Triage UpdateFixed
Deferred
|
Summary
SessionName()usedtask.Branch(preferred) ortask.Description(fallback). ThebranchUDA was written after spawn, so lookup time computed a different session name than spawn time → "no worker session assigned" error.branchUDA entirely.SessionName()now always derives the slug fromtask.Description, which is immutable and available at both spawn and lookup time.Changes
internal/taskwarrior/taskwarrior.go— removeBranchfield fromTaskstruct, removeUpdateWorkerMetadata, fixSessionName()to always use descriptioninternal/taskwarrior/queries.go— replacebranch.any:withspawner.any:inGetActiveWorkerTasksinternal/worker/spawn.go— removeUpdateWorkerMetadatacall (no longer writes branch UDA at spawn)cmd/pr.go,internal/pr/pr.go,internal/review/review.go— removetask.Branchfallbacks, useWorktreeBranch()exclusivelycmd/pr.gomerge — fix cleanup guard that was gated onctx.Task.Branch != ""(would have silently skipped cleanup after this change)internal/worker/list.go— useWorktreeBranch()for live branch display; fall back toGenerateBranch()if worktree goneinternal/tui/task_detail.go— derive display branch from description (display-only, no I/O needed)internal/tui/actions.go— remove branch-based fallback path inresolveWorkDirinternal/worker/hook.go— remove unusedhookTask.Branch()accessorTest plan
make cipassesttal task advance <uuid>spawns worker — verify nobranch:UDA written (task <uuid> export | jq .branchreturns null)ttal open session <uuid>attaches successfully after spawnttal worker listshows correct session namesttal pr mergetriggers cleanup (no longer blocked by missing branch field)