[gym] How to design "truncated" for a custom env

I am thinking about how to properly make use of the “truncated” state which was introduced in late gym releases, but is in fully functional use for gymnasium. In particular, I see the chance to use it in action-masked environments. Usually it is the point that after one action has been taken, it cannot be taken another time in same episode. Does it make sense to develop step() method to flag trunacted in such cases?

No, the truncated flag is meant for cases where the environment is stopped early due to e.g. hitting a user-defined limit on the length of the episodes, but the environment itself did not terminate. It is unrelated to action masking, settingtruncated=True would be incorrect for the use case you mentioned. I would refer to the gymnasium docs on action masking instead.

Also, you may want to redirect Gymnasium environment questions to the Gymnasium github issues or their discord server.

Thank you @Rohan138 for bringing more clarity to that point. Indeed the Gymnasium discussion forums will also be helpful, nevertheless, in this ray forum I try to reach the group of people who are also using RLlib in particular.