diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index 3e3d5c7456687d955ead55ef01e4a5aa207f576d..98a2bb436c01211081c2b3995c8baaa3ec7493ac 100644
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -838,11 +838,11 @@ void AISUpdate::parseEmbeddedCategories(const LLSD& categories)
 
 void AISUpdate::doUpdate()
 {
-	// Do version/descendent accounting.
+	// Do version/descendant accounting.
 	for (std::map<LLUUID,S32>::const_iterator catit = mCatDescendentDeltas.begin();
 		 catit != mCatDescendentDeltas.end(); ++catit)
 	{
-		LL_DEBUGS("Inventory") << "descendent accounting for " << catit->first << LL_ENDL;
+		LL_DEBUGS("Inventory") << "descendant accounting for " << catit->first << LL_ENDL;
 
 		const LLUUID cat_id(catit->first);
 		// Don't account for update if we just created this category.
@@ -859,13 +859,13 @@ void AISUpdate::doUpdate()
 			continue;
 		}
 
-		// If we have a known descendent count, set that now.
+		// If we have a known descendant count, set that now.
 		LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
 		if (cat)
 		{
 			S32 descendent_delta = catit->second;
 			S32 old_count = cat->getDescendentCount();
-			LL_DEBUGS("Inventory") << "Updating descendent count for "
+			LL_DEBUGS("Inventory") << "Updating descendant count for "
 								   << cat->getName() << " " << cat_id
 								   << " with delta " << descendent_delta << " from "
 								   << old_count << " to " << (old_count+descendent_delta) << LL_ENDL;
@@ -896,7 +896,7 @@ void AISUpdate::doUpdate()
 		LLUUID category_id(update_it->first);
 		LLPointer<LLViewerInventoryCategory> new_category = update_it->second;
 		// Since this is a copy of the category *before* the accounting update, above,
-		// we need to transfer back the updated version/descendent count.
+		// we need to transfer back the updated version/descendant count.
 		LLViewerInventoryCategory* curr_cat = gInventory.getCategory(new_category->getUUID());
 		if (!curr_cat)
 		{
@@ -961,7 +961,13 @@ void AISUpdate::doUpdate()
 		{
 			LL_WARNS() << "Possible version mismatch for category " << cat->getName()
 					<< ", viewer version " << cat->getVersion()
-					<< " server version " << version << LL_ENDL;
+					<< " AIS version " << version << " !!!Adjusting local version!!!" <<  LL_ENDL;
+
+            // the AIS version should be considered the true version. Adjust 
+            // our local category model to reflect this version number.  Otherwise 
+            // it becomes possible to get stuck with the viewer being out of 
+            // sync with the inventory system.
+            cat->setVersion(version);
 		}
 	}
 
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index bf181cb4add27777af9581ec8a2e0dd31ba76b4f..f401df09492ec1823d42a7e1d3d727e14f410c0b 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -36,6 +36,8 @@
 #include "llviewerinventory.h"
 #include "llcorehttputil.h"
 
+#define  APPEARANCEBAKE_AS_IN_AIS_QUEUE 1
+
 class LLWearableHoldingPattern;
 class LLInventoryCallback;
 class LLOutfitUnLockTimer;
diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp
index a13e142e161dcd45fdd60c599a7f2f7ab30d0d8a..e2ffdec874a1e377f3245d1caa75cedc9f78fd70 100644
--- a/indra/newview/llavatarrendernotifier.cpp
+++ b/indra/newview/llavatarrendernotifier.cpp
@@ -63,7 +63,7 @@ mLatestAgentComplexity(0),
 mLatestOverLimitPct(0.0f),
 mShowOverLimitAgents(false),
 mNotifyOutfitLoading(false),
-mLastCofVersion(-1),
+mLastCofVersion(LLViewerInventoryCategory::VERSION_UNKNOWN),
 mLastOutfitRezStatus(-1),
 mLastSkeletonSerialNum(-1)
 {
@@ -207,8 +207,9 @@ void LLAvatarRenderNotifier::updateNotificationState()
         mLastSkeletonSerialNum = gAgentAvatarp->mLastSkeletonSerialNum;
     }
     else if (mLastCofVersion >= 0
-        && (mLastCofVersion != gAgentAvatarp->mLastUpdateRequestCOFVersion
-            || mLastSkeletonSerialNum != gAgentAvatarp->mLastSkeletonSerialNum))
+//        && (mLastCofVersion != gAgentAvatarp->mLastUpdateRequestCOFVersion // RIDER: Check this!
+        && (mLastCofVersion != LLAppearanceMgr::instance().getCOFVersion()
+        || mLastSkeletonSerialNum != gAgentAvatarp->mLastSkeletonSerialNum))
     {
         // version mismatch in comparison to previous outfit - outfit changed
         mNotifyOutfitLoading = true;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index b9dd43f0617aa7b0345362b8d25e5fc2684b0d95..2a91d47868101e0a9cb7c36dfc036bc632885c52 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7313,7 +7313,6 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32
 //-----------------------------------------------------------------------------
 void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 {
-    static S32 largestSelfCOFSeen(LLViewerInventoryCategory::VERSION_UNKNOWN);
 	LL_DEBUGS("Avatar") << "starts" << LL_ENDL;
 	
 	bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage");
@@ -7348,6 +7347,36 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 		return;
 	}
 
+    S32 thisAppearanceVersion(contents.mCOFVersion);
+    if (isSelf())
+    {   // In the past this was considered to be the canonical COF version, 
+        // that is no longer the case.  The canonical version is maintained 
+        // by the AIS code and should match the COF version there. Even so,
+        // we must prevent rolling this one backwards backwards or processing 
+        // stale versions.
+
+        S32 aisCOFVersion(LLAppearanceMgr::instance().getCOFVersion());
+
+        LL_INFOS("Avatar") << "handling self appearance message #" << thisAppearanceVersion <<
+            " (highest seen #" << mLastUpdateReceivedCOFVersion <<
+            ") (AISCOF=#" << aisCOFVersion << ")" << LL_ENDL;
+
+        if (mLastUpdateReceivedCOFVersion >= thisAppearanceVersion)
+        {
+            LL_WARNS("Avatar") << "Stale appearance received #" << thisAppearanceVersion <<
+                " attempt to roll back from #" << mLastUpdateReceivedCOFVersion <<
+                "... dropping." << LL_ENDL;
+            return;
+        }
+        if (isEditingAppearance())
+        {
+            LL_DEBUGS("Avatar") << "Editing appearance.  Dropping appearance update." << LL_ENDL;
+            return;
+        }
+
+    }
+
+#if 0
 	S32 this_update_cof_version = contents.mCOFVersion;
 	S32 last_update_request_cof_version = mLastUpdateRequestCOFVersion;
 
@@ -7385,6 +7414,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 		LL_DEBUGS("Avatar") << "ignoring appearance message while in appearance edit" << LL_ENDL;
 		return;
 	}
+#endif
 
 	// SUNSHINE CLEANUP - is this case OK now?
 	S32 num_params = contents.mParamWeights.size();
@@ -7399,13 +7429,16 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 	}
 
 	// No backsies zone - if we get here, the message should be valid and usable, will be processed.
-    LL_INFOS("Avatar") << "Processing appearance message version " << this_update_cof_version << LL_ENDL;
+    LL_INFOS("Avatar") << "Processing appearance message version " << thisAppearanceVersion << LL_ENDL;
 
-	// Note:
-	// RequestAgentUpdateAppearanceResponder::onRequestRequested()
-	// assumes that cof version is only updated with server-bake
-	// appearance messages.
-	mLastUpdateReceivedCOFVersion = this_update_cof_version;
+    if (isSelf())
+    {
+        // Note:
+        // RequestAgentUpdateAppearanceResponder::onRequestRequested()
+        // assumes that cof version is only updated with server-bake
+        // appearance messages.
+        mLastUpdateReceivedCOFVersion = thisAppearanceVersion;
+    }
 		
     if (applyParsedTEMessage(contents.mTEContents) > 0 && isChanged(TEXTURE))
     {