Suppose one had an attribute "OBJECTID" on one's arcsde table, and that arcsde was using OBJECTID as an sde-managed rowid column.
When querying this featurecollection for all attributes on each feature, you'll be missing the OBJECTID attribute on your returned feature. It's value will be stuck in the "fid" field, but it'll still be missing from the attribute list on each returned feature.
This causes schema invalidity and some funkiness in geoserver. Attached (one-line) patch fixes this issue by having the featureIdField appear both in the fid field and in the list of output attributes.
Patches for 2.2.x, 2.3.x and trunk (2.4.x) attached.