Skip to content

fix(transport,replication): the #854 review round two (#853) - #859

Merged
emooreatx merged 5 commits into
mainfrom
fix/853-review-round2
Oct 13, 2026
Merged

emooreatx merged 5 commits into
mainfrom
fix/853-review-round2

Conversation

@emooreatx

Copy link
Copy Markdown
Contributor

Follow-up to #854. Codex posted six findings on #854 after its last push and before the merge. All six are fixed here, along with a seventh race that the new witnesses exposed. Each fix has a witness that fails without it.

# Finding Fix Witness
1 A link whose LinkEstablished was dropped is never reaped recover_unknown_link: on the link's next event (LinkIdentified or any frame), it is recorded inbound unless this node dialled it, mirrored, its establishment set to now, its plane classified, and it is counted in recovered_links_total a_link_whose_establish_event_was_lost_is_recovered_and_reaped_854 (test seam drops the next inbound LinkEstablished)
2 Reverse-path Channel sends aren't busy during their await send_channel_marked: an OutboundShipGuard for the whole Channel send (both reverse-path arms, and the scoped lease) a_reply_waiting_on_the_channel_holds_its_link_854
3 The owner-binding link-up stage is never recorded the link-up ok end moves to the sink and fires only for an attributed frame; the carve-out records the stage, then ends the link-up an_unattributed_frame_leaves_the_link_up_for_the_owner_binding_stage_854
4 A stale logged link after a transport change unconditional assignment a_frame_without_a_link_clears_the_logged_link_854
5 Round duration spans an abandoned round responder_round_clock restarts on a new round id the_round_clock_restarts_when_the_responder_rebinds_854
6 Starved-pool WARN misses scoped lanes link_is_pooled checks both pools a_scoped_lane_counts_as_pooled_854
7 A data-plane Started/Progress arriving after its own control-plane completion re-marked the link busy for 30 s concluded_resources memo a_straggler_progress_after_completion_is_recognised_853

How 7 was found: witness (f) failed once in four full-file runs under concurrency. The memo is the most likely cause, but I haven't proven it: after the fix the file went 4 for 4, plus 3 more clean runs before it.

Fail-before: I ran two mutation compiles, A (fixes 1, 3, 5, 7) and B (fixes 2, 4, 6). Under each, exactly the targeted tests failed and nothing else did. The files were restored afterwards and checked with cmp.

Gates:

Gate Result
fmt clean
clippy --all-targets -D warnings, CI's three feature sets pass
Lib filter (incl. inbound_exits) 94 passed, 94 under ffi-uniffi
Six integration files 62 passed
links_ffi + peer_mutation_ffi + witness (ffi-uniffi) 34 passed
Failures 0

recovered_links_total lives in EdgeMetrics only until #848 brings the bundle to main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C5FDihqVKTSXyNYs2CLnrK

Six Codex findings posted on #854 after its last push, plus one race
the witnesses surfaced. Each has a witness that fails without its fix.

1. A link whose LinkEstablished was dropped (control-plane overflow) is
   recovered from its next per-link event (LinkIdentified or any frame):
   recorded inbound unless this node dialled it, mirrored, given `now`
   as its establishment, its plane classified, and counted in
   recovered_links_total. Witness (i)
   a_link_whose_establish_event_was_lost_is_recovered_and_reaped_854
   (test seam: drop the next inbound LinkEstablished).
2. Reverse-path (and scoped) Channel-first sends hold an
   OutboundShipGuard for the whole await (send_channel_marked), so a
   reply waiting on the Channel window is busy to the inbound reaper.
   Witness (j) a_reply_waiting_on_the_channel_holds_its_link_854.
3. The link-up `ok` end moves to the sink and fires only for an
   ATTRIBUTED frame; the owner-binding carve-out records its stage and
   then ends the link-up. Witness
   an_unattributed_frame_leaves_the_link_up_for_the_owner_binding_stage_854.
4. deliver_inbound_framed_on assigns the logged link unconditionally,
   so a non-Reticulum frame clears it. Witness
   a_frame_without_a_link_clears_the_logged_link_854.
