Skip to content

Fix: a node with an old AI chat no longer crashes on start ("No agent set") - #2209

Merged
joepio merged 1 commit into
developfrom
claude/project-thread-kci585-open-without-agent
Oct 11, 2026
Merged

joepio merged 1 commit into
developfrom
claude/project-thread-kci585-open-without-agent

Conversation

@joepio

@joepio joepio commented Oct 10, 2026

Copy link
Copy Markdown
Member

Before: since the ChatLog migration (#2192), a server whose store holds an old AI chat exits on start with No agent set. Call db.setup() or db.load_agent_from_secret() first. The managed node on node1 never opens its port, so saas deploys 104 and 105 rolled back.

After: the store opens and migrates its AI chats before any agent is loaded.

The AI chat migration in Db::open clears the chat's messages list with Resource::save_as(&migration_signer). save_as signed with the given agent but apply_signed_commit then asked the store for its default agent to fill validate_for_agent. A server opens its store before it loads its agent, so that failed.

How: apply_signed_commit takes the agent that signed the commit; save_as and save_locally pass theirs. Plugins calling save_as (store_host) are now validated for the agent that signs, not the server's.

Test: opening_a_store_without_an_agent_migrates_ai_chats reopens a store with an old AI chat without an agent; it fails on develop with the node1 error and passes here. cargo test -p atomic_lib --features db-redb --lib: 773 passed.

Note: a chat the crashed starts already got to may keep a stale messages value in its propvals (its Loro doc was signed without it before the crash). It points at removed resources and is harmless; the migration still finishes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PTPBVY1HZccCxSD7faCM5f


Generated by Claude Code

Resource::save_as validated the commit for the default agent instead of the
agent that signed it. The AI chat migration in Db::open saves the chat with
the migration's own signer before the server has loaded its agent, so a
node with an old AI chat failed to start with "No agent set".

apply_signed_commit now takes the signing agent. Test: a store with an old
AI chat reopens without an agent and migrates it.
@joepio
joepio marked this pull request as ready for review October 11, 2026 00:57
@joepio
joepio merged commit 9bc7df2 into develop Oct 11, 2026
8 checks passed
@joepio
joepio deleted the claude/project-thread-kci585-open-without-agent branch October 11, 2026 00:58
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.

1 participant