If a player holding the sprint key and moving forward while attacking an entity, sprinting flags (predicate) & custom:minecraft.sprint_one_cm (scoreboard objective) will not recognize that player is sprinting.
To replicate:
1) Set up a predicate with the "is_sprinting" flag or a scoreboard with the objective "custom:minecraft.sprint_one_cm"and display its status.
(I have set it up so that the predicate spams "yes" if the "is_sprinting" flag is true and "no" otherwise. A scoreboard with the objective "custom:minecraft.sprint_one_cm"
2) Double-tap sprint and punch an entity while moving. Notice that the player stops sprinting and both the scoreboard and predicate reflect that change.
3) Hold the sprint key and punch an entity while moving. Notice that the player stops sprinting, but neither the scoreboard nor predicate reflect that change. {+}This also affects double-tap sprinting with the toggle sprint setting enabled.
Linked issues
Comments

Thank you for your report!
We're actually already tracking this issue in MC-69459, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote or any additional information to the main ticket it would be appreciated.
Please be sure to use the search feature before creating a ticket to see if the issue has already been reported.
Quick Links:
📓 Bug Tracker Guidelines – 🛠 Community Support – 📧 Mojang Support – ✍️ Feedback and Suggestions – 💬 Mojira Discord