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 can't reach orphaned Tower terminals after porch done self-completion (registry-keyed cleanup, no fallback) #783
When a builder runs porch done <id> to mark its protocol complete (BUGFIX, AIR, PIR — any protocol that ends with a porch done rather than awaiting an external signal), the builder is deregistered from afx's project/issue registry as part of completion. Subsequent afx cleanup attempts then fail because cleanup is registry-keyed — both afx cleanup -p <id> and afx cleanup -i <issue> return:
[error] Builder not found for project: <id>
[error] Bugfix builder not found for issue #<issue>
The Tower-level PTY session for the builder is not killed by porch done (Tower's terminal registry is independent of the project/issue registry). It remains visible in afx status as an (active) terminal indefinitely. There is no registry-independent terminal-kill command in afx.
Observed
Sequence on a real BUGFIX builder run that completed cleanly:
Builder ran porch done <id> (BUGFIX protocol-complete on merged PR).
Builder sent the "ready for cleanup" notification.
afx cleanup -p <id> → Builder not found for project: <id> (builder already deregistered).
Manually git worktree remove --force + git branch -D builder/<...> succeeded (those don't go through afx's registry).
afx cleanup -i <issue> -f → Bugfix builder not found for issue #<issue> (same; cleanup still can't find a registry entry).
afx status continued to show the builder's terminal as (active) with no work, no worktree, no branch, no porch state — a dead PTY in Tower with a stale registry entry.
The only afx mechanism that can clear an orphaned Tower terminal is afx tower stop && afx tower start — which kills every other live builder terminal in the session. Unacceptable collateral in any multi-builder workflow.
Impact
Every self-completing builder accumulates a permanent orphan terminal.afx status becomes increasingly noisy with dead entries from past completed work, with no way to distinguish dead from live except by external knowledge.
No clean recovery exists. Killing the underlying PTY process directly bypasses Tower and risks Tower-state inconsistency. Restarting Tower wipes all live work. The user is left with permanent cosmetic noise that compounds across sessions.
Cleanup ordering is fundamentally lossy. A builder that self-completes via porch done is structurally uncleanable via afx the moment the registry entry is dropped — there is no window in which afx cleanup can both find the builder and kill its terminal.
Sibling: #801 (porch approve state-push silently fails after auto-delete on PR merge — builder worktree never sees gate-approved state-sync). Same lifecycle family as this issue — both leave the builder in a stale / unreachable state after a normal completion path.
Sibling: #802 (state-bookkeeping commits accumulate as orphan artifacts on builder branches when not auto-deleted on PR merge). Same afx/porch-lifecycle family — branch persists with dead bookkeeping commits after work is done.
Activity
amrmelsayed commentedon May 21, 2026
Sibling: #801 (porch approve state-push silently fails after auto-delete on PR merge — builder worktree never sees gate-approved state-sync). Same lifecycle family as this issue — both leave the builder in a stale / unreachable state after a normal completion path.
amrmelsayed commentedon May 21, 2026
Sibling: #802 (state-bookkeeping commits accumulate as orphan artifacts on builder branches when not auto-deleted on PR merge). Same afx/porch-lifecycle family — branch persists with dead bookkeeping commits after work is done.