There are two related but not totally inter-dependant issues:
Wire maximum current capability is set by regulations and is based on temperature rise which is a function of energy dissipation per length which is a function of resistance per length which is a function of wire diameter. Other factors which affect allowed regulatory values include sheathing type, application, environment (open air, metal conduit, ...).
Maximum acceptable voltage drop for the load is based on the sum total drop of the circuit components feeding it. An eg 10A load may be fed by a 10A rated conductor until the length of the conductor is such that maximum allowed voltage drop is reached. If you wish to use a longer conductor run you will need a higher rated conductor, say 15A or 20A, not because of conductor current rating per se, but because the heavier conductor allows less total voltage drop.
In your case, as long as total voltage drop on the 10 gauge circuit when fully loaded is below the maximum allowed by regulations, then use of "a few inches" of lighter wire would be acceptable. The voltage drop per length in the lighter conductor will be higher but the additional absolute voltage drop will be minimal.
How light the short length of conductor can be is a matter of regulations and common sense. A few inches of 18 gauge may not burn out even if it is not rated for the current carried, as heat transfer to the device terminals and adjacent thicker conductors may allow lower temperatures than would occur with a longer run. HOWEVER if you have a fire for any reason and investigators determine that you have used an under-rated short link of wire anywhere this may affect insurance payout even if the non-compliant wiring was not the cause.
If the relay is equipped with fixed leads then they are almost certainly rated for the maximum current that the relay can carry. While it is possible to get out of spec equipment, all 'reputable' manufacturers will be well aware of requirements and will meet them. It may well be that the short lengths involved are acceptable for the reasons I mentioned above.
I don't know if your brewery is a home or commercial venture. I also do not know what your local regulations allow wrt wiring of mains powered equipment. It's outside the scope of the question, but you need to be sure that such issues do not affect your insurance coverage - or your chances of needing it.
Using Wikipedia link supplied by alexan_e
Calculated values below are rounded but "=" is used.
For say 1 metre loop-length tail, R = 21 mOhm.
At at say 25A = loss of I^2R = 625 x 0.021 = 13 Watts.
That's non trivial.
Voltage drop = IR = 25 * .021 = 0.5V.
10 gauge = 3.3 mOhm/m
or about 2W dissipation
and 0.1V voltage drop.
So extra voltage drop going from 10 gauge to 18 gauge is not very important but the dissipation is significant. 18 Watts in 1 metre loop = 18 Watts in 500mm 2 conductor linear.
That's 3.6 W in a 100mm = 4 inch tail.
Say 4 Watt is not liable to melt insulation, but it will feel warm.
Worst is that the 18 gauge dissipation is > 25% of its conservative fusing value. That's high. Actual dissipation at fusing is about 16x higher, and that fusing value is a very conservative one from Wikipedia's list of alternatives, but I'd aim for a bigger wire diameter for a tail if possible.