Repository navigation
Description
Reported by the shannon workspace's main architect (Amr-directed forward, 2026-09-01, three-part relay received complete); reviewed and filed by codev:main.
Defect (two coupled failures)
- Transient lookup miss:
afx cleanup -p Nrun SECONDS after a merge fails withBuilder not found for project: N, while the identical command succeeds when run minutes after a merge, and succeeds days later for the originally-failed cases. The row exists the whole time (later runs find it). - Ghost roster rows with no reconciliation: when the operator responds to the spurious failure by cleaning files manually (branch delete etc.), the Tower roster row strands:
afx statuslists the builder asimplementingindefinitely. Two live ghosts persisted ~19h in shannon (builder-air-4673,builder-pir-4645, both merged+cleaned 08-31) until identical re-run commands succeeded days later. Ghost rows actively mislead sibling architects' pre-spawn overlap checks; one lane nearly serialized a spawn against a dead lane.
Verbatim T0 captures (shannon app-architect transcript)
- [C1] 08-31 ~03:55Z, seconds after PR 4674 merge-verify, same compound command:
4674 MERGE VERIFIED / [error] Builder not found for project: 4673 / Deleted branch builder/air-4673 (was 978af194d). - [C2] 08-31 ~04:25Z, after PR 4682:
4682 MERGE VERIFIED / [error] Builder not found for project: 4645 / Deleted branch builder/pir-4645 (was 229a17c05). - Discriminator: same-session cleanups run MINUTES after merges (bugfix-3146, bugfix-3172) succeeded first try. The miss is a short post-merge window.
Source triage (codev:main, leads not conclusions)
The failing check is a plain in-memory find over loaded state (cleanup.ts:219-237: state.builders.find(b => b.id === projectId) with task-id and name-pattern fallbacks before fatal). Nothing in that logic is timing-dependent, so the transient miss almost certainly lives in loadState returning incomplete/empty builders during the post-merge write burst (porch status writes, roster updates hitting global.db at exactly that moment). Candidate mechanisms the implementer should check: a swallowed SQLITE_BUSY/locked read yielding partial state instead of an error; reading through a Tower cache mid-invalidation; or a delete-reinsert window in post-merge row rewriting. The seconds-vs-minutes-vs-days gradient fits a contention window, not data absence. Note C1 failed for 4673 seconds after a DIFFERENT lane's (4674) merge-verify, so the window is workspace-global write activity, not the target lane's own state.
Asks (from the report, endorsed)
- Root-cause the post-merge lookup-miss window. If it is a swallowed busy-read, the fix is a busy timeout/retry plus never returning silently-partial state (a load error must be an error, not an empty list).
- Cleanup failure must not be droppable on the floor, any of: the row reaps automatically when its worktree disappears;
afx statusmarks rows whose worktree is gone as STALE instead ofimplementing;afx cleanupretries the lookup briefly before failing. The status-marking option also fixes the misleading-overlap-check hazard independently of cleanup behavior. - Bundle relation: third integrity defect in the agent-coordination surface, alongside afx send: delivery-side silent truncation of long bodies (head-loss can invert meaning) — needs integrity check before Enter #1567 (delivery truncation) and Mailbox: delivered-message wrappers carry no recipient field — deliveries are not self-attesting (rescoped from refuted misrouting report) #1543 (wrapper attribution), with afx spawn silently attributes the builder to 'main' when CODEV_ARCHITECT_NAME is absent, even inside another architect's session #1406/Tower registry divergence after workspace drop/re-registration: afx cleanup and afx status disagreed about registered builders #1544 (owner misattribution / registry divergence) adjacent. Every one currently forces a behavioral workaround (short bodies, challenge-response, cross-lane overlap confirmation, treat-status-as-advisory). Consider prioritizing the cluster as one workstream.
Interim practice (circulating shannon, sensible until fixed)
Treat afx status rows as advisory; confirm overlap cross-lane before spawning against an apparently-busy lane.
Activity
amrmelsayed commentedon Sep 11, 2026
Two fresh specimens, 2026-09-11, both on the post-#1644 local build: (1)
afx cleanup -i 1637returned 'Bugfix builder not found for issue #1637' while the builder was live and listed inafx status;afx cleanup -p 1637immediately succeeded and did the FULL job (deregistered, worktree removed, local + remote branch deleted). The -i lookup path misses where -p resolves. (2)afx cleanup -p 1563(a PIR lane) reported '[ok] cleaned up!' but only deregistered: the worktree dir, its git-worktree registration, and the local branch all remained (output even printed 'To delete: git branch -d ...' delegating the branch to the human). Same command, two different completion depths depending on lane type — the partial path leaves exactly the orphan-worktree state that afx cleanup then can't touch later (builder no longer registered), forcing manual git worktree remove.amrmelsayed commentedon Sep 15, 2026
Pattern confirmed, 2026-09-15: the cleanup-depth asymmetry is reproducible by lane type.
afx cleanup -p 1677(BUGFIX) did the full job — worktree, git registration, local + remote branch all removed.afx cleanup -p 1668(PIR) reported '[ok] cleaned up!' but only deregistered, exactly like-p 1563(PIR) on 09-11 — dir, worktree registration, and branch all remain. Two PIR specimens + one BUGFIX control on the same build: the PIR path is missing the worktree/branch removal the BUGFIX path performs, and its success message overstates. Manual git worktree remove is then required, which the (deregistered) builder can no longer be targeted for.