fix(memory): startup accepted an unusable memory directory #916

Closed
opened 2026-10-27 13:38:16 +00:00 by sam · 0 comments
Owner

cmd/archied/main.go builds the builtin memory provider at filepath.Join(cfg.WorkDir, "memory") and logs 'memory manager started' regardless of whether that path exists or is writable. builtin.NewStore treats ENOENT as an empty document and Reload does the same, so a missing directory is indistinguishable from a memory with nothing in it yet.

Found live: carina's config was copied to the laptop with work_dir = /var/lib/archie/work, a container path that does not exist here. archied logged 'memory manager started dir=/var/lib/archie/work/memory' and ran with no memory at all. The failure would only have surfaced at the agent's first memory write, when writeFileAtomic's MkdirAll hit EACCES on /var/lib -- mid-conversation, as a tool error, after startup said it was fine.

Fixed: builtin.New now does MkdirAll(cfg.Dir) and returns an error the operator can act on, so an unusable path fails at startup where the existing error path already exits non-zero. New's doc claimed 'the provider is ready for use as soon as New returns'; it now is.


Imported from beads archie-core-1786637499992-388-15ec94cd · GitHub #409 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08

cmd/archied/main.go builds the builtin memory provider at filepath.Join(cfg.WorkDir, "memory") and logs 'memory manager started' regardless of whether that path exists or is writable. builtin.NewStore treats ENOENT as an empty document and Reload does the same, so a missing directory is indistinguishable from a memory with nothing in it yet. Found live: carina's config was copied to the laptop with work_dir = /var/lib/archie/work, a container path that does not exist here. archied logged 'memory manager started dir=/var/lib/archie/work/memory' and ran with no memory at all. The failure would only have surfaced at the agent's first memory write, when writeFileAtomic's MkdirAll hit EACCES on /var/lib -- mid-conversation, as a tool error, after startup said it was fine. Fixed: builtin.New now does MkdirAll(cfg.Dir) and returns an error the operator can act on, so an unusable path fails at startup where the existing error path already exits non-zero. New's doc claimed 'the provider is ready for use as soon as New returns'; it now is. --- _Imported from beads `archie-core-1786637499992-388-15ec94cd` · GitHub #409 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08_
sam added the mediumbug labels 2026-10-27 13:38:16 +00:00
sam self-assigned this 2026-10-27 13:38:16 +00:00
sam closed this issue 2026-10-27 13:38:17 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#916