Repository navigation
P5 O10: the endpoint follows a recovery whose first state is a sibling of its head - #317
Merged
Merged
Conversation
…ibling of its head, reading the hub again from under the recovery's base (a sibling with no recovery behind it still reads fork) The hub sync read `?since=<head>` only, so a recovery's first state at or below the head's version (the hub never had the head: an admin delivered it straight to the machines) never reached `#rewind`, and the hub's head was judged against the endpoint's alone, as a fork. `sync` now reads the chain again from `fromVersion - 1` of the lowest transition that passes `verifyRewind` against the head (O8's `rereadFrom`, src/main/org/held.ts), so the page carries the base too once it has aged out of the window. What is accepted is unchanged: `#adopt` and `#rewind` verify as before, and commit the head and the window in one rename. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…fter the head rather than replace it, and a transition nothing is signed under costs its base and first state, not the history reviewer-high's P2: the re-read from a recovery's base replaced the read after the head, so a genuine transition that passed `verifyRewind` but authorized nothing the hub served, read again past MAX_PAGES, dropped the forward successors already fetched, and every later sync repeated the capped re-read. Now each passing transition's base and first state are read (a page or two) and judged by `#rewind`; only when it finds a rewind is the recovered line read on, up to the head's version, and whatever is read under the head is adopted beside the read after it. Acceptance is unchanged. `EndpointOrg` takes a `maxPages` seam for the suite. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…view fix Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…S), a probe of a recovery's base reads two pages at most, and what was read when the budget runs out is adopted reviewer-high's round-2 P2: each qualifying base began its own read with a fresh MAX_PAGES allowance, and `until` only said where to stop, so a hub answering `more: true` with an old state cost N genuine transitions N x 1000 requests. The read after the head, the probes and the recovered line's read now draw on one budget, the read after the head first, so a sync costs at most what it did before the recovery fix. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…s whole, and a recovery from below the head has half the sync's pages left after the first, so neither the read after the head nor the recovery starves the other reviewer-high's round-3 P2s, both from the budget running out: a read after the head that took every page left a recovery's first state unread (an honest hub, the endpoint at the superseded head for good), and a rewind found in an earlier base's pages had no probe of its own to read on from (`probes.get` undefined, a TypeError). Now every state read goes into one pool, deduplicated by version and hash; the bases are probed newest first, two pages each, within the recovery's share, each from its base's version when the window holds the base; the line of a rewind `#rewind` finds in the pool is read on from the pool's own run of it; and what either share leaves goes to the other. Verification is unchanged and a sync still reads at most MAX_PAGES pages. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…d-budget sync Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
SSFSKIM
added a commit
that referenced
this pull request
Oct 29, 2026
SSFSKIM
added a commit
that referenced
this pull request
Oct 29, 2026
…dpoint fixes, desk-hub eyJ fix) into p5-o3-c at M5's start Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
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.
P5 O10 follow-up: the endpoint now follows an org recovery whose first state is a sibling of its head. This closes the endpoint half of P5 Decision Log 126's residue, the same defect O8 fixed app-side in #314 (740f0c4).
The defect
The endpoint's hub sync read only
GET /machine/org/state?since=<held head>(the oldsrc/endpoint/org-sync.ts, line 100). When an admin delivers a state straight to a machine, the hub's head sits below the endpoint's. The hub then accepts a recovery from its own head and serves the recovered line's first state at the endpoint's head version: a sibling with the same version and a different hash.?since=<head>never serves that state or its base, so the endpoint refused the recovery as afork.The fix (
src/endpoint/org-sync.ts)Only which states the sync reads has changed.
#adoptand#rewindverify as before (verifySuccessor,verifyRewind, the base hash againsthashes[fromVersion-1]), and head and window still commit in one rename.MAX_PAGESpages, the same ceiling as before. Every state it reads goes into one pool, deduplicated by version and hash, and#adoptjudges the pool as a whole.verifyRewindagainst it, half of the remaining pages (rounded up) go to the recovery. The forward read gets the rest, plus whatever the recovery leaves unused.fromVersionwhen the window holds the base, and fromfromVersion - 1when the base has aged out.#rewindfinds a rewind in the pool, its line is read on up to the head's version. Whatever has been read when the pages run out is adopted, and the next sync continues from there.fork. The head, the status andorg.jsonstay byte-identical, and the same fork line is logged.Files outside
src/endpoint/andtest/endpoint/:vitest.config.ts: one line, registering the new Miniflare suite.test/org/signer.local.test.ts: a comment only. It used to say the endpoint could never follow such a recovery.Validation Evidence
test/endpoint/org-recovery.local.test.ts, new):287b2e6a0this failed with "no the recovered line adopted within 5000 ms"; with the fix it passes.test/endpoint/org-sync.test.ts): 24/24. Each regression below was written to fail first, and the raw outputs are in the executor's evidence.more: true(round 2: 13 requests before the fix, at most 4 after);test/org/signer.local8/8,hub-link.local10/10,enroll7/7,provision22/22.tsc -pexits 0 on node, web and e2e.ci-gate --gates static,unit,probes,e2e:desk-web-hub --class1a pool --runner macos --lane hosted --label o10-recsib4on headfe886426e. GREEN, run 40790637898; desk-web-hub 39 passed, noflaky:line, no coverage warning.40ffd4e67, was red in a single test,src/mawsd/cli-prompt.test.ts's ^C case (run 40788949682). This branch doesn't touch that file, and the case passed on the next head. It is logged as a possible pty flake.MAX_PAGES.MAX_PAGES.Residue
OrgView.advance, M1'sh2/h3) still can't carry a recovery whose first state is a sibling of the endpoint's head. The endpoint now follows one from the hub or by delivery. This was out of this change's scope.Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)