Skip to content

Sync audit append is two writes; concurrent appenders can interleave and lose a line #56

Description

@YellowSnnowmann

Surfaced by CodeRabbit on #48 (core/src/sync/audit.rs ~L81-92). Pre-existing — engine original vendor/.../sync/audit.rs:52-53 is the same to_writer + writeln! pair; ported unchanged (byte-pinned).

core/src/sources/sync.rs and sync/composio/periodic.rs can both append. Two write syscalls per entry means two appenders can interleave; read_audit_log then skips the malformed line and its cost data is lost. Note the engine's rebuild pipeline is a third writer with its own copy.

Fix: serialise entry + newline into one buffer, single write_all (O_APPEND makes a single write atomic for typical line sizes). Should land in both copies together — the line format is pinned by audit_line_format_is_pinned.

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