Hi,
Spotted what looks like a copy-paste bug in Epic’s LearningAgentsInteractor.cpp inside SetActionVector:
if (ActionVector.Num() != GetObservationVectorSize())
{
UE_LOG(LogLearning, Error, TEXT("%s: Action Vector size incompatible. Got %i, expected %i."),
*GetName(), ActionVector.Num(), GetActionVectorSize());
return;
}
The condition compares ActionVector.Num() against GetObservationVectorSize(), but the error message logs GetActionVectorSize(), which is what the comparison should be using. Looks like it was copy-pasted from SetObservationVector (a few methods above) and the condition was missed during the rename.
Practical impact:
-
If
ObservationVectorSize == ActionVectorSizeby coincidence, the check passes anyway → nothing visible breaks. -
If the sizes differ (the common case once observations and actions are non-trivial), the function either:
-
rejects a correctly-sized action vector when
ActionVectorSize > ObservationVectorSize, or -
silently accepts a malformed action vector and then
UE::Learning::Array::Copyreads/writes past one of the buffers whenActionVectorSize < ObservationVectorSize.
-
The second case is the dangerous one silent buffer over/under-read on the ActionVectors[AgentId] row. No crash in most builds, just garbage actions getting fed to the policy.
The fix is a one-line change:
if (ActionVector.Num() != GetActionVectorSize())
Easy to repro: register an interactor where observation and action sizes differ, then call SetActionVector with a properly-sized action vector it’ll get rejected.
Worth filing upstream to Epic, and patching locally in the meantime if you’re hitting the asymmetric-size path.
Cheers