Skip to content

feat: add eviction/size-cap to in-memory activity stores #837

@Aureliolo

Description

@Aureliolo

Context

PR #832 introduced ToolInvocationTracker and DelegationRecordStore as in-memory, append-only stores. Both grow without bound.

Problem

In long-running deployments with active tool usage and delegation, these stores will consume unbounded memory. Each ToolInvocationRecord is ~300-700 bytes. At 1,000 records/minute, that is ~10M records over a week.

Proposed Solution

Add an optional max_records constructor parameter (default ~10,000) with FIFO eviction. Alternatively, prune records older than the maximum activity query window (168 hours) at write time.

Files

  • src/synthorg/tools/invocation_tracker.py
  • src/synthorg/communication/delegation/record_store.py

Source

Found during PR #832 review (security-reviewer, type-design-analyzer agents).

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:lowNice to have, can deferscope:smallLess than 1 day of workspec:hrDESIGN_SPEC Section 8 - HR & Workforce Managementtype:featureNew feature implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions