You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
afx cleanup -i <n> / -p bugfix-<n> cannot find a registered bugfix builder (bare id compared against Tower-canonical builder- id) #1799
afx cleanup cannot find a bugfix builder through either of the two forms the afx skill documents for it. Observed today on a finished, registered builder that afx status listed as builder-bugfix-1783:
afx cleanup -i 1783 # [error] Bugfix builder not found for issue #1783
afx cleanup -p bugfix-1783 # [error] Builder not found for project: bugfix-1783
afx cleanup -p builder-bugfix-1783 # [ok] Builder builder-bugfix-1783 cleaned up!
Only the Tower-canonical id, exactly as status prints it, works. The skill and the collision hint in spawn-worktree.ts:566 ("Run: afx cleanup --issue ") both point users at forms that fail.
Root cause
packages/codev/src/agent-farm/commands/cleanup.ts:188-237 does its own lookup against loadState().builders instead of the shared helpers in agent-farm/lib/builder-lookup.ts:
--issue: builds the bare id bugfix-<n> and compares with b.id ===. Stored ids carry the builder- prefix (the Tower role_id space; status.ts:153 prints builder.id unchanged and showed builder-bugfix-1783), so the comparison never matches. The fallback on b.issueNumber did not match either.
--project: b.id === projectId misses for the same reason; the b.name.includes(projectId) fallback also missed.
--task already knows about the prefix (builder-task-<id>), so it is the one form that normalises.
lib/builder-lookup.ts already handles this: findBuilderByIssue falls back to Tower rows and matches -bugfix-(\d+) on role_id; findBuilderById exists for ids. cleanup.ts predates them and was never switched over. This is the bare-id vs Tower-canonical-id seam (same class as the #1563 roster mismatch), not an id-format problem: a numeric id fails identically.
Fix shape (hypothesis)
--issue → findBuilderByIssue(n); --project → findBuilderById(id) with a tail-match (resolveAgentName) so both bugfix-1783 and builder-bugfix-1783 resolve. Remove the hand-rolled equality loops.
Keep the --task path (or route it through the same helper if it can express the lowercase normalisation).
Tests: a registered row with the prefixed id is found by -i <n>, -p <bare id> and -p <prefixed id>; the collision hint in spawn-worktree.ts:566 names a form that works.
PIR #1740 step 4 widens cleanup --issue (drops parseInt at cli.ts:430) and findBuilderByIssue to accept alphanumeric keys. It does not touch the equality miss above because cleanup never calls that helper. Land this first; #1740 then rebases and its widening of the helper covers cleanup for free.
Protocol
BUGFIX. Isolated to one command, shared helpers already exist.
Activity