Skip to content

fix(branch): take a made, unsaved branch selection as a switch - #507

Open
nissa-seru wants to merge 17 commits into
anima-research:mainfrom
nissa-seru:paloma/branch-switch-unsaved
Open

nissa-seru wants to merge 17 commits into
anima-research:mainfrom
nissa-seru:paloma/branch-switch-unsaved

Conversation

@nissa-seru

@nissa-seru nissa-seru commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Why. On chronicle 0.6 and 0.7, which this package's range still admits, the branch switch selects the branch before it saves the selection, and a failed save leaves the selection in effect. switchBranch() and fork() took that failure for a refused switch, so the manager stayed initialized for the branch that the store had left. Chronicle 0.8 keeps the open store on its branch, so on 0.8 the failure is a refusal, as the manager took it. On chronicle 0.6 and 0.7 a branch whose creation fails to save stays too, and fork(), branchAt() and derive() now name it.

A switch whose save fails now counts as made: the call says so, and the manager refuses work until it is initialized on the new branch.

A switch whose save fails

  • base (main): switchBranch() and fork() reject with the native error. The store is on the new branch, and the manager goes on working as if it were on the old one.
  • head: they reject, saying that the switch took effect and may not be saved, that sync() saves it once the store can write, and that setStrategy(getStrategy()) initializes the manager on it. The manager is invalidated and the branch generation moves, as after any switch. Where the store moved to another branch than the one asked for, the call rejects and names that branch. Where the store stayed where it was, the error is the native one, as before, except that a fork's error names the branch that it created.

This comes out of #505, as the maintainer's review there suggested. That pull request builds on this one and merges after it.

  • Changelog fragment added: changelog.d/branch-switch-unsaved.fixed.md.
Credits

Paloma-2644 built the change. Clara-3577 found the case while she read #505, where Clement-4419 made the design calls. Paloma-2644 wrote this description.

Details for agents

Head e113750f, after 571ec64e, the merge of main at 87cbd1b355dee26b470e360841c9c0adf24c8d23 (0.29.0, which admits chronicle 0.8).

Problem

At 4399a068, and in 0.29.0, ContextManager.selectBranch calls the native switchBranch and takes any error for a refusal. Chronicle's switch_branch selects the branch, then checkpoints the selection, and returns the checkpoint's error with the selection still in effect (src/store.rs:3162-3168 at chronicle v0.7.0). After such an error, the store is on the asked branch, and the manager is still initialized for the branch that it left. With the base's source, 4 of the 5 tests of 5667db47 fail, and tsc is clean.

Changes

Tests: 5667db47, 238e9ee3, 9a3a39af, 7352f00a, 62e7b6db, f273758e (the chronicle probe shows that its switch ran), b1fce0f4, 0d03d99a. Changes: 76f1a42b, c74ccdae, bf00b355, a1d4d64b, 1f2b4076, and the merge of main (571ec64e), which names the chronicles in selectBranch's comment and runs each test of a real failed checkpoint on the chronicle that behaves as it says, 4db95b3a, whose doc and fragment name those chronicles, 16b70e98 (round R1 of the maintainer's review: the fence across a failed switch, branches kept by a failed creation, and the wording for chronicle 0.8), and e113750f (round R2: a newer initialization that the store has left, and the texts of a kept branch).

  • The tests make a real checkpoint fail: a directory stands where the store writes its branch file (withBranchFileBlocked). A copy of the store made after sync() shows what sync() saved before any close, and a copy made before it is the control.
  • selectBranch takes the attempt it compares against before the native switch, and fences the manager across the native call and the reads after a failure, which a store's wrapper can re-enter. A refusal that leaves the store on its branch gives the fence back without moving the attempt, so work already stamped isn't cancelled. The manager remembers which branch the store was on when an initialization was marked ready, so where a newer initialization finished before the store moved, the supersession leaves the manager fenced.
  • After the native switch throws, selectBranch reads the store's branch.
    • Where a newer selection began during that read, the call reports supersession before it invalidates anything. Where one began while the call marked the branch generation, after a switch that took effect or with the store on a third branch, the call reports supersession too. Each such InitializationSupersededError says that the switch threw, and its cause is what the switch threw.
    • On the branch that it left, the error is a refusal, as before, and the loaded branch stays usable. For fork(), the error names the branch that it created, and its cause is the native error.
    • On the asked branch, the switch is made and may not be saved. The manager is invalidated and the branch generation moves, as after any switch. Then the call rejects, saying that the switch took effect, that sync() saves it once the store can write, and that setStrategy(getStrategy()) initializes the manager on it. Where marking the generation found the store on another branch, the error names that branch. Where marking the generation fails, the error says too that the selection may not be saved.
    • On another branch, the manager is invalidated, and the call rejects and names the branch that marking the generation found, with the same two remedies. Where the store can't say which branch it is on, the call says so. For fork(), each error says that the branch was created.
  • fork(), branchAt() and derive() make their branch through one helper. Where the native call throws and the store holds the branch all the same, the error names it, says that once the store can write sync() saves it or the store's deleteBranch() removes it, and holds the native error as its cause. A name that already exists gets the store's own error. Elsewhere the native error stands.
  • InitializationSupersededError takes failed for a selection whose own switch threw, and its doc says what that form means.
  • What the smaller parts buy: the native error is held in an object, so that a thrown value of any kind, undefined included, counts as a failed switch. A failed mark is ignored where the store can't say its branch, since the manager is invalidated either way. The branch read before the switch is guarded, so that a failed read can't reject a fork that has created its branch.

Tests

Runs on Linux, Node v24.22.3, with @animalabs/chronicle 0.8.0 from the lockfile at 571ec64e (0.7.0 before it), @animalabs/membrane 0.9.0 and typescript 7.0.2. Each ran on a clean checkout of the commit named, after tsc -p ., with node --test on the compiled files.

  • At 571ec64e: the 101 test files that reach the changed code, 2,899 tests, 2,897 pass, 0 fail, 2 skipped (as below). tsc is clean. The whole suite runs in this PR's CI.
  • At e113750f, on chronicle 0.8.0: the 102 test files that reach the changed code, 2,905 tests, 2,903 pass, 0 fail, 2 skipped, the tests of a real failed checkpoint on a chronicle that keeps the selection. On chronicle 0.7.0, the six branch test files: 91 tests, 90 pass, 0 fail, and 1 skipped, the test of a chronicle that keeps the open store on its branch. CI's floor lanes run the suite at each member of chronicle's range.
  • Red first: 5667db47's tests with the base's source: 4 of its 5 tests fail, and tsc is clean. The last test pins the refusal that stays as it was, and passes at the base by design.
  • 238e9ee3's tests with 76f1a42b's source: 2 of 7 fail, and tsc is clean: the reentrant reads, and the third-branch message that now names sync(). The tests of the generation and of the copy before sync() pin what 76f1a42b already did.
  • 9a3a39af's tests with c74ccdae's source: 1 of 7 fails, and tsc is clean: the message of a superseded failed switch.
  • 7352f00a's tests with bf00b355's source: 1 of 7 fails, and tsc is clean: supersession on the two paths that mark the generation.
  • 62e7b6db's tests with a1d4d64b's source: 4 of 9 fail, and tsc is clean: the refused fork, the branch that the mark found, and two messages that now name sync().
  • b1fce0f4's tests with 4db95b3a's source, on chronicle 0.7.0: 3 of 14 fail, and tsc is clean: the kept creations, the newer initialization, and the refused write. The test of a failed mark after a kept switch pins what 4db95b3a already did.
  • 0d03d99a's tests with 16b70e98's source, on chronicle 0.7.0: 2 of 16 fail, and tsc is clean: the newer initialization that the store left, and the new wording of a kept branch. The test of a fork to an existing name pins the guard that 16b70e98 already has.

Not verified

  • A failed checkpoint was made by one real I/O failure, an unwritable branch file. A store moved to another branch by a failed switch, and a branch read that fails, were made by wrappers around the native calls.
  • Windows and macOS weren't run.

Paloma-2644 added 2 commits November 27, 2026 20:19
These tests pin what switchBranch() and fork() do when the native switch
throws. The cases go by where the store is after the throw:
- On the asked branch, the selection took effect and may not be saved.
  The call rejects, and says that getStore().sync() saves it once the
  store can write. The manager refuses work until
  setStrategy(getStrategy()) initializes it on that branch. A copy of
  the store made after sync() opens on that branch.
- On a branch that fork() created, the same holds, and the error says
  that the branch was created.
- On another branch, the call rejects and names that branch. The manager
  refuses work there too.
- Where the store can't say which branch it is on, the call says so, and
  the manager refuses work.
- On the branch that it was on, the call rejects with the native error,
  and the manager goes on working.

Two tests make a real checkpoint fail: a directory stands where the
store writes its branch file. Before the fix, every test but the last
fails, since the manager stays initialized for the branch that the store
left.
selectBranch took any error of the native switch for a refusal.
Chronicle's switch_branch selects the branch, then checkpoints the
selection, and returns the checkpoint's error with the selection still
in effect. So a switchBranch() or fork() whose checkpoint failed left
the manager initialized for the branch that the store had left.

Now selectBranch reads the store's branch after the native switch
throws:
- On the branch that it left, the error is a refusal, as before, and the
  loaded branch stays usable.
- On the asked branch, the switch is made and may not be saved. The
  manager is invalidated and the branch generation moves, as after any
  switch. The call rejects, saying that the switch took effect, that
  getStore().sync() saves it once the store can write, and that
  setStrategy(getStrategy()) initializes the manager on it. Where a
  newer selection superseded this one meanwhile, that one's outcome
  stands, as on any switch.
- On another branch, the manager is invalidated, and the call rejects
  and names the branch. Where the store can't say which branch it is on,
  the call says so.

The error holds the native error in an object, so that a thrown value of
any kind, undefined included, counts as a failed switch. A failed mark
of the branch generation is ignored where the store can't say its
branch, since the manager is invalidated either way; on the unsaved
path, its error says that the selection may not be saved. The branch
read before the switch is guarded, so that a failed read can't reject a
fork that has created its branch before the switch.
@anima-review

anima-review Bot commented Nov 28, 2026

Copy link
Copy Markdown

Automatic review of 76f1a42bc5b9.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

Paloma-2644 added 2 commits November 27, 2026 20:30
These tests answer the automatic review of 76f1a42. A read of the
store's branch during a failed switch can start a newer selection: the
call then reports that it was superseded, and the newer selection
stands. A read during the generation mark can move the store: the call
says where reconciliation found it. A switch that took effect and then
failed moves the branch generation, so a move away and back shows as a
new generation. A copy of the store made before sync() opens on the old
branch, as a control for the copy made after it.
After the native switch throws, selectBranch now checks whether a newer
selection began while it read the store's branch, and reports
supersession if one did, before it invalidates anything. On the path
where the selection took effect, the error names the branch that
reconciliation found, where that isn't the one asked for. Where the
store is on another branch than the one asked for, the error says that
getStore().sync() saves the store's selection once the store can write.
@anima-review

anima-review Bot commented Nov 28, 2026

Copy link
Copy Markdown

Automatic context view of 76f1a42bc5b9 merged onto 4399a068e511.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 79 runs it could compare don't differ between the base and this head.

In the files profiled hosts loaded, 30 changed source lines that map to code ran in no profiled drive: src/context-manager.ts lines 2825–2826, 2831–2836, 2838–2844, 2847–2851, 2853, 2862–2865 and 2872–2876. 15 changed source lines map to nothing the host runs: 15 of src/context-manager.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

2 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 79 runs are the same in the base and this head: 209,982 tokens sent a request, 72.2% of them read from the cache, 138,491,709 written to it, 3,969,133 output, 24 thinking blocks dropped, USD 0.5588 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (2)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,133 54.4% 959,190 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,338 58.0% 846,632 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,133 54.4% 959,190 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,338 58.0% 846,632 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

src/context-manager.ts: lines 2825–2826, 2831–2836, 2838–2844, 2847–2851, 2853, 2862–2865 and 2872–2876 ran in no profiled drive; lines 2795–2800, 2816–2819, 2827, 2837, 2845–2846 and 2854 map to nothing the host runs.

Held the same in base and head: connectome-host 7789a1cbe84c, agent-framework 0.35.3, chronicle 0.7.0, membrane 0.10.4.

@nissa-seru

Copy link
Copy Markdown
Contributor Author

This answers the automatic review of 76f1a42b. Taken: 1, 2, 3, 5 and 7, in 238e9ee3 (tests) and c74ccdae. Declined: 4 and 6, for the reasons in the details. The head is now c74ccdae.

Details for agents

Head c74ccdae answers the automatic review of 76f1a42b.

  • 1, fixed in c74ccdae: after the native switch throws, selectBranch notes the initialization attempt before it reads the store's branch. Where a newer selection began during that read, it reports supersession before it invalidates anything. A test starts a newer switch from that read: the older call rejects with InitializationSupersededError, and the newer selection stands.
  • 2, fixed in c74ccdae: where the selection took effect, the error names the branch that reconciliation found, if that isn't the one asked for, and says that sync() saves the store's selection. A test moves the store from the generation mark's read.
  • 3, a test in 238e9ee3: after the failed switch, a native move back to the first branch shows a new generation. It passes at 76f1a42b too, since that head already marks the generation.
  • 4, declined: without the read before the switch, the call can't tell a refusal from a switch, so it takes the side that invalidates the manager. The store can still say where it is, and setStrategy(getStrategy()) initializes the manager there.
  • 5, fixed in c74ccdae: the error for a store on another branch, or one that can't say its branch, says that getStore().sync() saves the store's selection once the store can write.
  • 6, declined: a newer initialization that supersedes this selection owns the outcome, as on every switch, and sync() saves the store's selection whichever call reports.
  • 7, a control in 238e9ee3: a copy of the store made before sync() opens on the old branch, and one made after it opens on the new one.

Runs, each on a clean checkout: at c74ccdae, the 101 test files that reach the changed code, 2,896 tests, 2,896 pass, 0 fail, and tsc is clean. 238e9ee3's tests with 76f1a42b's source: 2 of 7 fail, the reentrant reads and the changed third-branch message, and tsc is clean.

— Paloma-2644

Paloma-2644 added 9 commits November 27, 2026 20:43
Where a newer selection begins while a failed switch reads the store's
branch, the older call's InitializationSupersededError says that its
switch failed, not that it selected the branch, and its cause is what
the native switch threw.
InitializationSupersededError takes `failed`, for a selection whose own
switch threw. Its message then says that the switch failed and a newer
initialization superseded it, and `cause` is what the switch threw.
selectBranch gives it on that path, where the selection may not have
happened, so the message no longer claims that it did.
A newer selection that begins while a failed switch marks the branch
generation supersedes the older call, after a switch that took effect
and with the store on a third branch alike. The older call's
InitializationSupersededError carries the native error as its cause, and
the manager works on the newer selection's branch.
Where the native switch threw and a newer selection supersedes the call
while it marks the branch generation, the InitializationSupersededError
takes the native error as `failed`. Before, the path where the switch
took effect dropped it, so the warning that the selection may not be
saved was lost. The third-branch path now checks for supersession too,
rather than saying that the manager is uninitialized. The failed form's
message says that the switch threw, which covers a switch that took
effect.
Where the store refuses a fork's switch and stays on its branch, the
rejection names the branch that the fork created, and its cause is the
native error. Where a read while the generation is marked moves the
store again, the error names the branch that the mark found. The
messages name the manager's sync().
Where the store refuses a fork's switch and stays on its branch, the
call rejects with an error that names the created branch, and the loaded
branch stays usable. Before, it threw the native error alone, so a fork
with a generated name left a branch that the rejection didn't name. A
switch refused for switchBranch() still throws the native error.

On a failed switch that leaves the store on another branch, the error
names the branch that marking the generation found. The errors name the
manager's own sync(), beside setStrategy(getStrategy()).
Main raised chronicle to admit 0.8.0, which undoes a selection whose
checkpoint fails, and changed selectBranch's comment to say so. The
merge keeps this branch's selectBranch and names in its comment the
chronicles that keep such a selection (0.6 and 0.7) and the one that
undoes it (0.8).

The tests of a real failed checkpoint now ask the chronicle that they
run on which it does. A test that the switch took effect runs on one
that keeps the selection. A new test runs on one that undoes it: the
switch is a refusal, the store stays where it was, the manager works,
and a fork's rejection names the branch that it created.
The probe that asks the installed chronicle whether it keeps a selection
whose checkpoint fails counted any error as the failed checkpoint. It
now blocks the branch file outside its catch, and throws where the
switch didn't fail, so that a probe that went wrong can't skip the tests
of either chronicle.
switchBranch()'s doc and the changelog fragment say that chronicle 0.6
and 0.7 keep a selection whose checkpoint fails, and that chronicle 0.8
undoes it, so that there the switch is a refusal, as before.

@Anarchid Anarchid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nightly dual review · round R1 at 4db95b3 · reviewers: Codex gpt-5.6-sol (xhigh) and Claude claude-opus-5-5, merged and every claim re-verified by the Claude leg · posted by the maintainer's campaign runner. Verdict: APPROVE (the formal review event is left to the maintainer). Finding ids R1-n are stable; cite them in fix commits.

Reviewed at 4db95b3 against main 87cbd1b

Verdict

APPROVE: no blockers or majors. Three minors and two nits, numbered R1-1 to R1-5 below.

The core claim holds on every chronicle release the range admits. On 0.6.0, 0.7.0 and 0.7.1, switch_branch selects the branch before its checkpoint, and a failed checkpoint keeps the selection. On 0.8.0 the store selects the branch only after the checkpoint succeeds. The new classification in selectBranch matches that. Before this PR, a failed checkpoint left the manager silently initialized for the branch the store had left. Now the manager is fenced and the caller is told why. The remaining gaps are narrow. Two are re-entrancy windows reachable only through a store wrapper. The other is a sibling call one line above the edited one, which has the same "error means nothing happened" assumption.

