I've gone over the logic for this. It is quite convoluted, but it does represent explicitly the scenario you've described.
We cache relation settings on the agent side, and invalidate/prune the cache selectively based on hook type and arguments.
It happens that application settings are always pruned indiscriminately when a new context is created, which causes the first fetch to go to the controller.
Because we only invalidate *unit* members at the beginning of a relation_* hook, the cache has the last fetched data in all other hooks types and for exec.
I've gone over the logic for this. It is quite convoluted, but it does represent explicitly the scenario you've described.
We cache relation settings on the agent side, and invalidate/prune the cache selectively based on hook type and arguments.
It happens that application settings are always pruned indiscriminately when a new context is created, which causes the first fetch to go to the controller.
Because we only invalidate *unit* members at the beginning of a relation_* hook, the cache has the last fetched data in all other hooks types and for exec.
I will discuss potential avenues with the team.