5. The responder's round clock restarts when a frame names a new round
   id (responder_round_clock). Witness
   the_round_clock_restarts_when_the_responder_rebinds_854.
6. The starved-pool diagnostic checks both pool families
   (link_is_pooled). Witness a_scoped_lane_counts_as_pooled_854.
7. A data-plane ResourceTransferStarted/Progress arriving after its own
   control-plane completion no longer re-marks the link busy for the
   30 s stall window (concluded_resources memo). Found as a 1-in-4
   flake of witness (f) under full-file concurrency; witness
   a_straggler_progress_after_completion_is_recognised_853.

Fail-before: two mutation compiles (A: 1, 3, 5, 7; B: 2, 4, 6); each
targeted test failed and nothing else did; files restored and
cmp-verified.

Gates: fmt; clippy --all-targets -D warnings on CI's three sets; lib
filtered 819/853/854/link/reap/metrics/observability/inbound_exits/
round_clock 94 passed (94 under ffi-uniffi); 6 integration files 62
passed (inbound_reap_853 also 7 extra full-file runs green);
links_ffi + peer_mutation_ffi + witness under ffi-uniffi 34 passed;
0 failed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5FDihqVKTSXyNYs2CLnrK
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

emooreatx and others added 2 commits October 8, 2026 19:24
…claimed lane (#853)

The burst witness's intermittent `transfer in progress` was a real race
from #532/#819: dial_and_identify published a fresh lane into the pool
UNCLAIMED, and the dialling send claimed it only after the dial task
returned. A concurrent send could take the lane from the pool in that
gap; the dialler's claim then failed, but `send` shipped anyway (the
claim only governed the release), so two Resources rode one link.
v40.0.11's no-trim-on-release made lanes reused far more, exposing it.

- dial_and_identify marks the lane in flight BEFORE publishing it and
  returns a LinkClaim; the in-task reuse branch and the fast path return
  their reserved lane as a LinkClaim too. `send` always holds the claim
  of the lane it ships on; the "claim lost, ship anyway" path is gone.
- A waiter cancelled during the dial (the #568 detach) drops the task's
  output when the task finishes, and the claim's Drop gives the lane
  back. This closes the limitation reported for v40.0.11: a reservation
  leaked when a send was cancelled during the dial wait.
- send_on_scoped_lease (the one remaining claim_link_for_transfer site)
  refuses rather than ships when the claim fails, counted in
  unclaimed_ship_refused_total (unreachable by construction; loud if a
  regression makes it reachable).
- Test seams: delay_resource_ships_for_test (holds a Resource ship
  inside its claim) and delay_dial_publish_for_test (widens the
  publish-to-sender window).

Witnesses:
- a_dialled_lane_is_published_claimed_853 (new): a send fired while a
  dial holds its published lane dials its own; two lanes, both sends
  delivered, no refused ship.
- a_cancelled_send_gives_its_lane_back_853: now deterministic, the ship
  is held 3 s inside its claim and the 200 ms cancel lands mid-ship by
  construction (it was flaky on an idle box: a 2 MiB loopback send
  could finish first).
Fail-before: with the publish left unclaimed, the new witness AND the
burst witness fail (the burst deterministically: `transfer in
progress`); with LinkClaim's Drop a no-op the cancel witness fails.

Gates: fmt; clippy --all-targets -D warnings on CI's three sets; lib
filter 94 passed (94 under ffi-uniffi); link_pool_819 (6) and
inbound_reap_853 (9) green 3x each; realtime_av_spine_e2e,
blob_federation_e2e, family_files_wire_736,
scoped_body_identity_link_718 48 passed; links_ffi + peer_mutation_ffi
+ witness under ffi-uniffi 34 passed; 0 failed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5FDihqVKTSXyNYs2CLnrK
emooreatx added a commit that referenced this pull request Oct 9, 2026
…the two #859 back-ports

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5FDihqVKTSXyNYs2CLnrK
@emooreatx
emooreatx merged commit 7d0d69f into main Oct 13, 2026
8 of 26 checks passed
emooreatx added a commit that referenced this pull request Oct 13, 2026
 (+#845) (#865)

release(40.2.0, B1): land local/main-next — #850, #859, #860, #813, #862 (+#845)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant