fix(acp): use background context for sink lifetime
Amolith
created
The request context passed to NewSession may be short-lived. The sink
needs to outlive the request to stream updates for the session.
Assisted-by: Claude Opus 4.5 via Crush
@@ -71,7 +71,9 @@ func (a *Agent) NewSession(ctx context.Context, params acp.NewSessionRequest) (a
}
// Create and start the event sink to stream updates to this session.
- sink := NewSink(ctx, a.conn, sess.ID)
+ // Use a background context since the sink needs to outlive the NewSession
+ // request.
+ sink := NewSink(context.Background(), a.conn, sess.ID)
sink.Start(a.app.Messages, a.app.Permissions)
a.sinks.Set(sess.ID, sink)