Attribute variables in callable programs

I’m trying to figure out the scope of attribute variables. The documentation says they can be referenced by closest hit programs. Can they also be referenced by callable programs that are called from closest hit programs?

Also, then, what would happen if the callable program were also sometimes called by a miss program?

“Can they also be referenced by callable programs that are called from closest hit programs?”

Yes, for bound callable programs when called from a scope having access to the attributes.
No, for bindless callable programs because they have only themselves and the context as scope.

That is actually explicitly mentioned inside the OptiX Programming Guide Chapter 4.10.4 Bound versus Bindless Callable Programs.

In the end you can always copy attributes into local variables and use these as function arguments, e.g. as const reference to a structure with the attributes would use the least amount of function arguments.
In my renderers I have a current state, e.g. shading orthonormal-basis, geometry normal, directions, flags, etc. at the PerRayData payload anyway which is converted to world coordinates from the attributes at closest hit invocation and I’m using those instead of the actual object space attributes inside called programs.

“Also, then, what would happen if the callable program were also sometimes called by a miss program?”

One which uses attributes? That won’t work because the miss program has no attributes! There was no intersection calculating them.

Last time I tried calling a bound callable program only used inside closest hit programs from the ray generation domain as well, the OptiX validation failed with some scope mismatch, but the ray generation program is per entry point and not per ray type like the closest hit and miss programs.
So if you have a bound callable program which is not accessing attributes just give it a try.