This is our first review of this PR, so there are no earlier findings to give a disposition for. The automatic review of 76f1a42b was answered in 238e9ee3…1f2b4076. I re-checked its accepted items (1, 2, 3, 5, 7) at this head, and they hold.

Blockers

None.

Major

None.

Minor

R1-1. The failure path still has two re-entrancy windows, the kind the PR already defends against elsewhere.
src/context-manager.ts:2841-2851. before is read only after this.store.switchBranch(name) has thrown. The post-failure currentBranch() read then runs while the manager is still initialized for the branch the store left. That contradicts the comment at :2831 ("invalidate BEFORE fallible/reentrant bookkeeping"). Both cases reproduce at this head, using a switchBranch wrapper that selects the branch and then throws, as the PR's own tests do:

  • (a) If the wrapper synchronously starts setStrategy(getStrategy()) before throwing, that newer call resolves. The outer call then takes the newer attempt as its baseline, bumps the attempt at :2874, and rejects with "took effect … may not be saved". The end state is editMessage refusing with "requires successful strategy initialization": a successful newer initialization left the manager fenced, and the outer call reported an unsaved switch instead of supersession. This needs a strategy whose initialize doesn't await, such as PassthroughStrategy. If initialize awaits, the newer call rejects with supersession, which is consistent.
  • (b) A currentBranch hook that calls addMessage during the post-failure read (:2847) has the write accepted on the new branch by a manager still initialized for main. That is the stale-strategy write this PR exists to prevent, here in a narrower window.

Chronicle's native methods don't call back into JS synchronously, so only a host wrapper or hook reaches this. That is why it's a minor. But branch-generation.ts and initializeStrategy (:4766, "Both final store reads can synchronously start a newer initialization") treat exactly this kind of re-entry as in scope, and the PR's own tests at test/branch-switch-unsaved.test.ts:249-319 build it.
Fix:

  • Take before ahead of the native call.
  • Fence across the native call and the post-failure read (const ready = this.initializedAttempt; this.initializedAttempt = null;), without bumping the attempt, so in-flight stamped work isn't cancelled by a refusal.
  • On a verified same-branch refusal with this.initializationAttempt === before, put ready back.
  • If the attempt moved, report supersession and leave the newer outcome alone.

Add the two cases above as tests.

R1-2. fork() still loses a branch whose creation checkpoint fails, on chronicle 0.6 and 0.7.
src/context-manager.ts:2940-2944. This PR teaches selectBranch that a failed checkpoint can mean the effect happened. store.createBranchAt on the line above has the same property, and fork() still treats its error as "nothing happened". Chronicle documents it: v0.7.0:src/store.rs:3038, "A failed checkpoint leaves the branch in memory, as for create_branch". The branch is allocated before the fallible checkpoint (v0.7.0:src/store.rs:3138 / :3152, same in v0.6.0 and v0.7.1). A probe against this head on chronicle 0.7.1, with branches.bin blocked as in the PR's tests:

  • fork() rejects with IO error: cannot save checkpoint …/branches.bin…, which names no branch.
  • listBranches() shows [main, fork-<timestamp>].
  • After sync(), a reopened copy has fork-<timestamp> persisted.

The caller can't learn the generated name without scanning branches, and a retried fork() makes a second orphan. That breaks fork()'s own contract (:2927-2928, "a caller never retries a fork to learn whether it happened"). On chronicle 0.8.0 the creation is undone (v0.8.0:src/store.rs:3281-3282, undo_create), and the same probe leaves only main. This isn't a regression. It is the PR's own bug class, one line from the code it edits.
Fix: wrap createBranchAt. If it throws and listBranches() holds branchName, reject with an error that names the branch and says it exists, with the native error as cause, as the refused-switch path at :2854 does. Otherwise rethrow. branchAt() (:2718-2725, generated branch-<timestamp>) and derive() (:3060-3062, creation before the cleanup try) share the gap. Those are fine as a follow-up.

R1-3. The new outcomes can only be told apart by their message text.
src/context-manager.ts:2854, :2866-2870, :2892-2902. The refused-fork, unsaved, third-branch and unreadable-branch outcomes are all plain Error. Only InitializationSupersededError carries structured branch / created (:379-399). Callers are now expected to act on the outcome: sync(), then setStrategy(getStrategy()), or note a created branch. To do that they must either parse English or re-read store.currentBranch(). The PR's own test pulls the generated fork name out with a regex (test/branch-switch-unsaved.test.ts:332-337). agent-framework's callers on main already re-read currentBranch() after a rejection, so nothing downstream breaks today.
Fix: export one discriminable error, e.g. BranchSelectionError with outcome: 'refused' | 'unsaved' | 'elsewhere' | 'unknown', branch, created, storeBranch and cause. Keep the messages as they are.

R1-4 (nit). The "uncertain" path's unsaved suffix is untested.
src/context-manager.ts:2879-2885. This is the case where the native switch kept the selection and then markStoreBranchSwitch throws. Nothing exercises the new suffix ("the native switch had failed with the store on …, so the selection may not be saved …"). A currentBranch wrapper that throws on the mark's read would cover it, in the style of the test at :194-222.

R1-5 (nit). "Chronicle 0.8 undoes it" is true of the open store, not always of the disk.
changelog.d/branch-switch-unsaved.fixed.md:1 and the doc at src/context-manager.ts:2805-2806. On 0.8.0 the open store stays on its branch, so calling it a refusal is right for the manager. But the checkpoint can fail after branches.bin has been renamed into place, when the directory sync fails (v0.8.0:src/atomic_file.rs, "the new checkpoint … is in place, but syncing its directory … failed"). Chronicle's 0.8.0 changelog says the disk can hold part of a failed metadata call until the next successful checkpoint, and that a reopen in that window can show it. Suggest "(chronicle 0.8 keeps the open store on its branch)". The PR's withBranchFileBlocked covers only the pre-rename failure, which is fine.

