Skip to content

afx cleanup can't reach orphaned Tower terminals after porch done self-completion (registry-keyed cleanup, no fallback) #783

@amrmelsayed

Description

@amrmelsayed

Problem

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:

  1. Builder ran porch done <id> (BUGFIX protocol-complete on merged PR).
  2. Builder sent the "ready for cleanup" notification.
  3. afx cleanup -p <id>Builder not found for project: <id> (builder already deregistered).
  4. Manually git worktree remove --force + git branch -D builder/<...> succeeded (those don't go through afx's registry).
  5. afx cleanup -i <issue> -fBugfix builder not found for issue #<issue> (same; cleanup still can't find a registry entry).
  6. 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.

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions