code: func (m TaskManager) GetDebugState(c context.Context, ctl task.ControllerReadOnly) (*internal.DebugManagerState, error) {
  	cfg := ctl.Task().(*messages.GitilesTask)
  	g, err := m.getGitilesClient(c, ctl, cfg)
  	if err != nil {
  		return nil, err
  	}
  
  	refs, err := m.fetchRefsState(c, ctl, cfg, g)
  	if err != nil {
  		ctl.DebugLog("Error fetching state of the world: %s", err)
  		return nil, err
  	}
  
  	sortedRefs := func(refs map[string]string) []*pb.DebugState_Ref {
  		keys := make([]string, 0, len(refs))
  		for k := range refs {
  			keys = append(keys, k)
  		}
  		sort.Strings(keys)
  		out := make([]*pb.DebugState_Ref, len(refs))
  		for i, key := range keys {
  			out[i] = &pb.DebugState_Ref{Ref: key, Commit: refs[key]}
  		}
  		return out
  	}
  
  	return &internal.DebugManagerState{
  		GitilesPoller: &pb.DebugState{
  			Known:   sortedRefs(refs.known),
  			Current: sortedRefs(refs.current),
  		},
  	}, nil
  }
docs: // GetDebugState is part of Manager interface.