A Codex RPC can deadlock the reader it waits on
This commit is contained in:
@@ -168,11 +168,20 @@ func (m *Manager) codexItemCompleted(ctx context.Context, l *live, s *codex.Sess
|
||||
if mt.text == "" {
|
||||
return nil
|
||||
}
|
||||
err = s.Steer(ctx, mt.text)
|
||||
reply, err := s.Steer(mt.text)
|
||||
if err != nil {
|
||||
slog.Error("steer mid-turn delivery", "session", l.id, "err", err)
|
||||
m.restoreMidTurn(ctx, l, mt)
|
||||
return nil
|
||||
}
|
||||
go func() {
|
||||
ctx := context.Background()
|
||||
err := reply.Wait(ctx, nil)
|
||||
if err != nil {
|
||||
slog.Error("steer mid-turn delivery", "session", l.id, "err", err)
|
||||
m.restoreMidTurn(ctx, l, mt)
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -258,8 +267,13 @@ func (m *Manager) codexTurnCompleted(ctx context.Context, l *live, s *codex.Sess
|
||||
m.mu.Lock()
|
||||
l.lastText = ""
|
||||
m.mu.Unlock()
|
||||
_, err = s.Send(ctx, proseQuestionNudge)
|
||||
return err
|
||||
go func() {
|
||||
_, err := s.Send(context.Background(), proseQuestionNudge)
|
||||
if err != nil {
|
||||
slog.Error("send prose question nudge", "session", l.id, "err", err)
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
res := endResult{
|
||||
|
||||
@@ -1056,7 +1056,7 @@ func (m *Manager) turnEnded(ctx context.Context, l *live, res endResult) error {
|
||||
go m.advanceStage(l)
|
||||
return nil
|
||||
}
|
||||
m.afterTurn(ctx, l)
|
||||
go m.afterTurn(context.WithoutCancel(ctx), l)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user