Subprocesses/chains do not know their chain number. See pm.sampling.parallel.py where the object receiving parameters from the ProcessAdapter on the main process through a pipe does not receive chain numbers.
Only with the PopulationStepper this information ends up in the child process.
However, all steppers are instantiated once in the main process and duplicated for the chains. The step method API does not specify that chain numbers are ever relevant for a stepper, and chain numbers are never passed to a logp function either.
Maybe if you describe what you’re trying to achieve, and why you want to use chain numbers we can can help you to find less hackish solutions?