Ping and traceroute operate similarly to any data or OAM IPv6 packet when expiring (the value in the hop-limit field is equal to or less than 1) at a transit SRv6 node, whether this node is a SID termination or not.
The data path at the ingress network interface where the packet is received extracts the packet to the CPM.
The CPM originates a TTL expiry ICMP reply message Type: "Time Exceeded", Code: "Time to Live exceeded in Transit".
The CPM sends the reply to the SRv6 router whose address is encoded in the SA field of the outer IPv6 header in the received packet. The source address is set to the system IPv6 address if configured or the address of the interface used to forward the packet to the next hop.
When the transport protocol of the traceroute packet is UDP or TCP (as indicated in the traceroute command), the intermediate node copies the leading bytes (up to 128 bytes) of the received packet encapsulation into the reply message payload. This may include the outer IPv6 header and any SRH.
When the hop-limit field value is higher than 1, the packet is processed in the data path similar to how any SRv6 user data packet is processed in the transit router. See the 7750 SR and 7950 XRS Segment Routing and PCE User Guide for further information.