Repository navigation
Leave the server that replaced a following one running - #7226
Merged
Merged
Conversation
After a Leaf update that moves the page protocol, a page server from the old copy asks the new copy to take it over (`server _follow`). If another start, such as a checkout's `leaf server start`, put its own server on the page before the follow ran, the follow still renewed the page first. The renewal's restart then stopped that replacement server. On a page no live session held, a session server stayed down, so the user's open tab lost its server until something started one again. Otherwise the server came back under the follow's Leaf instead of the one that had started it. The follow compared server ids only after the renewal, and the renewal's stop checks only the claim, which both servers share. `follow_copy` now passes the renewal a condition, `no_other_server`: no server but the one that asked serves the page. `renew_layer` and `renew_held` take it as `still`, so the renewal asks it with each of its readings, the last two under the page lock before the restart and under the transaction after it. A page no server serves still passes, since the renewal's own restart stops the server that asked. What is left open is the moment between the locked reading and the restart's stop, the same one the follow's own restart leaves after its last check. A test serves an unclaimed page at an older protocol under one server and follows another; before this change the follow restarted the server in place. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 26, 2026
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.
After a Leaf update that moves the page protocol, a page server from the old copy asks the new copy to take it over (
leaf server _follow), which renews the page and restarts its server. If another start, such as a checkout'sleaf server start, had put its own server on the page in between, the renewal's restart stopped that replacement: on a page no live session held, the session server stayed down and the open tab lost its server; otherwise the server came back under the follow's Leaf instead of the one that started it.follow_copychecked which server was running only after the renewal.follow_copynow passes the renewal a condition, that no server but the one that asked serves the page, andrenew_layerandrenew_heldask it with each reading they already take again under the page lock and transaction (still). A page no server serves still passes, since the renewal's own restart stops the asking server before its last reading. One window remains, between the locked reading and the restart's stop, the same one the follow's own restart already accepts after its last check; closing it would need the stop itself to compare server ids.Codex found this while reviewing #7218, which moved
follow_copyfromhostingtovendoring; the bug predates the move.Tests:
test_a_stale_follow_leaves_the_server_that_took_its_place, which fails without the fix;test_server_lifetime,test_revendoring, and the renewal and follow cases oftest_hooksandtest_interact_layer;lint-importsand pre-commit.