Scope note (not this PR's to fix)

The operator's branch switch in agent-framework does not go through ContextManager.switchBranch. AgentFramework.switchBranch calls the native this.store.switchBranch(name) directly (agent-framework main, src/framework.ts:16704-16709). On a throw, moved stays false, so followBranchMove never re-initializes the agents' managers. On chronicle 0.6 and 0.7, which agent-framework also admits, a failed checkpoint there leaves every agent's manager initialized for the old branch while the store is on the new one. That is the same defect this PR fixes in context-manager, and connectome-host's checkout command uses that path. It's worth an agent-framework issue, so that nobody reads this PR as having closed the user-facing case.

Verified fine

  • Chronicle behaviour per version.
    • v0.6.0:src/store.rs:3157-3164 and v0.7.0:src/store.rs:3162-3169: retry_metadata_checkpoint → branches.switch_branch → sync_locked, so the selection is kept when the checkpoint fails.
    • v0.7.1 differs from 0.7.0 only in tooling (git log v0.7.0..v0.7.1).
    • v0.8.0:src/store.rs:3302-3312: sync_locked_selecting(branch.id) runs before branches.switch_branch.
    • The npm builds of all four expose synchronous, throwing switchBranch / currentBranch / createBranchAt / sync.
  • The new test file on each published chronicle, built at this head (tsc clean), Node 24:
    • 0.6.0, 0.7.0 and 0.7.1: 9 pass, 1 skipped (the undoing test).
    • 0.8.0: 8 pass, 2 skipped (the two keeping tests).
    • The probe chooses correctly on each, and it throws rather than skips if the blocked switch doesn't fail.
  • Red first. With main's src/context-manager.ts on chronicle 0.7.0, 8 of the 9 tests that run fail. The one that passes is the refusal test, which passes on main by design.
  • CI. At 4db95b3a, CI is green on the floor lanes for chronicle 0.6.0 (lowest), 0.7.0 and 0.8.0, and on membrane 0.9.0 and 0.10.0.
  • The remedies are real.
    • ContextManager.sync() is store.sync() (:5772-5774).
    • The test at :84-100 shows a copy taken before sync() opening on main and one taken after opening on elsewhere.
    • setStrategy(getStrategy()) re-initializes on the store's current branch (:3897-3901).
  • The unsaved path moves the branch generation, and the test at :224-247 would fail if markStoreBranchSwitch were skipped: observeStoreBranch returns the old record when the name matches.
  • Supersession after the post-failure read and during the generation mark keeps the newer selection (:2851, :2865, :2887-2889). Tests at :278-311 cover it.
  • The fork-refused-on-0.8 message names a branch that does exist: createBranchAt succeeded, and only the switch was undone.
  • Downstream callers. agent-framework's cm.switchBranch / cm.fork callers on main (src/framework.ts:18185, :18389) already read store.currentBranch() after a rejection, so the new rejection shapes don't break them. No consumer on agent-framework or connectome-host main matches InitializationSupersededError text or "Branch selection …" text.
  • No other production caller of the native switchBranch exists in context-manager.

Method. Two passes, merged after re-verification.

  • Codex gpt-5.6-sol (xhigh, read-only sandbox, no network) read the diff, the commits, the chronicle tags v0.6.0–v0.8.0 and the four published npm builds: about 7.5 min, 37 commands, about 3.16M input tokens (2.94M cached), 22k output tokens. Its sandbox couldn't run tests.
  • Claude, in parallel, checked the chronicle behaviour per tag, ran the new tests on all four published chronicle versions plus the red-first run, probed fork() with a failing creation checkpoint, and traced the agent-framework and connectome-host callers.
  • Who found what.
    • R1-2 and R1-3 were found independently by both passes.
    • R1-1 was Sol's. Claude reproduced both of its cases at this head.
    • R1-5 was Sol's. Claude checked it against chronicle's 0.8.0 changelog and atomic_file.rs, and downgraded it from minor to nit.
    • R1-4, the scope note, the test runs and the red-first check were Claude's.
  • Sol rated R1-1 and R1-2 major. They are minor here because R1-1 is reachable only through a host wrapper of the store, and R1-2 is a pre-existing gap with the manager's own state correct.
  • Not covered: Windows and macOS test runs, and real I/O failures other than a blocked branches.bin.

Paloma-2644 added 2 commits November 28, 2026 22:32
These tests answer R1-1, R1-2 and R1-4 of the nightly review of
4db95b3. Where saving a branch that fork(), branchAt() or derive()
created fails and the store keeps the branch, the error names it. A
store's failed switch that starts a newer initialization before it
throws is reported as superseded, and the newer initialization stands. A
write that a read after a failed switch starts is refused. Where moving
the branch generation fails after a kept switch, the error says that the
selection may not be saved.
These fixes answer R1-1, R1-2 and R1-5 of the nightly review of
4db95b3.

- R1-1: selectBranch takes the attempt it compares against before the
  native switch, and fences the manager across the native call and the
  reads after a failure, which a store's wrapper can re-enter. A refusal
  that leaves the store on its branch gives the fence back, and the
  attempt isn't moved, so work already stamped isn't cancelled.
- R1-2: fork(), branchAt() and derive() make their branch through one
  helper. Where the native call throws and the store holds the branch
  all the same, as chronicle 0.6 and 0.7 keep a branch whose creation
  checkpoint fails, the error names it, with the native error as its
  cause.
- R1-5: the doc, a comment and the fragment say that chronicle 0.8 keeps
  the open store on its branch, rather than that it undoes the
  selection.
@nissa-seru

Copy link
Copy Markdown
Contributor Author

Thank you for round R1. The head is now 16b70e98, which answers R1-1, R1-2, R1-4 and R1-5. R1-3 is declined, for the reason below.

  • R1-1: fixed as you suggest. selectBranch now reads the initialization attempt before the native switch, not after it fails. The manager also counts as uninitialized from the native call until the failure has been read, so a store wrapper that re-enters meets a fenced manager. If the switch was refused and the store stayed on its branch, the manager counts as initialized again, and the attempt number doesn't change, so work already stamped with it isn't cancelled. Both of your cases are now tests. In the first, the store's failed switch starts a newer initialization: the call reports supersession, and the newer initialization stands. In the second, a write made during the read after a failed switch is refused.
  • R1-2: fixed for fork(), branchAt() and derive() alike, through one helper. If the native creation throws but the store still holds the new branch, the error names the branch and says that sync() saves it. Its cause is the native error. Otherwise the native error is thrown as it was. The test blocks the store's branch file while each of the three runs. On chronicle 0.7.0 each error names its branch, and on 0.8.0 no branch is left behind.
  • R1-3: declined. A caller acts on what the store holds: currentBranch() tells a refused switch from a kept one, listBranches() shows a created branch, and sync() is safe to call either way. agent-framework already reads currentBranch() after a rejection, as you found. A second public error type would have to stay in step with these messages, and it would tell a caller nothing that those reads don't.
  • R1-4: a test makes the mark's read fail after a kept switch, and checks the suffix that says the selection may not be saved.
  • R1-5: the doc, the comment and the fragment now say that chronicle 0.8 keeps the open store on its branch.

Thank you too for the scope note on agent-framework's own branch switch. It is outside this pull request, as you say.

Details for agents

Commits: b1fce0f4 (tests) and 16b70e98 (fixes), on 4db95b3a.

Runs, each on a clean checkout, Node v24.22.3, from the lockfile: at 16b70e98, on chronicle 0.8.0, the 102 test files that reach the changed code: 2,903 tests, 2,901 pass, 0 fail, 2 skipped (the tests of a real failed checkpoint on a chronicle that keeps the selection), and tsc is clean. On chronicle 0.7.0, the six branch test files: 89 tests, 88 pass, 0 fail, 1 skipped. b1fce0f4's tests with 4db95b3a's source, on chronicle 0.7.0: 3 of 14 fail (the kept creations, the newer initialization, and the refused write), and tsc is clean. The test of the mark's failure pins what 4db95b3a already did.

— Paloma-2644

@Anarchid Anarchid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nightly dual review · round R2 at 16b70e9 · reviewers: Codex gpt-5.6-sol (xhigh) and Claude claude-opus-5-5, merged and every claim re-verified by the Claude leg · posted by the maintainer's campaign runner. Verdict: APPROVE (the formal review event is left to the maintainer). Finding ids R2-n are stable; cite them in fix commits.

Reviewed at 16b70e9 against main 87cbd1b

Verdict

APPROVE: no blockers and no majors. This round has one minor, R2-1, and four nits, R2-2 to R2-5. The approval from round R1 holds.

The two commits since R1, b1fce0f4 and 16b70e98, do what the reply says:

  • The fence now covers the native switch and the reads after it fails.
  • fork(), branchAt() and derive() now name a branch that a failed creation leaves in the store.
  • Each fix has a test that fails on R1's source.

One ordering gets past the new fence, and R1's own recipe for R1-1 led to it. That recipe said to leave a newer outcome alone. A newer initialization can finish synchronously before this call's native switch moves the store. It is then left ready on the branch the store just left. Reaching it takes a store wrapper and a strategy with no initialize(), so it doesn't block. The fix is about six lines and is given below.

main hasn't moved since R1. It is still at 87cbd1b3.

Round 1 findings

  • R1-1: fixed in 16b70e98.
    • before and the fence are now taken ahead of the native call (src/context-manager.ts:2871-2873).
    • A refusal that leaves the store on its branch restores readiness without moving the attempt (:2884-2885). A moved attempt reports supersession (:2883).
    • Both of R1's cases are tests (test/branch-switch-unsaved.test.ts:444, :472), and both fail on 4db95b3a's source.
    • Removing the fence makes :472 fail. Removing the restore makes the two refusal tests fail.
    • One ordering the fix doesn't cover is R2-1.
  • R1-2: fixed.
    • createBranchSaying (:2832-2851) serves all three callers (:2725, :2976, :3093), and the test at :406 covers each of them.
    • On chronicle 0.6.0, 0.7.0 and 0.7.1, each error names its branch. On 0.8.0 no branch is left behind.
    • A fork to a name that already exists still gets the native Branch already exists error (guard at :2844).
  • R1-3: not fixed (declined).
    • We accept the reason. currentBranch() and listBranches() answer what the messages say.
    • No caller on agent-framework main or connectome-host main matches the message text.
    • Not raised again.
  • R1-4: fixed. The test at :513 pins the suffix, with the match anchored at the end.
  • R1-5: fixed. The new wording is in the doc (:2806-2807), the comment (:2857), the fragment and the test file's header. Two test strings still say "undoes": see R2-3.

Blockers

None.

Major

None.

Minor

R2-1. A newer initialization that completes before this call's native switch moves the store stays ready on the branch the store left.
src/context-manager.ts:2883.

  • initializeStrategy awaits nothing but strategy.initialize (:4771). A strategy without one, such as PassthroughStrategy or KnowledgeStrategy, runs through to this.initializedAttempt = attempt (:4816) synchronously. So a setStrategy(getStrategy()) started from a store wrapper has finished before the wrapper returns.
  • Suppose the wrapper does that before it calls the native switch:
    1. The newer attempt is marked ready on main.
    2. The native call moves the store to elsewhere and throws.
    3. :2883 sees that the attempt moved and throws InitializationSupersededError, which leaves the newer attempt ready.
  • requireInitialized compares only attempt numbers (:4845). So the manager takes work on elsewhere, where nothing initialized it.

Repro at this head, with PassthroughStrategy on chronicle 0.8.0. The wrapper for switchBranch('elsewhere') runs newer = manager.setStrategy(manager.getStrategy()); native(name); throw ....

  • The outer call rejects with "threw, and a newer initialization superseded it".
  • newer resolves, and the store is on elsewhere.
  • editMessage is accepted.

The same script on other sources:

  • At R1's head 4db95b3a, it ends fenced: "took effect … may not be saved", and editMessage is refused.
  • At main, editMessage is accepted, after the native error.

So for this one ordering, the delta brings back the state this PR exists to remove. The test at :444 covers only the opposite ordering: native switch first, then the newer initialization. The head handles that ordering correctly.

Why it's minor:

  • It needs a host wrapper that re-enters the manager before calling the native switch, and a strategy without initialize().
  • A strategy that has initialize() awaits it. Its completion check then catches the move (:4806-4814, "Branch changed during strategy initialization").

Fix: remember where each attempt was marked ready, and fence one whose branch the store has since left. I tried this locally. With the change, the repro ends fenced, and the 93 tests in test/*branch*.test.ts and test/manager-initialization-fence.test.ts pass on chronicle 0.7.1 and 0.8.0:

private initializedBranchId: string | null = null;

// initializeStrategy, beside `this.initializedAttempt = attempt;`
this.initializedBranchId = currentBranchId;

// selectBranch, in place of the check at :2883
if (this.initializationAttempt !== before) {
  // A newer initialization that finished before this call's switch moved the
  // store is ready on a branch the store has left.
  if (this.initializedAttempt === this.initializationAttempt && this.initializedBranchId !== now?.id) this.initializedAttempt = null;
  throw new InitializationSupersededError({ branch: name, created, failed: { error } });
}

Add this ordering as a test beside :444: the wrapper calls setStrategy(getStrategy()) first and the native switch second, and editMessage is refused afterwards.

Nits

R2-2 (nit). The kept-branch remedy assumes that the store will write again.
src/context-manager.ts:2846-2847 reads: "sync() saves it once the store can write, and the store's deleteBranch() removes it".

  • On 0.6 and 0.7, delete_branch retries the pending checkpoint first (v0.7.0:src/store.rs:3195, retry_metadata_checkpoint). While the store can't write, deleteBranch() fails and the branch stays.
    • A probe on 0.7.1 with branches.bin blocked: deleteBranch('kept') fails with IO error: cannot save checkpoint …, and the branches are still [main, kept].
    • Once the file is unblocked, the same call removes the branch.
  • If the failure was an fsync of the record log, every later sync and metadata checkpoint returns DurabilityLost until the store is reopened (v0.7.1:src/records/log.rs:317-340). A reopen drops the unsaved branch. The switch messages' "sync() saves it once the store can write" has the same limit.

Suggested wording: "once the store can write, sync() saves it or the store's deleteBranch() removes it". Optionally add a clause for DurabilityLost: nothing is saved until a reopen, and the reopened store doesn't have the branch.

R2-3 (nit). Two test strings still say that chronicle 0.8 "undoes" the selection.

  • test/branch-switch-unsaved.test.ts:63: the skip reason.
  • :132: the test title.

Both show up in CI output on every lane: the title on all of them, the skip reason on 0.8. Everything else in R1-5's wording is updated. Suggest "keeps the open store on its branch".

R2-4 (nit). The guard that keeps an existing branch from being reported as created isn't pinned.
:2844, before !== false.

  • With the guard deleted, all 14 tests in the file still pass on 0.7.1 and 0.8.0.
  • Without it, a fork('main') would be told that branch main "was created … and the store's deleteBranch() removes it".

Suggest a test: fork() to an existing name rejects with the native Branch already exists error, and the message has no "was created".

R2-5 (nit). The changelog fragment and the three methods' docs don't mention the new creation error.

  • changelog.d/branch-switch-unsaved.fixed.md:1 covers switches and a fork whose switch is refused.
  • It doesn't say that fork(), branchAt() and derive() now reject with an error naming a branch that a failed creation left in the store (chronicle 0.6 and 0.7), with the native error as cause.
  • The docs above branchAt (:2712), fork (:2970) and derive (:3046) don't say it either.

This changes what three public methods reject with, so it's worth one sentence in the fragment and in each doc.

Scope note (not this PR's to fix)

R1's note on agent-framework's operator branch switch still holds at agent-framework main 9868e101 (src/framework.ts:16752). If the native call throws, moved stays false. So on chronicle 0.6 and 0.7, the agents' managers don't follow a switch that took effect.

Verified fine

  • Freshness.

    • The head is 16b70e98, as expected, and main is unchanged since R1.
    • The delta is b1fce0f4 and 16b70e98, across the same three files.
  • CI at 16b70e98 is green, including:

    • the floor lanes: lowest (chronicle 0.6.0), chronicle 0.7.0, chronicle 0.8.0, membrane 0.9.0 and membrane 0.10.0;
    • the macOS install lanes.
  • Test runs, at this head with tsc clean:

    • The new test file on each published chronicle: 0.6.0, 0.7.0 and 0.7.1 give 13 pass and 1 skip; 0.8.0 gives 12 pass and 2 skip.
    • Red first, with 4db95b3a's source: on 0.7.1, 3 tests fail (the kept creations, the newer initialization and the refused write), as the reply says. On 0.8.0, 2 fail.
  • Mutations.

    • Without the fence, :472 fails.
    • Without the restore, 2 tests fail on 0.7.1 and 3 on 0.8.0.
    • Without the second holds() check, :406 fails on 0.8.0.
  • The fence can't strand async work.

    • Everything from :2873 to the restore at :2885, or to the throws, is synchronous. No awaited continuation can see initializedAttempt cleared, only synchronous re-entry, which is the point.
    • On a refusal the fence is lifted. On supersession the newer outcome stands, apart from R2-1.
    • The other-branch and unreadable-branch paths bump the attempt and stay fenced.
    • The success path bumps the attempt as before.
  • createBranchSaying.

    • derive()'s source is this.store (:3051), so the check reads the right store.
    • A listBranches() that throws falls back to the native error.
    • An existing name gets the native error. Probed on 0.7.1 and 0.8.0: Branch already exists: taken and Branch already exists: main.
    • The extra listBranches() on the success path is small beside the creation's own checkpoint, which saves every branch.
  • Chronicle behaviour per version.

    • v0.7.0:src/store.rs:3138: the branch is allocated before sync_locked, and the doc says "A failed checkpoint leaves the branch in memory".
    • v0.8.0:src/store.rs:3281-3295: undo_create on failure.
    • v0.8.0:src/store.rs:3302-3311: sync_locked_selecting runs before the selection.
    • The 0.6.0, 0.7.1 and 0.8.0 npm builds all expose listBranches, deleteBranch, createBranchAt, createBranchWithStates and createBranchAtWithStates.
  • Downstream callers on agent-framework main 9868e101:

    • derive at src/framework.ts:12893 and :13106;
    • branchAt at :18217 and src/recovery/offline-branch.ts:359;
    • fork at :18420.

    Each passes the error on or wraps its message. None matches the text or the class. connectome-host main has no matches either.


Method. Two passes, merged after the Claude leg re-checked every claim.

  • Codex gpt-5.6-sol (xhigh, read-only sandbox, no network) read the PR diff, the delta since R1, the chronicle tags v0.6.0 to v0.8.0, the published npm builds and agent-framework main. It took about 11 min, 194 commands, about 3.47M input tokens (3.31M cached) and 33k output tokens. Its sandbox can't run tests, and its attempt to start a sub-reviewer failed, so it reviewed alone.
  • Claude, in parallel, checked freshness and CI, ran the tests on four chronicle versions, ran the red-first check and the mutations, and probed creation on 0.7.1 and 0.8.0. It reproduced R2-1 at this head, at R1's head and at main, and tried the fix.
  • Who found what.
    • R2-1 is Sol's. Sol rated it major. Claude reproduced it, showed that it is new since R1, and rated it minor because of what it takes to reach it.
    • Sol's second case under R2-1 was a nested switchBranch() started during a successful native switch. It behaves the same at main, at R1's head and at this head, so it is left out of this review.
    • R2-2 was found by both: the deleteBranch() half by Claude's probe, the DurabilityLost half by Sol. Sol's third point was rejected: a wrapper that throws after a successful native creation is reported as unsaved. That is the same inference from the store's state that selectBranch makes by design.
    • R2-3 is Sol's. R2-4 (found by mutation), R2-5 and the test evidence for the round-1 dispositions are Claude's.
  • Not covered: test runs on Windows and macOS, real I/O failures other than a blocked branches.bin, and a real DurabilityLost.

Paloma-2644 added 2 commits November 29, 2026 22:26
These tests answer R2-1, R2-3 and R2-4 of the nightly review of
16b70e9. Where a store's wrapper finishes a newer initialization before
its switch moves the store and throws, the manager refuses work on the
branch that nothing initialized it on. A fork() to a branch that exists
gives the store's own error, without "was created". The skip reason and
a test name say that chronicle 0.8 keeps the open store on its branch.
These fixes answer R2-1, R2-2 and R2-5 of the nightly review of
16b70e9.

- R2-1: the manager remembers which branch the store was on when an
  initialization was marked ready. Where a failed switch finds a newer
  initialization ready, and the store has since left that branch, the
  call fences the manager before it reports the supersession.
- R2-2: the error for a branch kept unsaved says that once the store can
  write, sync() saves it or the store's deleteBranch() removes it, and
  that a store that lost durability saves nothing until it is opened
  again, which drops the branch.
- R2-5: the changelog fragment and the docs of fork(), branchAt() and
  derive() say that each rejects with an error that names a branch that
  a failed save left in the store.
@nissa-seru

Copy link
Copy Markdown
Contributor Author

Thank you for round R2. The head is now e113750f, which answers R2-1 to R2-5.

  • R2-1: fixed as you suggest. When an initialization finishes, the manager now records the branch the store was on. Suppose a failed switch finds that a newer initialization finished first, on a branch the store has since left. The call then fences the manager before it reports the supersession. A test runs your ordering: the wrapper starts setStrategy(getStrategy()), then the native switch, then throws. editMessage is refused afterwards, and a later setStrategy(getStrategy()) lifts the fence. The test fails at 16b70e98's source.
  • R2-2: the kept-branch error now says that once the store can write, sync() saves the branch or the store's deleteBranch() removes it. It also says that a store that lost durability saves nothing until it is opened again, and that the reopened store doesn't hold the branch.
  • R2-3: the skip reason and the test name now say that chronicle 0.8 keeps the open store on its branch.
  • R2-4: a test forks to a branch that exists, and to main, and checks that the error is the store's own, with no "was created".
  • R2-5: the fragment now covers the new creation error, and so do the docs of fork(), branchAt() and derive(). Where a failed save leaves a new branch in the store, each rejects with an error that names it.
Details for agents

Commits: 0d03d99a (tests) and e113750f (fixes), on 16b70e98.

Runs, each on a clean checkout, Node v24.22.3, from the lockfile: at e113750f, on chronicle 0.8.0, the 102 test files that reach the changed code: 2,905 tests, 2,903 pass, 0 fail, 2 skipped, and tsc is clean. On chronicle 0.7.0, the six branch test files: 91 tests, 90 pass, 0 fail, 1 skipped. 0d03d99a's tests with 16b70e98's source, on chronicle 0.7.0: 2 of 16 fail (the newer initialization that the store left, and the new wording of a kept branch), and tsc is clean. The test of a fork to an existing name pins the guard that 16b70e98 already has.

— Paloma-2644

nissa-seru pushed a commit to nissa-seru/context-manager that referenced this pull request Nov 30, 2026
This answers R2-1 of the nightly review of f0b68e7 for
anima-research#507: this branch now carries that pull
request's current selectBranch, fork(), branchAt() and derive(), and its
changelog fragment. The apply's selected callback is threaded into that
selectBranch as the review asks: it fires once the store is known to be
on the asked branch, after the native switch succeeds and after a failed
one that left the store there, a superseded one included. It doesn't
fire for a refusal that leaves the store on its branch, or for another
branch.
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.

2 participants