Skip to content

afx: task builders cannot be resumed or recovered after their session dies #1422

Description

@amrmelsayed

A --task builder whose PTY/shellper dies (e.g. across a Tower restart) has no supported path back to a live, Tower-managed session. Hit in production 2026-08-12 with a live lane blocked at its pr gate awaiting CI fixes.

Three paths all fail, one shared root cause — nothing maps an existing task id back to its worktree:

  1. afx spawn --resume: the positional identifier only accepts issue-style ids, so both the builder id and the worktree name are rejected as 'invalid issue identifier'. Even via --task ... --resume, spawnTask calls generateShortId() unconditionally (spawn.ts:502-506), computes a fresh task-<newId> worktree name, and validateResumeWorktree then fails on a path that never existed. There is no way to pass the existing task id in.
  2. afx workspace recover: derives the worktree path from the porch project id, which for task builders doesn't match the .builders/task-<shortId> directory → skipped as 'worktree missing' (both the original doubled id and a re-minted porch-native id miss).
  3. afx spawn --task ... --branch <existing>: spawnTask never reads options.branch (only spawnSpec at spawn.ts:380 and spawnIssueDrivenBuilder at spawn.ts:741 honor it), so it silently creates a new branch instead of continuing the existing one.

spawnWorktree has the same unconditional-generateShortId defect on its resume path (spawn.ts:659).

Wanted: a resume path keyed by builder id or worktree name (e.g. afx spawn task-NHnJ --resume or afx spawn --task-id <shortId> --resume) that reuses the existing worktree/branch and the harness conversation-resume machinery, and a workspace recover worktree-resolution that matches task builders. Related known gap: afx spawn --task minting porch-incompatible ids.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/towerArea: Tower server / agent farm CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions