Skip to content

Fix replay response recording for retry handling#3116

Merged
purerosefallen merged 5 commits into
masterfrom
patch-yrp25
Jun 24, 2026
Merged

Fix replay response recording for retry handling#3116
purerosefallen merged 5 commits into
masterfrom
patch-yrp25

Conversation

@purerosefallen

@purerosefallen purerosefallen commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

solves #3113

Previous issue: replay response recording wrote length and payload directly at each call site, while retry handling did not remove the response that had just been recorded before the engine requested the same response again.

Impact: a replay could keep an extra stale response after MSG_RETRY, causing later replay playback to consume responses out of order. Oversized response payloads could also leave the encoded length and written payload size inconsistent.

Fix: centralize response recording in Replay::WriteResponse, cap recorded payloads to UINT8_MAX, and return the actual encoded byte count. Single and tag duels now remember that byte count and remove the last recorded response when MSG_RETRY occurs before requesting the response again.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the replay response stream format to support response payloads larger than 255 bytes (YRP 2.5) and improves replay integrity by removing responses that are rejected by ocgcore with MSG_RETRY.

Changes:

  • Add YRP 2.5 response segment encoding via Replay::WriteResponse() (u8 length for 1..255, otherwise 0x00 + u16 length), and update the reader to support it.
  • Track the last recorded response size in SingleDuel/TagDuel and roll it back from the replay stream when MSG_RETRY occurs.
  • Switch SingleMode response recording to use the new WriteResponse() helper.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
gframe/tag_duel.h Adds tracking for last recorded replay response size.
gframe/tag_duel.cpp Rolls back the last recorded response on MSG_RETRY; records responses via WriteResponse().
gframe/single_mode.cpp Records responses via WriteResponse() (enables extended lengths).
gframe/single_duel.h Adds tracking for last recorded replay response size.
gframe/single_duel.cpp Rolls back the last recorded response on MSG_RETRY; records responses via WriteResponse().
gframe/replay.h Declares WriteResponse() and RemoveData() APIs.
gframe/replay.cpp Implements YRP 2.5 write/read logic and replay rollback support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gframe/replay.cpp Outdated
@purerosefallen purerosefallen changed the title Add YRP 2.5 response lengths and skip retried responses in replays Skip retried responses in replays Jun 21, 2026
@purerosefallen purerosefallen changed the title Skip retried responses in replays Fix replay response recording for retry handling Jun 21, 2026
@purerosefallen purerosefallen requested a review from salix5 June 21, 2026 14:39
* format

* implement same logic on SingleMode
@purerosefallen purerosefallen merged commit 2321b35 into master Jun 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Security issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replay hallucination via uint8_t response length overflow Invalid client responses that trigger MSG_RETRY can be recorded into replay files

3 participants