From d35c9adcdccac465bbf4a2b3c264d114b252134a Mon Sep 17 00:00:00 2001 From: jedarden Date: Mon, 16 Mar 2026 23:56:40 -0400 Subject: [PATCH] fix(bd-9sm): Replace substring matching with NEEDLE event type in persistSession MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit persistSession() still used msg.includes('completed'/'finished'/'closed') to find bead completion events. With NEEDLE format, msg is the event type string (e.g. 'bead.completed'), so substring matching can misfire on 'bead.agent_completed'. Match on exact event types 'bead.completed' and 'bead.failed' instead — consistent with the fix already applied to updateWorkerInfo() and trackTaskForHistory() in bd-vqd. Co-Authored-By: Claude Opus 4.6 --- src/store.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/store.ts b/src/store.ts index efb7c46..fa2e634 100644 --- a/src/store.ts +++ b/src/store.ts @@ -262,9 +262,7 @@ export class InMemoryEventStore implements EventStore { // Find the completion event for this bead const completionEvent = this.events.find(e => e.bead === beadId && - (e.msg.toLowerCase().includes('completed') || - e.msg.toLowerCase().includes('finished') || - e.msg.toLowerCase().includes('closed')) + (e.msg === 'bead.completed' || e.msg === 'bead.failed') ); if (completionEvent) {