Repository navigation
fix(host): wait for the resent line's ok, not the resend-request ack - #16
Merged
Merged
Conversation
In reliable mode Marlin's flush_and_request_resend emits `Resend: N+1` then a trailing `ok` (queue.cpp:275-276) that acks the resend *request*, before the controller processes the resent line. _await_terminal returned that `ok` as the command's terminal ack, returning one ack early on every recovery and desyncing reliable streaming by one command. Swallow the single request-ack `ok` after resending (awaiting_resend_ack) and keep waiting for the resent line's real `ok`. Add a stateful _ResendSim FakeTransport responder (validates N + checksum, emits the real Error/Resend/ok double-terminal) as the regression test — the one content-dependent path from_trace cannot cover. Update the existing retransmit test to include the trailing `ok`. Closes #11.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes the reliable-mode resend desync surfaced by the dialect/mock investigation
(#5 track). Marlin's
flush_and_request_resendemitsResend: N+1then a trailingok(queue.cpp:275-276) that acks the resend request — before the controllerprocesses the resent line.
_await_terminalreturned thatokas the command'sterminal ack, so on every checksum/line-number recovery the host returned one
ack early and desynced reliable streaming by one command (the resent line's real
okwas then misread as the next command's ack).Fix
One flag:
awaiting_resend_ackis set when the host resends onResend:, the nextok(the request ack) is swallowed, and the host keeps waiting for the resentline's real
ok.Test
Adds
_ResendSim— a statefulFakeTransportresponder that validatesN+checksum and emits Marlin's real
Error/Resend/okdouble-terminal. This is theone content-dependent path
from_trace(indexed by write count) structurallycannot cover. Two regression tests: single recovery (off-by-one discriminator is
assert t.read_line() is None) and back-to-back recoveries. The existing retransmittest was corrected to include the trailing
okit previously omitted.Verified the regression test fails without the
host.pychange (leaks a staleok) and passes with it.Review
Adversarial review (APPROVE, no blockers/majors) confirmed against vendored source:
STR_RESENDis emitted only byflush_and_request_resend, which always followswith
STR_OK(so the swallow can never eat a real ack); multi-resend stays boundedby
max_resends; no busy/echo interleaves betweenResend:and itsok; therequest ack is always bare
ok(ADVANCED_OK form only inok_to_send); nonon-reliable/streaming regression.
just check && just testgreen (90 tests, 3.11–3.13). Closes #11.