Skip to content

memory writer creates corrupt directory trees from unvalidated path segments (absolute paths, 0, null) #1045

Description

@agents-squads

The memory-write path builds directories from unvalidated variables. Observed corruption classes in real workspaces:

  1. An absolute file path used as a subdirectory chain: .agents/memory/<squad>/Users/<user>/.../<agent>.md/executions.md (a .md FILE name becoming a directory).
  2. Falsy values as directory names: .agents/memory/0/, .agents/memory/null/ — created as recently as today.

Fix: validate path segments before mkdir/write — reject absolute-path fragments, empty/falsy stringifications (0, null, undefined, None), and any segment ending in .md; fail loud instead of writing. Add a unit test per corruption class.

15+ corrupt trees found in a corpus audit; they will be purged, but the writer must stop producing them or the cleanup is Sisyphean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions