fix(bd-9sm): Replace substring matching with NEEDLE event type in persistSession

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 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-03-16 23:56:40 -04:00
parent b0f7c5020e
commit d35c9adcdc

View file

@ -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) {