Agent startup holds the manager's global lock

This commit is contained in:
Ian Gulliver
2026-10-16 12:56:53 -07:00
parent 3da0394116
commit be4b4dda0d
5 changed files with 125 additions and 20 deletions
+4 -4
View File
@@ -281,8 +281,8 @@ func (m *Manager) newItem(l *live, id, thread string, kind api.InboxItemKind, pa
}
func (m *Manager) Deliver(ctx context.Context, sessionID string) error {
m.deliverMu.Lock()
defer m.deliverMu.Unlock()
unlock := m.lockDelivery(sessionID)
defer unlock()
sess, err := m.store.GetSession(ctx, sessionID)
if err != nil {
@@ -356,8 +356,8 @@ func (m *Manager) deliverMidTurn(ctx context.Context, l *live) string {
return m.recordQueued(ctx, l, msgs)
}
m.deliverMu.Lock()
defer m.deliverMu.Unlock()
unlock := m.lockDelivery(l.id)
defer unlock()
discard, err := m.store.GetDiscard(ctx, l.taskID)
if err != nil {