@@ -46,7 +46,7 @@ var defaultStreamConfig = p2ptypes.StreamConfig{
4646
4747type launcher struct {
4848 services.StateMachine
49- lggr logger.SugaredLogger
49+ lggr logger.Logger
5050 myPeerID p2ptypes.PeerID
5151 peerWrapper p2ptypes.PeerWrapper
5252 dispatcher remotetypes.Dispatcher
@@ -106,7 +106,7 @@ func NewLauncher(
106106 return nil , fmt .Errorf ("failed to create launcher metrics: %w" , err )
107107 }
108108 return & launcher {
109- lggr : logger .Sugared ( lggr ). Named ("CapabilitiesLauncher" ),
109+ lggr : logger .Named (lggr , "CapabilitiesLauncher" ),
110110 peerWrapper : peerWrapper ,
111111 dispatcher : dispatcher ,
112112 cachedShims : cachedShims {
@@ -342,12 +342,9 @@ func (w *launcher) OnNewRegistry(ctx context.Context, localRegistry *registrysyn
342342 for family := range myDONFamiliesSet {
343343 myDONFamilies = append (myDONFamilies , family )
344344 }
345- w .lggr .Debugw ("Found my DON families" , "count" , len (myDONFamilies ))
346- w .lggr .Tracew ("My DON families" , "myDONFamilies" , myDONFamilies )
347- w .lggr .Debugw ("Found my workflow DONs" , "count" , len (myWorkflowDONs ))
348- w .lggr .Tracew ("My workflow DONs" , "myWorkflowDONs" , myWorkflowDONs )
349- w .lggr .Debugw ("Found all remote workflow DONs" , "count" , len (remoteWorkflowDONs ))
350- w .lggr .Tracew ("All remote workflow DONs" , "remoteWorkflowDONs" , remoteWorkflowDONs )
345+ w .lggr .Debugw ("Found my DON families" , "count" , len (myDONFamilies ), "myDONFamilies" , myDONFamilies )
346+ w .lggr .Debugw ("Found my workflow DONs" , "count" , len (myWorkflowDONs ), "myWorkflowDONs" , myWorkflowDONs )
347+ w .lggr .Debugw ("Found all remote workflow DONs" , "count" , len (remoteWorkflowDONs ), "remoteWorkflowDONs" , remoteWorkflowDONs )
351348
352349 // Capability DONs (with IsPublic = true) the current node is a part of.
353350 // These need server-side shims to expose my own capabilities externally.
@@ -362,18 +359,14 @@ func (w *launcher) OnNewRegistry(ctx context.Context, localRegistry *registrysyn
362359 }
363360 }
364361 }
365- w .lggr .Debugw ("Found my capability DONs" , "count" , len (myCapabilityDONs ))
366- w .lggr .Tracew ("My capability DONs" , "myCapabilityDONs" , myCapabilityDONs )
367- w .lggr .Debugw ("Found all remote capability DONs" , "count" , len (remoteCapabilityDONs ))
368- w .lggr .Tracew ("All remote capability DONs" , "remoteCapabilityDONs" , remoteCapabilityDONs )
362+ w .lggr .Debugw ("Found my capability DONs" , "count" , len (myCapabilityDONs ), "myCapabilityDONs" , myCapabilityDONs )
363+ w .lggr .Debugw ("Found all remote capability DONs" , "count" , len (remoteCapabilityDONs ), "remoteCapabilityDONs" , remoteCapabilityDONs )
369364
370365 if len (myDONFamilies ) > 0 {
371366 remoteWorkflowDONs = filterDONsByFamilies (remoteWorkflowDONs , myDONFamilies )
372367 remoteCapabilityDONs = filterDONsByFamilies (remoteCapabilityDONs , myDONFamilies )
373- w .lggr .Debugw ("Filtered remote workflow DONs to my families" , "count" , len (remoteWorkflowDONs ))
374- w .lggr .Tracew ("Filtered remote workflow DONs to my families" , "remoteWorkflowDONs" , remoteWorkflowDONs )
375- w .lggr .Debugw ("Filtered remote capability DONs to my families" , "count" , len (remoteCapabilityDONs ))
376- w .lggr .Tracew ("Filtered remote capability DONs to my families" , "remoteCapabilityDONs" , remoteCapabilityDONs )
368+ w .lggr .Debugw ("Filtered remote workflow DONs to my families" , "count" , len (remoteWorkflowDONs ), "remoteWorkflowDONs" , remoteWorkflowDONs )
369+ w .lggr .Debugw ("Filtered remote capability DONs to my families" , "count" , len (remoteCapabilityDONs ), "remoteCapabilityDONs" , remoteCapabilityDONs )
377370 } else {
378371 // legacy / Keystone setting
379372 w .lggr .Debug ("My node doesn't belong to any DON families. No filtering will be applied." )
@@ -408,8 +401,23 @@ func (w *launcher) OnNewRegistry(ctx context.Context, localRegistry *registrysyn
408401
409402 belongsToACapabilityDON := len (myCapabilityDONs ) > 0
410403 if belongsToACapabilityDON {
404+ // Include both remote workflow DONs and the node's own workflow DONs.
405+ // In single-DON topologies (e.g. local CRE), the same DON is both a
406+ // workflow DON and a capability DON, so remoteWorkflowDONs is empty.
407+ // Without including myWorkflowDONs, capabilities fail to serve with
408+ // "empty workflowDONs provided".
409+ allWorkflowDONs := make ([]registrysyncer.DON , 0 , len (remoteWorkflowDONs )+ len (myWorkflowDONs ))
410+ allWorkflowDONs = append (allWorkflowDONs , remoteWorkflowDONs ... )
411+ allWorkflowDONs = append (allWorkflowDONs , myWorkflowDONs ... )
411412 for _ , myDON := range myCapabilityDONs {
412- w .serveCapabilities (ctx , w .myPeerID , myDON , localRegistry , remoteWorkflowDONs )
413+ w .serveCapabilities (ctx , w .myPeerID , myDON , localRegistry , allWorkflowDONs )
414+
415+ // Capability DONs also need remote capabilities (e.g. relay DON
416+ // needs vault for secret fetching). Without this, only workflow
417+ // DONs discover cross-DON capabilities.
418+ for _ , rcd := range remoteCapabilityDONs {
419+ w .addRemoteCapabilities (ctx , myDON , rcd , localRegistry )
420+ }
413421 }
414422 }
415423
@@ -425,7 +433,7 @@ func (w *launcher) OnNewRegistry(ctx context.Context, localRegistry *registrysyn
425433 }
426434 if w .don2donSharedPeer != nil {
427435 donPairs := w .donPairsToUpdate (w .myPeerID , localRegistry )
428- err := w .don2donSharedPeer .UpdateConnectionsByDONs (ctx , donPairs , w . p2pStreamConfig )
436+ err := w .don2donSharedPeer .UpdateConnectionsByDONs (ctx , donPairs , defaultStreamConfig )
429437 if err != nil {
430438 return fmt .Errorf ("failed to update peer connections: %w" , err )
431439 }
0 commit comments