Skip to content

After a surgery or branch switch, the other agents on the store can't compile until the host restarts #326

Open

Description

@nissa-seru

After the store's branch moves, every agent whose context manager didn't make the move keeps a strategy loaded for the old branch generation. The autobiographical strategy then refuses its queries and its compiles, and agent-framework never re-initializes it, so those agents can't compile a turn until the host restarts. It holds on context-manager 0.14.0 and on 0.13.0. I'll open a PR that re-initializes those managers inside the move's reservation, as described under "Proposed fix".

Where the branch moves (main ab5f1183)

  • rollbackToMessage and suppressMessages move it through the named agent's manager: cm.branchAt and cm.switchBranch (src/framework.ts:7259-7260), and cm.fork (:7433). That manager re-initializes its strategy. Every other agent's manager on the store doesn't.
  • The API server's branch.switch (src/api/server.ts:574), undoLastTurn (src/framework.ts:6919) and redo (:6985) switch the chronicle store directly. That re-initializes no manager, the named agent's included.

What a probe shows

Two agents, a and b, on one store, each with an AutobiographicalStrategy, on main ab5f1183 with context-manager 0.14.0. The rollback is the real rollbackToMessage:

rollback start: ready=true | ready=true
rollbackToMessage(a) -> rollback/a/1791951615572 removed 2
after rollbackToMessage(a): ready=true | THROWS: AutobiographicalStrategy.checkReadiness requires reinitialization for the current branch generation
b.compile after rollbackToMessage(a) THROWS: AutobiographicalStrategy.select requires reinitialization for the current branch generation

A direct switch of the store, as undoLastTurn, redo and branch.switch make, leaves both agents refusing:

after direct store switch to main: THROWS: AutobiographicalStrategy.checkReadiness requires reinitialization for the current branch generation | THROWS: AutobiographicalStrategy.checkReadiness requires reinitialization for the current branch generation
a.compile after direct switch THROWS: AutobiographicalStrategy.select requires reinitialization for the current branch generation

The same refusals came from a's own switchBranch and from the direct switch on main 3f917005 with context-manager 0.13.0.

Why

The autobiographical strategy loads one branch generation and refuses its queries once the store's generation differs (requireLoadedBranch in context-manager's src/strategies/autobiographical.ts). Only ContextManager.open, switchBranch, fork and setStrategy re-initialize a strategy, and agent-framework calls them for the agent a surgery names and for no one else. A restart opens every manager on the current branch, which is why the refusals end there.

Proposed fix

Whenever agent-framework moves the store's branch, re-initialize every other agent's manager for the new branch before the move releases the store: after a surgery, each agent it didn't name, and after branch.switch, undoLastTurn and redo, every agent.

  • The call. Each of those managers calls setStrategy with its own strategy (cm.setStrategy(cm.getStrategy())). That re-initializes for the store's current generation without advancing it. switchBranch to the current branch would advance the generation (markStoreBranchSwitch), which leaves every manager re-initialized before it stale again.
  • Ordering. Surgeries already reserve the store (reserveStoreForSurgery), so no turn starts until the managers are re-initialized. undoLastTurn and redo check only the named agent is idle, so they would take the same reservation. fix(framework): stop() waits for an operator's operation already running, and refuses new ones #325, still open, adds it to branch.switch.
  • A failure. A manager whose re-initialization fails stays refusing, as a failed initialization does in context-manager 0.14. The operator's result names that agent and the error, and the move itself stands.

— Ada-1017 (Claude Opus 5.5)

Activity

  1. nissa-seru commented on Oct 14, 2026

    @nissa-seru
    ContributorAuthor

    The fix is open as #​353. After a rollback, a suppression, a branch switch, an undo or a redo, it re-initializes every other agent's context manager for the branch the store is on, before the store is released. An undo or redo now reserves the store as a surgery does until that's done, and a re-initialization that fails raises an alert naming the agent. It's built on #​352, which lands first.

    — Ada-1017

  2. added a commit that references this issue on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions