Repository navigation
test: pin why the incremental compact path refuses a live segment (#230) - #239
Merged
Merged
Conversation
Order 3 (issuecomment-5461743426) found that a root whose first commit took the compact acknowledgement can never take an incremental one afterwards, and read the `state.compactHosts !== null` refusal in `prepareLynxCompactHandleDeltas` as the thing standing in the way. It is not in the way. It is holding the door shut on a silent identity loss. A compact host is a handle that has not been materialized yet: `compactHandle` builds one out of the segment the first time anything observes it. So most of a shell's hosts live only in the segment, and `apply()` installs a staged segment by *replacing* the old one. Relaxing the refusal for the incremental branch therefore keeps exactly the hosts someone happened to observe first and drops the rest. Measured, not argued. With the guard relaxed to `(!incremental && state.compactHosts !== null)` and a second segment applied at ids disjoint from the first by 10,000: host 1 (observed before the attempt) → active, same object host 2 (never observed) → null host 3 (never observed) → null Reachability that depends on who looked, with nothing reporting it. That is worse than the refusal, and it is why the fix cannot be a gate flip: the segment has to be preserved, not replaced. Two tests. The first pins the refusal at disjoint ids, where every id-overlap check the incremental branch already makes passes, so it is refused for holding a live segment at all. The second pins the half that has to survive any fix: it swallows whatever the attempt does and then asks for hosts nobody has observed, so it passes today because the attempt is refused and must pass afterwards because the fix preserved them. Red-verified with that same relaxation: the first fails on the missing throw, the second on `expected undefined to be true` — the identity loss itself, independent of the refusal. No product code changes. Full lynx project: 48 files, 730 tests. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
This was referenced Aug 29, 2026
Huxpro
marked this pull request as ready for review
August 30, 2026 12:46
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.
Summary
Order 3 named the
state.compactHosts !== nullrefusal inprepareLynxCompactHandleDeltasas the thing blocking a warm container from re-entering the compact regime, and proposed teaching the incremental path to follow a live segment. I went to build that and found the refusal is not an obstacle in the way of a fix — it is holding the door shut on a silent identity loss. This PR pins that, measured rather than argued.No product code changes.
Why
A compact host is a handle that has not been materialized yet:
compactHandle(client-driver.ts:371) builds one out of the segment the first time anything observes it. So most of a shell's hosts live only in the segment. Andapply()installs a staged segment by replacing the old one (client-driver.ts:1003).Relaxing the refusal for the incremental branch therefore keeps exactly the hosts someone happened to observe first, and drops the rest. With the guard changed to
(!incremental && state.compactHosts !== null)and a second segment applied at ids disjoint from the first by 10,000:handlesReachability that depends on who looked, with nothing reporting it. A
reftaken after the second create finds nothing, while the same code that had touched the node earlier works. That is strictly worse than the refusal, and it is why the fix cannot be a gate flip: the segment has to be preserved, not replaced.This also kills the obvious cheap fix. Merging the new hosts into the existing dense
Uint16Arraywould work once, but each create mints higher ids, so the array widens on every cycle and never narrows — which is thearray:growth already measured as +3.15 MB of theheapMtsAfterCleardrift in Order 2. A per-run segment list is the shape that survives that; the existinglive === 0retirement already drops a spent segment, which keeps the list at shell-plus-live-runs rather than one per repetition. That is the design I would build, and it is what I want your gate on.Changes
Two tests in
packages/lynx/tests/protocol.test.ts, beside the existingre-arms compact acknowledgements after the last compact host retirespin:Validation
pnpm format:check— not run repo-wide;pnpm format:filesclean on the one changed file.pnpm typecheck— not run; test-only change.pnpm test— not run in full.packages/lynx/tests/protocol.test.ts→ 49 passed (was 47).8938c1260was 728).pnpm syncclean, no generated changes.Red-verified with the same relaxation that produced the table above:
The second failure is the important one — it is the identity loss itself, caught independently of whether the refusal is still there. Restored, 49/49.
Risk / follow-ups
This is the third open gate on #230 and they interact, so all three are collected in issuecomment-5462016946 and the comment following it:
create; the cost is on the receiver). This compact-regime work is where the margin is. E1 → E2 → E3 was set before that measurement.mount-program-runcannot name a resident program today, and closing that spends Main-thread-resident block programs: the optimal-Lynx first screen #163's background byte-identity promise (PR test: pin what a background-originated program mount cannot name (#230 E1) #238).compactHostswith a short list and touches ~13 read sites inclient-driver.ts?I stopped before building the segment list for the same reason I stopped before the speculative
compactHostsredesign in Order 3: it is a change to handle identity, which is the part of this file least forgiving of a guess.Provenance
agent-authored)Generated by Claude Code