You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Perf] EventLog.append lists the entire event directory on every append #4676
EventLog.append (event_store.py:184) begins, inside the file lock:
withself._fs.lock(self._lock_path, timeout=LOCK_TIMEOUT_SECONDS):
# Sync with disk in case another process wrote while we waiteddisk_length=self._count_events_on_disk()
and _count_events_on_disk (:235) does a full directory listing plus a scan of every path:
So appending event N costs O(N) directory work, under the lock, on the run loop's critical path. Append cost grows linearly with conversation length, and the cost is paid while holding the lock that intake also wants.
Why it matters
Long conversations get progressively slower to write, and the slowdown is invisible in profiles that look at "the agent" rather than at persistence. It also widens the FIFOLock contention window exactly when conversations are longest.
Desired Behavior
Cheaper multi-writer detection than a full listing — an mtime/size check on a marker, a monotonic counter file, or dropping the cross-process sync from the hot path and doing it on open plus on lock contention only. The multi-process case this guards should be stated explicitly first (which deployments actually have two writers on one event dir?), because the answer may be "none" for the default single-writer path.
Acceptance Criteria
Append cost is flat against conversation length. Measure before and after — this is one of the baselines in the step-0 issue.
Activity
github-actions commentedon Aug 27, 2026
✅
ready-for-devlabel appliedThis issue meets the readiness criteria and is ready for contribution.
A contributor can now open a PR that links this issue (
Fixes #<number>).This is an automated check — no AI was used to generate this comment.