Repository navigation
fix(tune-out): entering a tune-out keeps the subconscious's window anchor at an all-except hold in force - #933
Open
nissa-seru wants to merge 2 commits into
Conversation
added 2 commits
October 30, 2026 02:05
enter() set the subconscious's window anchor to the oldest start among the tune-outs on record and its own, and left out an all-except hold in force, which the start's resume counts and enterAllExcept's own start stands for. Entering a channel's tune-out while an older hold was in force moved the anchor past the hold's start, though the comment above the reduce said never to move it forward there, and the hold's earlier rows left the subconscious's window. main has the same gap. The reduce now starts from the older of the new tune-out's start and the hold's, and its comment says what it keeps. Test: a hold entered at sequence 3, then a channel's tune-out at 20, over the real registry and store, leave the anchor at 3 both times. The test file's coordinator takes the sequence as an optional argument for it. Before this change the second anchor was 20.
…resumes docs/dendrite.md's tune-out paragraph: the coordinator exists when create() brings up MCPL channels and a reader is configured or tuneOut.enabled is set, and residents are offered tune_out only where it exists. Where the coordinator exists, a persisted epoch is resumed, and released when it ends, with a reader or without one, where the paragraph had said it always is. A restart resumes every tune-out on record, whether or not its channel is registered yet. Where there is no coordinator, as where no reader is configured and tuneOut.enabled isn't set, or where MCPL first comes up after create() with connectMcplServer(), each channel's tune-out on record ends when MCPL comes up, and nothing delivers its backlog.
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.
On top of #916, entering a channel's tune-out while an older all-except hold is in force now leaves the subconscious's window anchor at the hold's start, and
docs/dendrite.md's tune-out paragraph says when the coordinator exists and what a restart resumes. In this pull request's new test, a hold entered at sequence 3 and then a channel's tune-out entered at 20 give the anchors[3, 20]with #916's coordinator at9704133265, and[3, 3]at this head.main's coordinator at48f26ce56cgives[3, 20]too.@tel-0s, this pull request goes into #916's branch,
fix/tune-out-resume-late-channels, and adds two commits to it. We're asking you to merge it there, so the anchor fix and the paragraph land with #916's fix.Problem
At
9704133265,enter()sets the subconscious's window anchor with these lines (src/tune-out/coordinator.ts:678–682):With #916's coordinator in place of this head's, the new test, "a tune-out entered while an older all-except hold is in force leaves the subconscious's window start at the hold's start", fails at its last assertion: the anchors are
[3, 20]where[3, 3]was expected. The hold's start is 3, and the second anchor is the new tune-out's start, 20.Changes
enter()'s reduce (src/tune-out/coordinator.ts:678–681) starts fromscope ? Math.min(params.startedAtSequence, scope.params.startedAtSequence) : params.startedAtSequence, wherescopeisthis.getAllExcept(), whichenter()already reads (:649). The comment above it now reads "Never move the anchor past the start of an epoch still in force, a tune-out's or the all-except hold's."test/tune-out-resume-late-channels.test.tsgains that test, over the realChannelRegistryand aJsStore. ItscoordinatorOntakes what the coordinator'scurrentSequencehook answers as an optional fourth argument, whose default is the() => 9the hook had.docs/dendrite.md's "Tune-out without a reader" paragraph (:278), in a commit of its own,e2dc0af961, on top of the fix in65e58aa35a, so it can be dropped whole. Beyond the sentence for fix(tune-out): resume a tune-out on record whose channel isn't registered at the start #916's own change, "A restart resumes every tune-out on record, …", it replaces two sentences thatmain's own tests contradict. At a clean48f26ce56c, "a tune-out on record at a start with no subconscious ends there, …" and "a tune-out on record when a start without servers connects one later ends then, …" (test/tune-out-transport.test.ts:1419and:1448) pass (Tests). In each, MCPL comes up with a tune-out on record, the tune-out ends, and the log line the test asserts says "nothing on this host watches or cancels tune-outs". The paragraph's changes:create()brings up MCPL channels and a reader is configured ortuneOut.enabledis set, and residents are offeredtune_outonly where it exists."create()returns (#900)." and "Where there is no coordinator, as where no reader is configured andtuneOut.enabledisn't set, or where MCPL first comes up aftercreate()withconnectMcplServer(), each channel's tune-out on record ends when MCPL comes up, and nothing delivers its backlog."tune_outwhen a reader is configured ortuneOut.enabledis set.", is cut, and the new first sentence says where residents are offeredtune_out.changelog.d/tune-out-anchor-hold-in-force.fixed.md: "Hosts with a subconscious: entering a channel's tune-out while an older all-except hold is in force no longer moves the subconscious's window anchor past the hold's start."With #844
@tel-0s, #844 (
c7011d5c7a) merges with #916's head with no conflicts, bygit merge-treeon October 30 at 08:08 UTC. With this head in place of #916's, it conflicts insrc/tune-out/coordinator.ts, in one block:enter()'s window anchor, where #844 callsanchorSubconscious()and this head has the reduce under Changes. Each of the other 39 pull requests open then merges with this head as it does with #916's.Tests
At a clean checkout of
e2dc0af961, on Linux with Node 24.22.2 and npm 11.19.1, afternpm installwithpackage-lock.jsonandnode_modulesremoved.npm ls --depth=0gives@animalabs/chronicle0.5.1,@animalabs/context-manager0.24.1,@animalabs/mcpl-core0.4.0,@animalabs/membrane0.8.0,@babel/parser7.29.12,@modelcontextprotocol/client2.4.0,@modelcontextprotocol/server2.4.0,@types/node22.20.5,@types/ws8.18.2,chokidar4.0.3,discord.js14.27.0,tsx4.23.15,typescript7.0.2 andws8.22.0.npx tsc --noEmit,npm run buildandnpm run pretesteach exited 0. Each test file ran alone, with the flagsnpm testgivesnodeand the TAP reporter:TuneOutCoordinator,tune_out,tuneOut,cancelTuneOutorall-except: 1,106 of 1,106 tests pass, among themtune-out-resume-late-channels's 4.src/tune-out/coordinator.ts(9704133265) built in place of this head's:tune-out-resume-late-channelspasses 3 and fails 1, the new test, at its last assertion, with[3, 20]where[3, 3]was expected.main'ssrc/tune-out/coordinator.ts(48f26ce56c) built in its place: all 4 fail, fix(tune-out): resume a tune-out on record whose channel isn't registered at the start #916's three and the new test, which fails at the same assertion with[3, 20].At a clean checkout of
mainat48f26ce56c, set up the same way, with the same versions,npm run buildandnpm run pretesteach exited 0, andtest/tune-out-transport.test.ts, which this pull request and #916 leave asmainhas it, passes 60 of 60.Not verified
test/.setSubconsciousAnchor, not what the window then holds.changelog.d/tune-out-anchor-hold-in-force.fixed.md.Hilda-2681 made this change and ran it red first. The anchor fix and the paragraph first went into an earlier change of ours for #900, which Crispin-2406 read. Naomi-2422 read this pull request. Fern-2426 ran our internal review of #916. Daniel-2612 repeated the runs at a clean checkout and wrote this description.