Explanation

Object capabilities such as magic_session_cap specified in the Lua script are pushed onto the program's initial stack by the loader. They reside in a list of type l4re_env_cap_entry_t, which is defined in l4re/env/env.h as:

L4Re::Env::env()->get_cap() later runs through this list to find the required entries. As we see, there are only 16 characters reserved for the cap entry's name. Longer names get truncated to this length.

Lesson learned

Only use at most 16 characters to name objects that shall appear in your program's initial name space.