Skip to content

fix: tolerate missing private_key_nsec in agent store#1220

Merged
wpfleger96 merged 1 commit into
mainfrom
duncan/agent-store-serde-default
Jun 23, 2026
Merged

fix: tolerate missing private_key_nsec in agent store#1220
wpfleger96 merged 1 commit into
mainfrom
duncan/agent-store-serde-default

Conversation

@wpfleger96

Copy link
Copy Markdown
Collaborator

A keyring build migrates each agent's nsec into the macOS Keychain and strips the inline private_key_nsec from the shared dev agent store. On the old (non-keyring) build, private_key_nsec is a required field on ManagedAgentRecord, so a stripped/missing inline key fails the whole serde_json::from_str at the first affected record — taking down load_managed_agents, nest-context regeneration, and every agent at once.

Adding #[serde(default)] to private_key_nsec widens the old build's read tolerance: a missing inline key now deserializes to an empty String instead of failing the parse, letting an old build survive a half-migrated store. The empty-key case is already handled downstream by the existing spawn-refusal path, so this is pure read-tolerance widening with no behavior change for valid stores.

Related: keyring foundation #1172 (already forwards-tolerant on its own load path).

A keyring build migrates each agent nsec into the macOS Keychain and strips the inline private_key_nsec from the shared dev store. Without serde(default) the required field made an older build fail the whole serde_json::from_str at the first stripped record, taking down load_managed_agents, nest regen, and every agent. Widening read tolerance lets an old build survive a half-migrated store; the empty-key spawn-refusal path already handles the missing value downstream.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96 wpfleger96 merged commit c58e988 into main Jun 23, 2026
25 checks passed
@wpfleger96 wpfleger96 deleted the duncan/agent-store-serde-default branch June 23, 2026 21:55
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